+ Patch from Mattias Gaertner to rename TFPCanvasHelper.Color -> FPCOlor

This commit is contained in:
michael 2004-12-24 08:31:06 +00:00
parent 9d567a3c63
commit 65de79d42b
8 changed files with 58 additions and 58 deletions

View File

@ -33,17 +33,17 @@ begin
pen.mode := pmCopy; pen.mode := pmCopy;
pen.style := psSolid; pen.style := psSolid;
pen.width := 1; pen.width := 1;
pen.color := colred; pen.FPColor := colred;
with pen.color do with pen.FPColor do
red := red div 4; red := red div 4;
Ellipse (10,10, 90,90); Ellipse (10,10, 90,90);
pen.style := psDashDot; pen.style := psDashDot;
pen.color := colred; pen.FPColor := colred;
HashWidth := 10; HashWidth := 10;
Ellipse (10,10, 90,90); Ellipse (10,10, 90,90);
with pen.color do with pen.FPColor do
begin begin
red := red div 2; red := red div 2;
green := red div 4; green := red div 4;
@ -53,19 +53,19 @@ begin
RelativeBrushImage := true; RelativeBrushImage := true;
brush.image := ci; brush.image := ci;
brush.style := bsimage; brush.style := bsimage;
with brush.color do with brush.FPColor do
green := green div 2; green := green div 2;
Ellipse (11,11, 89,89); Ellipse (11,11, 89,89);
brush.style := bsSolid; brush.style := bsSolid;
brush.color := MyColor; brush.FPColor := MyColor;
pen.style := psSolid; pen.style := psSolid;
pen.width := 3; pen.width := 3;
pen.color := colSilver; pen.FPColor := colSilver;
ellipse (30,35, 70,65); ellipse (30,35, 70,65);
pen.width := 1; pen.width := 1;
pen.color := colCyan; pen.FPColor := colCyan;
ellipseC (50,50, 1,1); ellipseC (50,50, 1,1);
writeln ('Saving to inspect !'); writeln ('Saving to inspect !');

View File

@ -34,7 +34,7 @@ type
TFPCanvasHelper = class(TPersistent) TFPCanvasHelper = class(TPersistent)
private private
FColor : TFPColor; FFPColor : TFPColor;
FAllocated, FAllocated,
FFixedCanvas : boolean; FFixedCanvas : boolean;
FCanvas : TFPCustomCanvas; FCanvas : TFPCustomCanvas;
@ -52,7 +52,7 @@ type
procedure DoAllocateResources; virtual; procedure DoAllocateResources; virtual;
procedure DoDeAllocateResources; virtual; procedure DoDeAllocateResources; virtual;
procedure DoCopyProps (From:TFPCanvasHelper); virtual; procedure DoCopyProps (From:TFPCanvasHelper); virtual;
procedure SetColor (AValue:TFPColor); virtual; procedure SetFPColor (AValue:TFPColor); virtual;
procedure Changing; dynamic; procedure Changing; dynamic;
procedure Changed; dynamic; procedure Changed; dynamic;
Procedure Lock; Procedure Lock;
@ -70,7 +70,7 @@ type
// Canvas for which the helper is allocated // Canvas for which the helper is allocated
property Canvas : TFPCustomCanvas read FCanvas; property Canvas : TFPCustomCanvas read FCanvas;
// color of the helper // color of the helper
property Color : TFPColor read FColor Write SetColor; property FPColor : TFPColor read FFPColor Write SetFPColor;
property OnChanging: TNotifyEvent read FOnChanging write FOnChanging; property OnChanging: TNotifyEvent read FOnChanging write FOnChanging;
property OnChange: TNotifyEvent read FOnChange write FOnChange; property OnChange: TNotifyEvent read FOnChange write FOnChange;
end; end;

View File

@ -31,7 +31,7 @@ begin
begin begin
self.FName := FName; self.FName := FName;
self.FSize := FSize; self.FSize := FSize;
self.FColor := FColor; self.FFPColor := FFPColor;
self.FFlags := FFlags; self.FFlags := FFlags;
end; end;
end; end;

View File

@ -46,9 +46,9 @@ begin
Raise TFPFontException.CreateFmt (ErrAllocation, [EFont, ErrAlloc[ValueNeeded]]); Raise TFPFontException.CreateFmt (ErrAllocation, [EFont, ErrAlloc[ValueNeeded]]);
end; end;
procedure TFPCanvasHelper.SetColor (AValue:TFPColor); procedure TFPCanvasHelper.SetFPColor (AValue:TFPColor);
begin begin
FColor := AValue; FFPColor := AValue;
end; end;
procedure TFPCanvasHelper.Changing; procedure TFPCanvasHelper.Changing;
@ -121,7 +121,7 @@ end;
procedure TFPCanvasHelper.DoCopyProps (From:TFPCanvasHelper); procedure TFPCanvasHelper.DoCopyProps (From:TFPCanvasHelper);
begin begin
FCanvas := nil; FCanvas := nil;
color := from.color; FPColor := from.FPColor;
end; end;
procedure TFPCanvasHelper.DoAllocateResources; procedure TFPCanvasHelper.DoAllocateResources;

View File

@ -86,7 +86,7 @@ begin
with result do with result do
begin begin
Size := 10; Size := 10;
Color := colBlack; FPColor := colBlack;
end; end;
end; end;
@ -95,7 +95,7 @@ begin
result := TFPEmptyPen.Create; result := TFPEmptyPen.Create;
with result do with result do
begin begin
Color := colBlack; FPColor := colBlack;
width := 1; width := 1;
pattern := 0; pattern := 0;
Style := psSolid; Style := psSolid;
@ -142,7 +142,7 @@ var pattern : longword;
if clipping then if clipping then
CheckLineClipping (ClipRect, x1,y1, x2,y2); CheckLineClipping (ClipRect, x1,y1, x2,y2);
if x1 >= 0 then if x1 >= 0 then
DrawSolidLine (self, x1,y1, x2,y2, pen.color) DrawSolidLine (self, x1,y1, x2,y2, Pen.FPColor)
end; end;
procedure CheckPLine (x1,y1, x2,y2 : integer); procedure CheckPLine (x1,y1, x2,y2 : integer);
@ -150,7 +150,7 @@ var pattern : longword;
if clipping then if clipping then
CheckLineClipping (ClipRect, x1,y1, x2,y2); CheckLineClipping (ClipRect, x1,y1, x2,y2);
if x1 >= 0 then if x1 >= 0 then
DrawPatternLine (self, x1,y1, x2,y2, pattern, pen.color) DrawPatternLine (self, x1,y1, x2,y2, pattern, Pen.FPColor)
end; end;
var b : TRect; var b : TRect;
@ -225,8 +225,8 @@ end;
procedure TFPPixelCanvas.DoEllipseFill (const Bounds:TRect); procedure TFPPixelCanvas.DoEllipseFill (const Bounds:TRect);
begin begin
case Brush.style of case Brush.style of
bsSolid : FillEllipseColor (self, Bounds, brush.color); bsSolid : FillEllipseColor (self, Bounds, Brush.FPColor);
bsPattern : FillEllipsePattern (self, Bounds, brush.pattern, brush.color); bsPattern : FillEllipsePattern (self, Bounds, brush.pattern, Brush.FPColor);
bsImage : bsImage :
if assigned (brush.image) then if assigned (brush.image) then
if FRelativeBI then if FRelativeBI then
@ -235,12 +235,12 @@ begin
FillEllipseImage (self, Bounds, brush.image) FillEllipseImage (self, Bounds, brush.image)
else else
raise PixelCanvasException.Create (sErrNoImage); raise PixelCanvasException.Create (sErrNoImage);
bsBDiagonal : FillEllipseHashDiagonal (self, Bounds, FHashWidth, brush.color); bsBDiagonal : FillEllipseHashDiagonal (self, Bounds, FHashWidth, Brush.FPColor);
bsFDiagonal : FillEllipseHashBackDiagonal (self, Bounds, FHashWidth, brush.color); bsFDiagonal : FillEllipseHashBackDiagonal (self, Bounds, FHashWidth, Brush.FPColor);
bsCross : FillEllipseHashCross (self, Bounds, FHashWidth, brush.color); bsCross : FillEllipseHashCross (self, Bounds, FHashWidth, Brush.FPColor);
bsDiagCross : FillEllipseHashDiagCross (self, Bounds, FHashWidth, brush.color); bsDiagCross : FillEllipseHashDiagCross (self, Bounds, FHashWidth, Brush.FPColor);
bsHorizontal : FillEllipseHashHorizontal (self, Bounds, FHashWidth, brush.color); bsHorizontal : FillEllipseHashHorizontal (self, Bounds, FHashWidth, Brush.FPColor);
bsVertical : FillEllipseHashVertical (self, Bounds, FHashWidth, brush.color); bsVertical : FillEllipseHashVertical (self, Bounds, FHashWidth, Brush.FPColor);
end; end;
end; end;
@ -250,13 +250,13 @@ begin
case style of case style of
psSolid : psSolid :
if pen.width > 1 then if pen.width > 1 then
DrawSolidEllipse (self, Bounds, width, color) DrawSolidEllipse (self, Bounds, width, FPColor)
else else
DrawSolidEllipse (self, Bounds, color); DrawSolidEllipse (self, Bounds, FPColor);
psPattern: psPattern:
DrawPatternEllipse (self, Bounds, pattern, color); DrawPatternEllipse (self, Bounds, pattern, FPColor);
psDash, psDot, psDashDot, psDashDotDot : psDash, psDot, psDashDot, psDashDotDot :
DrawPatternEllipse (self, Bounds, PenPatterns[Style], color); DrawPatternEllipse (self, Bounds, PenPatterns[Style], FPColor);
end; end;
end; end;
@ -321,7 +321,7 @@ procedure TFPPixelCanvas.DoLine (x1,y1,x2,y2:integer);
begin begin
if Clipping then if Clipping then
CheckLineClipping (ClipRect, xx1,yy1, xx2,yy2); CheckLineClipping (ClipRect, xx1,yy1, xx2,yy2);
DrawSolidLine (self, xx1,yy1, xx2,yy2, pen.color); DrawSolidLine (self, xx1,yy1, xx2,yy2, Pen.FPColor);
end; end;
procedure SolidThickLine; procedure SolidThickLine;
@ -357,7 +357,7 @@ begin
case Pen.style of case Pen.style of
psSolid : psSolid :
begin begin
DrawSolidLine (self, x1,y1, x2,y2, pen.color); DrawSolidLine (self, x1,y1, x2,y2, Pen.FPColor);
if pen.width > 1 then if pen.width > 1 then
SolidThickLine; SolidThickLine;
end; end;

View File

@ -278,7 +278,7 @@ procedure TFreeTypeFont.DrawChar (x,y:integer; data:PByteArray; pitch, width, he
g := ((green * a) + (c.green * t)) div 255; g := ((green * a) + (c.green * t)) div 255;
b := ((blue * a) + (c.blue * t)) div 255; b := ((blue * a) + (c.blue * t)) div 255;
end; end;
canv.colors[x,y] := FPcolor(r,g,b,alphaOpaque); canv.colors[x,y] := FPImage.FPColor(r,g,b,alphaOpaque);
end; end;
end; end;
@ -288,7 +288,7 @@ begin
for ry := 0 to height-1 do for ry := 0 to height-1 do
begin begin
for rx := 0 to width-1 do for rx := 0 to width-1 do
combine (canvas, x+rx, y+ry, color, data^[b+rx]); combine (canvas, x+rx, y+ry, FPColor, data^[b+rx]);
inc (b, pitch); inc (b, pitch);
end; end;
end; end;
@ -305,7 +305,7 @@ begin
begin begin
rb := rx mod 8; rb := rx mod 8;
if (data^[b+l] and bits[rb]) <> 0 then if (data^[b+l] and bits[rb]) <> 0 then
canvas.colors[x+rx,y+ry] := color; canvas.colors[x+rx,y+ry] := FPColor;
if rb = 7 then if rb = 7 then
inc (l); inc (l);
end; end;

View File

@ -65,7 +65,7 @@ uses clipping, ellipses;
procedure FillRectangleColor (Canv:TFPCustomCanvas; x1,y1, x2,y2:integer); procedure FillRectangleColor (Canv:TFPCustomCanvas; x1,y1, x2,y2:integer);
begin begin
FillRectangleColor (Canv, x1,y1, x2,y2, canv.brush.color); FillRectangleColor (Canv, x1,y1, x2,y2, Canv.Brush.FPColor);
end; end;
procedure FillRectangleColor (Canv:TFPCustomCanvas; x1,y1, x2,y2:integer; const color:TFPColor); procedure FillRectangleColor (Canv:TFPCustomCanvas; x1,y1, x2,y2:integer; const color:TFPColor);
@ -128,7 +128,7 @@ end;
procedure DrawSolidLine (Canv : TFPCustomCanvas; x1,y1, x2,y2:integer); procedure DrawSolidLine (Canv : TFPCustomCanvas; x1,y1, x2,y2:integer);
begin begin
DrawSolidLine (Canv, x1,y1, x2,y2, Canv.pen.color); DrawSolidLine (Canv, x1,y1, x2,y2, Canv.Pen.FPColor);
end; end;
procedure DrawSolidLine (Canv : TFPCustomCanvas; x1,y1, x2,y2:integer; const color:TFPColor); procedure DrawSolidLine (Canv : TFPCustomCanvas; x1,y1, x2,y2:integer; const color:TFPColor);
@ -248,7 +248,7 @@ end;
procedure DrawPatternLine (Canv:TFPCustomCanvas; x1,y1, x2,y2:integer; Pattern:TPenPattern); procedure DrawPatternLine (Canv:TFPCustomCanvas; x1,y1, x2,y2:integer; Pattern:TPenPattern);
begin begin
DrawPatternLine (Canv, x1,y1, x2,y2, pattern, canv.pen.color); DrawPatternLine (Canv, x1,y1, x2,y2, pattern, Canv.Pen.FPColor);
end; end;
procedure DrawPatternLine (Canv:TFPCustomCanvas; x1,y1, x2,y2:integer; Pattern:TPenPattern; const color:TFPColor); procedure DrawPatternLine (Canv:TFPCustomCanvas; x1,y1, x2,y2:integer; Pattern:TPenPattern; const color:TFPColor);
@ -357,7 +357,7 @@ end;
procedure FillRectangleHashHorizontal (Canv:TFPCustomCanvas; const rect:TRect; width:integer); procedure FillRectangleHashHorizontal (Canv:TFPCustomCanvas; const rect:TRect; width:integer);
begin begin
FillRectangleHashHorizontal (Canv, rect, width, canv.brush.color); FillRectangleHashHorizontal (Canv, rect, width, Canv.Brush.FPColor);
end; end;
procedure FillRectangleHashHorizontal (Canv:TFPCustomCanvas; const rect:TRect; width:integer; const c:TFPColor); procedure FillRectangleHashHorizontal (Canv:TFPCustomCanvas; const rect:TRect; width:integer; const c:TFPColor);
@ -376,7 +376,7 @@ end;
procedure FillRectangleHashVertical (Canv:TFPCustomCanvas; const rect:TRect; width:integer); procedure FillRectangleHashVertical (Canv:TFPCustomCanvas; const rect:TRect; width:integer);
begin begin
FillRectangleHashVertical (Canv, rect, width, canv.brush.color); FillRectangleHashVertical (Canv, rect, width, Canv.Brush.FPColor);
end; end;
procedure FillRectangleHashVertical (Canv:TFPCustomCanvas; const rect:TRect; width:integer; const c:TFPColor); procedure FillRectangleHashVertical (Canv:TFPCustomCanvas; const rect:TRect; width:integer; const c:TFPColor);
@ -395,7 +395,7 @@ end;
procedure FillRectangleHashDiagonal (Canv:TFPCustomCanvas; const rect:TRect; width:integer); procedure FillRectangleHashDiagonal (Canv:TFPCustomCanvas; const rect:TRect; width:integer);
begin begin
FillRectangleHashDiagonal (Canv, rect, width, canv.brush.color); FillRectangleHashDiagonal (Canv, rect, width, Canv.Brush.FPColor);
end; end;
procedure FillRectangleHashDiagonal (Canv:TFPCustomCanvas; const rect:TRect; width:integer; const c:TFPColor); procedure FillRectangleHashDiagonal (Canv:TFPCustomCanvas; const rect:TRect; width:integer; const c:TFPColor);
@ -465,7 +465,7 @@ end;
procedure FillRectangleHashBackDiagonal (Canv:TFPCustomCanvas; const rect:TRect; width:integer); procedure FillRectangleHashBackDiagonal (Canv:TFPCustomCanvas; const rect:TRect; width:integer);
begin begin
FillRectangleHashBackDiagonal (Canv, rect, width, canv.brush.color); FillRectangleHashBackDiagonal (Canv, rect, width, Canv.Brush.FPColor);
end; end;
procedure FillRectangleHashBackDiagonal (Canv:TFPCustomCanvas; const rect:TRect; width:integer; const c:TFPColor); procedure FillRectangleHashBackDiagonal (Canv:TFPCustomCanvas; const rect:TRect; width:integer; const c:TFPColor);
@ -542,7 +542,7 @@ end;
procedure FillRectanglePattern (Canv:TFPCustomCanvas; x1,y1, x2,y2:integer; const pattern:TBrushPattern); procedure FillRectanglePattern (Canv:TFPCustomCanvas; x1,y1, x2,y2:integer; const pattern:TBrushPattern);
begin begin
FillRectanglePattern (Canv, x1,y1, x2,y2, pattern, canv.brush.color); FillRectanglePattern (Canv, x1,y1, x2,y2, pattern, Canv.Brush.FPColor);
end; end;
procedure FillRectanglePattern (Canv:TFPCustomCanvas; x1,y1, x2,y2:integer; const pattern:TBrushPattern; const color:TFPColor); procedure FillRectanglePattern (Canv:TFPCustomCanvas; x1,y1, x2,y2:integer; const pattern:TBrushPattern; const color:TFPColor);
@ -906,7 +906,7 @@ end;
procedure FillFloodColor (Canv:TFPCustomCanvas; x,y:integer); procedure FillFloodColor (Canv:TFPCustomCanvas; x,y:integer);
begin begin
FillFloodColor (Canv, x, y, canv.brush.color); FillFloodColor (Canv, x, y, Canv.Brush.FPColor);
end; end;
type type
@ -953,7 +953,7 @@ end;
procedure FillFloodPattern (Canv:TFPCustomCanvas; x,y:integer; const pattern:TBrushPattern); procedure FillFloodPattern (Canv:TFPCustomCanvas; x,y:integer; const pattern:TBrushPattern);
begin begin
FillFloodPattern (Canv, x, y, pattern, Canv.Brush.color); FillFloodPattern (Canv, x, y, pattern, Canv.Brush.FPColor);
end; end;
type type
@ -1045,7 +1045,7 @@ end;
procedure FillFloodHashHorizontal (Canv:TFPCustomCanvas; x,y:integer; width:integer); procedure FillFloodHashHorizontal (Canv:TFPCustomCanvas; x,y:integer; width:integer);
begin begin
FillFloodHashHorizontal (Canv, x, y, width, Canv.Brush.color); FillFloodHashHorizontal (Canv, x, y, width, Canv.Brush.FPColor);
end; end;
procedure FillFloodHashVertical (Canv:TFPCustomCanvas; x,y:integer; width:integer; const c:TFPColor); procedure FillFloodHashVertical (Canv:TFPCustomCanvas; x,y:integer; width:integer; const c:TFPColor);
@ -1055,7 +1055,7 @@ end;
procedure FillFloodHashVertical (Canv:TFPCustomCanvas; x,y:integer; width:integer); procedure FillFloodHashVertical (Canv:TFPCustomCanvas; x,y:integer; width:integer);
begin begin
FillFloodHashVertical (Canv, x, y, width, Canv.Brush.color); FillFloodHashVertical (Canv, x, y, width, Canv.Brush.FPColor);
end; end;
procedure FillFloodHashDiagonal (Canv:TFPCustomCanvas; x,y:integer; width:integer; const c:TFPColor); procedure FillFloodHashDiagonal (Canv:TFPCustomCanvas; x,y:integer; width:integer; const c:TFPColor);
@ -1065,7 +1065,7 @@ end;
procedure FillFloodHashDiagonal (Canv:TFPCustomCanvas; x,y:integer; width:integer); procedure FillFloodHashDiagonal (Canv:TFPCustomCanvas; x,y:integer; width:integer);
begin begin
FillFloodHashDiagonal (Canv, x, y, width, Canv.Brush.color); FillFloodHashDiagonal (Canv, x, y, width, Canv.Brush.FPColor);
end; end;
procedure FillFloodHashBackDiagonal (Canv:TFPCustomCanvas; x,y:integer; width:integer; const c:TFPColor); procedure FillFloodHashBackDiagonal (Canv:TFPCustomCanvas; x,y:integer; width:integer; const c:TFPColor);
@ -1075,7 +1075,7 @@ end;
procedure FillFloodHashBackDiagonal (Canv:TFPCustomCanvas; x,y:integer; width:integer); procedure FillFloodHashBackDiagonal (Canv:TFPCustomCanvas; x,y:integer; width:integer);
begin begin
FillFloodHashBackDiagonal (Canv, x, y, width, Canv.Brush.color); FillFloodHashBackDiagonal (Canv, x, y, width, Canv.Brush.FPColor);
end; end;
procedure FillFloodHashDiagCross (Canv:TFPCustomCanvas; x,y:integer; width:integer; const c:TFPColor); procedure FillFloodHashDiagCross (Canv:TFPCustomCanvas; x,y:integer; width:integer; const c:TFPColor);
@ -1085,7 +1085,7 @@ end;
procedure FillFloodHashDiagCross (Canv:TFPCustomCanvas; x,y:integer; width:integer); procedure FillFloodHashDiagCross (Canv:TFPCustomCanvas; x,y:integer; width:integer);
begin begin
FillFloodHashDiagCross (Canv, x, y, width, Canv.Brush.color); FillFloodHashDiagCross (Canv, x, y, width, Canv.Brush.FPColor);
end; end;
procedure FillFloodHashCross (Canv:TFPCustomCanvas; x,y:integer; width:integer; const c:TFPColor); procedure FillFloodHashCross (Canv:TFPCustomCanvas; x,y:integer; width:integer; const c:TFPColor);
@ -1095,7 +1095,7 @@ end;
procedure FillFloodHashCross (Canv:TFPCustomCanvas; x,y:integer; width:integer); procedure FillFloodHashCross (Canv:TFPCustomCanvas; x,y:integer; width:integer);
begin begin
FillFloodHashCross (Canv, x, y, width, Canv.Brush.color); FillFloodHashCross (Canv, x, y, width, Canv.Brush.FPColor);
end; end;
type type

View File

@ -274,12 +274,12 @@ begin
end; end;
FPen := TPSPen.Create; FPen := TPSPen.Create;
FPen.Width := 1; FPen.Width := 1;
FPen.Color := 0; FPen.FPColor := 0;
FPen.OnChange := @PenChanged; FPen.OnChange := @PenChanged;
FBrush := TPSPen.Create; FBrush := TPSPen.Create;
FBrush.Width := 1; FBrush.Width := 1;
FBrush.Color := -1; FBrush.FPColor := -1;
// don't notify us that the brush changed... // don't notify us that the brush changed...
} }
end; end;
@ -815,13 +815,13 @@ begin
Result:='/Pattern setcolorspace '+FPattern.Name+' setcolor ' Result:='/Pattern setcolorspace '+FPattern.Name+' setcolor '
else else
begin begin
Result:='[/Pattern /DeviceRGB] setcolorspace '+inttostr(Color.Red)+' '+inttostr(Color.Green)+' '+ Result:='[/Pattern /DeviceRGB] setcolorspace '+inttostr(FPColor.Red)+' '+inttostr(FPColor.Green)+' '+
inttostr(Color.Blue)+' '+FPattern.Name+' setcolor '; inttostr(FPColor.Blue)+' '+FPattern.Name+' setcolor ';
end; end;
end end
else // no pattern do this: else // no pattern do this:
Result:=inttostr(Color.Red)+' '+inttostr(Color.Green)+' '+ Result:=inttostr(FPColor.Red)+' '+inttostr(FPColor.Green)+' '+
inttostr(Color.Blue)+' setrgbcolor '; inttostr(FPColor.Blue)+' setrgbcolor ';
Result := Result + format('%f',[Width])+' setlinewidth '; Result := Result + format('%f',[Width])+' setlinewidth ';
end; end;