* make SpkGraphTools compilable
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1695 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
parent
f7743aa480
commit
4b819ad6f7
@ -4,10 +4,11 @@ unit SpkGraphTools;
|
|||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses Windows, Graphics, Classes, Math, Sysutils, Dialogs,
|
uses
|
||||||
SpkMath;
|
LCLIntf, Graphics, LCLType, Classes, Math, Sysutils, Dialogs, SpkMath;
|
||||||
|
|
||||||
const NUM_ZERO = 0.00000001;
|
const
|
||||||
|
NUM_ZERO = 0.00000001;
|
||||||
|
|
||||||
(*******************************************************************************
|
(*******************************************************************************
|
||||||
* *
|
* *
|
||||||
@ -15,48 +16,30 @@ const NUM_ZERO = 0.00000001;
|
|||||||
* *
|
* *
|
||||||
*******************************************************************************)
|
*******************************************************************************)
|
||||||
|
|
||||||
type // WskaŸnik do tablicy TRGBTriple
|
type
|
||||||
|
// WskaŸnik do tablicy TRGBTriple
|
||||||
PRGBTripleArray = ^TRGBTripleArray;
|
PRGBTripleArray = ^TRGBTripleArray;
|
||||||
// Tablica TRGBTriple (u¿ywana podczas operacji ze ScanLine)
|
// Tablica TRGBTriple (u¿ywana podczas operacji ze ScanLine)
|
||||||
TRGBTripleArray = array[word] of TRGBTriple;
|
TRGBTripleArray = array[word] of TRGBTriple;
|
||||||
|
|
||||||
type THSLTriple = record
|
THSLTriple = record
|
||||||
H, S, L : extended;
|
H, S, L : extended;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
type // Typ u¿ywany podczas rysowania gradientów
|
// Rodzaj gradientu
|
||||||
TRIVERTEX = packed record
|
|
||||||
x,y : DWORD;
|
|
||||||
Red,
|
|
||||||
Green,
|
|
||||||
Blue,
|
|
||||||
Alpha : Word;
|
|
||||||
end;
|
|
||||||
|
|
||||||
type // Rodzaj gradientu
|
|
||||||
TGradientType = (gtVertical, gtHorizontal);
|
TGradientType = (gtVertical, gtHorizontal);
|
||||||
// Rodzaj linii gradientowej (miejsce rozmycia)
|
// Rodzaj linii gradientowej (miejsce rozmycia)
|
||||||
TGradientLineShade = (lsShadeStart, lsShadeEnds, lsShadeCenter, lsShadeEnd);
|
TGradientLineShade = (lsShadeStart, lsShadeEnds, lsShadeCenter, lsShadeEnd);
|
||||||
// Rodzaj linii gradientowej (wypuk³oœæ)
|
// Rodzaj linii gradientowej (wypuk³oœæ)
|
||||||
TGradient3dLine = (glRaised, glLowered);
|
TGradient3dLine = (glRaised, glLowered);
|
||||||
|
|
||||||
(*******************************************************************************
|
|
||||||
* *
|
|
||||||
* Nag³ówki dla zewnêtrznych funkcji *
|
|
||||||
* *
|
|
||||||
*******************************************************************************)
|
|
||||||
|
|
||||||
function GradientFill(DC : hDC; pVertex : Pointer; dwNumVertex : DWORD; pMesh : Pointer; dwNumMesh, dwMode: DWORD) : DWord; stdcall; external 'msimg32.dll';
|
|
||||||
|
|
||||||
(*******************************************************************************
|
(*******************************************************************************
|
||||||
* *
|
* *
|
||||||
* Klasy narzêdziowe *
|
* Klasy narzêdziowe *
|
||||||
* *
|
* *
|
||||||
*******************************************************************************)
|
*******************************************************************************)
|
||||||
|
|
||||||
type TColorTools = class(TObject)
|
TColorTools = class
|
||||||
private
|
|
||||||
protected
|
|
||||||
public
|
public
|
||||||
class function Darken(kolor : TColor; percentage : byte) : TColor;
|
class function Darken(kolor : TColor; percentage : byte) : TColor;
|
||||||
class function Brighten(kolor : TColor; percentage : byte) : TColor;
|
class function Brighten(kolor : TColor; percentage : byte) : TColor;
|
||||||
@ -74,9 +57,7 @@ type TColorTools = class(TObject)
|
|||||||
class function ColorToGrayscale(AColor : TColor) : TColor;
|
class function ColorToGrayscale(AColor : TColor) : TColor;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
type TGradientTools = class(TObject)
|
TGradientTools = class
|
||||||
private
|
|
||||||
protected
|
|
||||||
public
|
public
|
||||||
class procedure HGradient(canvas : TCanvas; cStart,cEnd : TColor; rect : T2DIntRect); overload;
|
class procedure HGradient(canvas : TCanvas; cStart,cEnd : TColor; rect : T2DIntRect); overload;
|
||||||
class procedure HGradient(canvas : TCanvas; cStart,cEnd : TColor; p1, p2 : TPoint); overload;
|
class procedure HGradient(canvas : TCanvas; cStart,cEnd : TColor; p1, p2 : TPoint); overload;
|
||||||
@ -97,9 +78,7 @@ type TGradientTools = class(TObject)
|
|||||||
class procedure VGradient3dLine(canvas : TCanvas; x,y1,y2 : integer; ShadeMode : TGradientLineShade; A3dKind : TGradient3dLine = glLowered);
|
class procedure VGradient3dLine(canvas : TCanvas; x,y1,y2 : integer; ShadeMode : TGradientLineShade; A3dKind : TGradient3dLine = glLowered);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
type TTextTools = class
|
TTextTools = class
|
||||||
private
|
|
||||||
protected
|
|
||||||
public
|
public
|
||||||
class procedure OutlinedText(Canvas : TCanvas; x, y : integer; text : string);
|
class procedure OutlinedText(Canvas : TCanvas; x, y : integer; text : string);
|
||||||
end;
|
end;
|
||||||
@ -333,7 +312,7 @@ end;
|
|||||||
class procedure TGradientTools.HGradient(canvas : TCanvas; cStart,cEnd : TColor; rect : T2DIntRect);
|
class procedure TGradientTools.HGradient(canvas : TCanvas; cStart,cEnd : TColor; rect : T2DIntRect);
|
||||||
|
|
||||||
var vert : array[0..1] of TRIVERTEX;
|
var vert : array[0..1] of TRIVERTEX;
|
||||||
gRect : _GRADIENT_RECT;
|
gRect : GRADIENTRECT;
|
||||||
Col1,Col2 : TColor;
|
Col1,Col2 : TColor;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@ -379,7 +358,7 @@ end;
|
|||||||
class procedure TGradientTools.VGradient(canvas : TCanvas; cStart,cEnd : TColor; rect : T2DIntRect);
|
class procedure TGradientTools.VGradient(canvas : TCanvas; cStart,cEnd : TColor; rect : T2DIntRect);
|
||||||
|
|
||||||
var vert : array[0..1] of TRIVERTEX;
|
var vert : array[0..1] of TRIVERTEX;
|
||||||
gRect : _GRADIENT_RECT;
|
gRect : GRADIENTRECT;
|
||||||
Col1,Col2 : TColor;
|
Col1,Col2 : TColor;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
@ -289,12 +289,22 @@ type
|
|||||||
end;
|
end;
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
|
operator := (ARect: TRect): T2DIntRect;
|
||||||
|
|
||||||
operator - (Left: T2DVector; Right: T2DVector): T2DVector;
|
operator - (Left: T2DVector; Right: T2DVector): T2DVector;
|
||||||
|
|
||||||
operator - (Left: T3DVector; Right: T3DVector): T3DVector;
|
operator - (Left: T3DVector; Right: T3DVector): T3DVector;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
operator := (ARect: TRect): T2DIntRect;
|
||||||
|
begin
|
||||||
|
Result.Left := ARect.Left;
|
||||||
|
Result.Top := ARect.Top;
|
||||||
|
Result.Right := ARect.Right;
|
||||||
|
Result.Bottom := ARect.Bottom;
|
||||||
|
end;
|
||||||
|
|
||||||
operator - (Left: T2DVector; Right: T2DVector): T2DVector;
|
operator - (Left: T2DVector; Right: T2DVector): T2DVector;
|
||||||
begin
|
begin
|
||||||
Result.x := Left.x - Right.x;
|
Result.x := Left.x - Right.x;
|
||||||
|
Loading…
Reference in New Issue
Block a user