* 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:
blikblum 2011-06-18 00:19:41 +00:00
parent f7743aa480
commit 4b819ad6f7
2 changed files with 67 additions and 78 deletions

View File

@ -4,10 +4,11 @@ unit SpkGraphTools;
interface
uses Windows, Graphics, Classes, Math, Sysutils, Dialogs,
SpkMath;
uses
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;
// Tablica TRGBTriple (u¿ywana podczas operacji ze ScanLine)
TRGBTripleArray = array[word] of TRGBTriple;
type THSLTriple = record
THSLTriple = record
H, S, L : extended;
end;
type // Typ u¿ywany podczas rysowania gradientów
TRIVERTEX = packed record
x,y : DWORD;
Red,
Green,
Blue,
Alpha : Word;
end;
type // Rodzaj gradientu
// Rodzaj gradientu
TGradientType = (gtVertical, gtHorizontal);
// Rodzaj linii gradientowej (miejsce rozmycia)
TGradientLineShade = (lsShadeStart, lsShadeEnds, lsShadeCenter, lsShadeEnd);
// Rodzaj linii gradientowej (wypuk³oœæ)
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 *
* *
*******************************************************************************)
type TColorTools = class(TObject)
private
protected
TColorTools = class
public
class function Darken(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;
end;
type TGradientTools = class(TObject)
private
protected
TGradientTools = class
public
class procedure HGradient(canvas : TCanvas; cStart,cEnd : TColor; rect : T2DIntRect); 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);
end;
type TTextTools = class
private
protected
TTextTools = class
public
class procedure OutlinedText(Canvas : TCanvas; x, y : integer; text : string);
end;
@ -333,7 +312,7 @@ end;
class procedure TGradientTools.HGradient(canvas : TCanvas; cStart,cEnd : TColor; rect : T2DIntRect);
var vert : array[0..1] of TRIVERTEX;
gRect : _GRADIENT_RECT;
gRect : GRADIENTRECT;
Col1,Col2 : TColor;
begin
@ -379,7 +358,7 @@ end;
class procedure TGradientTools.VGradient(canvas : TCanvas; cStart,cEnd : TColor; rect : T2DIntRect);
var vert : array[0..1] of TRIVERTEX;
gRect : _GRADIENT_RECT;
gRect : GRADIENTRECT;
Col1,Col2 : TColor;
begin

View File

@ -289,12 +289,22 @@ type
end;
{$endif}
operator := (ARect: TRect): T2DIntRect;
operator - (Left: T2DVector; Right: T2DVector): T2DVector;
operator - (Left: T3DVector; Right: T3DVector): T3DVector;
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;
begin
Result.x := Left.x - Right.x;