git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1529 8e941d3f-bd1b-0410-a28a-d453659cc2b4

This commit is contained in:
yangjixian
2011-03-12 17:53:25 +00:00
parent 892d2235c3
commit ef16a00e01

View File

@ -41,32 +41,34 @@ interface
uses uses
Classes, SysUtils, FPImage, IntfGraphics, Graphics, Math, LCLProc, Classes, SysUtils, FPImage, IntfGraphics, Graphics, Math, LCLProc,
BmpRGBUtils; BmpRGBUtils, rgbdrawutils;
const const
MAXRANDOMDENSITY = $FFFF; MAXRANDOMDENSITY = $FFFF;
type type
TRandomDensity = Word; TRandomDensity = word;
TDrawMode = (dmFillAndOutline, dmOutline, dmFill); TDrawMode = (dmFillAndOutline, dmOutline, dmFill);
TEraseMode = (ermNone, ermErase, ermReplace); TEraseMode = (ermNone, ermErase, ermReplace);
TDrawPixelProcedure = procedure (X, Y: Integer) of Object; TDrawPixelProcedure = procedure(X, Y: integer) of object;
TPixelDifference = word;
TPixelDifference = Word;
const const
MAXDIFFERENCE = 255 + 255 + 255; MAXDIFFERENCE = 255 + 255 + 255;
type type
// integral float with 1/256 precision // integral float with 1/256 precision
TIntensityFloat = Integer; TIntensityFloat = integer;
TIntensityFloatTable = Array [0..255] of TIntensityFloat; TIntensityFloatTable = array [0..255] of TIntensityFloat;
{ TRGBBitmapCore } { TRGBBitmapCore }
TRGBBitmapCore = class(TBitmap) TRGBBitmapCore = class(TCustomRGBBitmapCore)
private private
FSizeOfPixel: Integer; FSizeOfPixel: integer;
FRowPixelStride: Integer; FRowPixelStride: integer;
FDataOwner: Boolean; FDataOwner: boolean;
FDrawMode: TDrawMode; FDrawMode: TDrawMode;
FEraseMode: TEraseMode; FEraseMode: TEraseMode;
FFillColor: TColor; FFillColor: TColor;
@ -74,97 +76,91 @@ type
FOutlineColor: TColor; FOutlineColor: TColor;
FPaperColor: TColor; FPaperColor: TColor;
FRandomDensity: TRandomDensity; FRandomDensity: TRandomDensity;
FRandomEnabled: Boolean; FRandomEnabled: boolean;
FRectangleRoundness: Integer; FRectangleRoundness: integer;
function GetFillColor: TColor; function GetSize: integer;
function GetOutlineColor: TColor;
function GetPaperColor: TColor;
procedure SetFillColor(const AValue: TColor);
procedure SetOutlineColor(const AValue: TColor);
procedure SetPaperColor(const AValue: TColor);
function GetSize: Integer;
protected protected
function PixelMasked(X, Y: Integer): Boolean; function PixelMasked(X, Y: integer): boolean;
procedure DrawOutlinePixel(X, Y: Integer); procedure DrawOutlinePixel(X, Y: integer);
procedure DrawFillPixel(X, Y: Integer); procedure DrawFillPixel(X, Y: integer);
procedure DrawPaperPixel(X, Y: Integer); procedure DrawPaperPixel(X, Y: integer);
procedure DrawReplacePixel(X, Y: Integer); procedure DrawReplacePixel(X, Y: integer);
procedure DrawRandomOutlinePixel(X, Y: Integer); procedure DrawRandomOutlinePixel(X, Y: integer);
procedure DrawRandomFillPixel(X, Y: Integer); procedure DrawRandomFillPixel(X, Y: integer);
procedure DrawRandomPaperPixel(X, Y: Integer); procedure DrawRandomPaperPixel(X, Y: integer);
procedure DrawEmptyPixel(X, Y: Integer); procedure DrawEmptyPixel(X, Y: integer);
function GetOutlineProcedure: TDrawPixelProcedure; virtual; function GetOutlineProcedure: TDrawPixelProcedure; virtual;
function GetFillProcedure: TDrawPixelProcedure; virtual; function GetFillProcedure: TDrawPixelProcedure; virtual;
public public
constructor Create(AWidth, AHeight: Integer; ASizeOfPixel: Integer); virtual; constructor Create(AWidth, AHeight: integer; ASizeOfPixel: integer); virtual;
constructor CreateAsCopy(ABitmap: TRGBBitmapCore; ASizeOfPixel: Integer); virtual; constructor CreateAsCopy(ABitmap: TRGBBitmapCore; ASizeOfPixel: integer); virtual;
constructor CreateFromData(AData: Pointer; AWidth, AHeight: Integer; ASizeOfPixel: Integer; ADataOwner: Boolean = False); virtual; constructor CreateFromData(AData: Pointer; AWidth, AHeight: integer;
ASizeOfPixel: integer; ADataOwner: boolean = False); virtual;
destructor Destroy; override; destructor Destroy; override;
procedure Assign(Source: TPersistent); override; procedure Assign(Source: TPersistent); override;
procedure SwapWith(ABitmap: TRGBBitmapCore); virtual; procedure SwapWith(ABitmap: TRGBBitmapCore); virtual;
public public
procedure Clear; virtual; procedure Clear; override;
procedure ClearWhite; virtual; procedure ClearWhite; override;
procedure Invert; virtual; procedure Invert; override;
procedure FlipHorz; virtual; procedure FlipHorz; override;
procedure FlipVert; virtual; procedure FlipVert; override;
procedure Rotate90; virtual; procedure Rotate90; override;
procedure Rotate180; virtual; procedure Rotate180; override;
procedure Rotate270; virtual; procedure Rotate270; override;
public public
procedure SetColor(X, Y: Integer; Value: TColor); procedure SetColor(X, Y: integer; Value: TColor);
function GetColor(X, Y: Integer): TColor; function GetColor(X, Y: integer): TColor;
procedure Fill(Color: TColor); procedure Fill(Color: TColor);
procedure FillEllipse(X1, Y1, X2, Y2: Integer); procedure FillEllipse(X1, Y1, X2, Y2: integer); override;
procedure MaskFloodFill(X, Y: Integer); procedure MaskFloodFill(X, Y: integer);
// Alpha drawing methods // Alpha drawing methods
procedure AlphaRectangle(X1, Y1, X2, Y2, AAlpha: Integer); procedure AlphaRectangle(X1, Y1, X2, Y2, AAlpha: integer);
// Effect drawing methods // Effect drawing methods
procedure FuzzyRectangle(X1, Y1, X2, Y2: Integer); procedure FuzzyRectangle(X1, Y1, X2, Y2: integer);
public public
procedure DrawTo(ACanvas: TCanvas; X, Y: Integer); procedure DrawTo(ACanvas: TCanvas; X, Y: integer);
procedure StretchDrawTo(ACanvas: TCanvas; DstX, DstY, DstWidth, DstHeight: Integer); procedure StretchDrawTo(ACanvas: TCanvas; DstX, DstY, DstWidth, DstHeight: integer);
property EraseMode: TEraseMode read FEraseMode write FEraseMode; property EraseMode: TEraseMode read FEraseMode write FEraseMode;
property DrawMode: TDrawMode read FDrawMode write FDrawMode; property DrawMode: TDrawMode read FDrawMode write FDrawMode;
property FloodFillTolerance: TPixelDifference read FFloodFillTolerance property FloodFillTolerance: TPixelDifference
write FFloodFillTolerance; read FFloodFillTolerance write FFloodFillTolerance;
property Width; property Width;
property Height; property Height;
property FillColor: TColor read GetFillColor write SetFillColor; property RandomEnabled: boolean read FRandomEnabled write FRandomEnabled;
property OutlineColor: TColor read GetOutlineColor write SetOutlineColor;
property PaperColor: TColor read GetPaperColor write SetPaperColor;
property RandomEnabled: Boolean read FRandomEnabled write FRandomEnabled;
property RandomDensity: TRandomDensity read FRandomDensity write FRandomDensity; property RandomDensity: TRandomDensity read FRandomDensity write FRandomDensity;
property RectangleRoundness: Integer read FRectangleRoundness write FRectangleRoundness; property RectangleRoundness: integer read FRectangleRoundness
property DataOwner: Boolean read FDataOwner; write FRectangleRoundness;
property Size: Integer read GetSize; property DataOwner: boolean read FDataOwner;
property SizeOfPixel: Integer read FSizeOfPixel; property Size: integer read GetSize;
property SizeOfPixel: integer read FSizeOfPixel;
end; end;
{ TRGB8BitmapCore } { TRGB8BitmapCore }
TRGB8BitmapCore = class(TRGBBitmapCore) TRGB8BitmapCore = class(TRGBBitmapCore)
public public
constructor Create(AWidth, AHeight: Integer); virtual; constructor Create(AWidth, AHeight: integer); virtual;
constructor CreateAsCopy(ABitmap: TRGBBitmapCore); virtual; constructor CreateAsCopy(ABitmap: TRGBBitmapCore); virtual;
constructor CreateFromData(AData: Pointer; AWidth, AHeight: Integer; ADataOwner: Boolean = False); virtual; constructor CreateFromData(AData: Pointer; AWidth, AHeight: integer;
ADataOwner: boolean = False); virtual;
procedure LoadFromLazIntfImageAlpha(AImage: TLazIntfImage); virtual; procedure LoadFromLazIntfImageAlpha(AImage: TLazIntfImage); virtual;
procedure SaveToLazIntfImageAlpha(AImage: TLazIntfImage); virtual; procedure SaveToLazIntfImageAlpha(AImage: TLazIntfImage); virtual;
procedure SaveToLazIntfImageAlpha(AImage: TLazIntfImage; const ARect: TRect); virtual; procedure SaveToLazIntfImageAlpha(AImage: TLazIntfImage;
const ARect: TRect); virtual;
procedure Assign(Source: TPersistent); override; procedure Assign(Source: TPersistent); override;
procedure SwapWith(ABitmap: TRGBBitmapCore); override; procedure SwapWith(ABitmap: TRGBBitmapCore); override;
@ -176,10 +172,11 @@ type
TRGB32BitmapCore = class(TRGBBitmapCore) TRGB32BitmapCore = class(TRGBBitmapCore)
private private
public public
constructor Create(AWidth, AHeight: Integer); virtual; constructor Create(AWidth, AHeight: integer); virtual;
constructor CreateAsCopy(ABitmap: TRGBBitmapCore); virtual; constructor CreateAsCopy(ABitmap: TRGBBitmapCore); virtual;
constructor CreateFromLazIntfImage(AImage: TLazIntfImage); virtual; constructor CreateFromLazIntfImage(AImage: TLazIntfImage); virtual;
constructor CreateFromData(AData: Pointer; AWidth, AHeight: Integer; ADataOwner: Boolean = False); virtual; constructor CreateFromData(AData: Pointer; AWidth, AHeight: integer;
ADataOwner: boolean = False); virtual;
destructor Destroy; override; destructor Destroy; override;
procedure Assign(Source: TPersistent); override; procedure Assign(Source: TPersistent); override;
procedure SwapWith(ABitmap: TRGBBitmapCore); override; procedure SwapWith(ABitmap: TRGBBitmapCore); override;
@ -193,7 +190,7 @@ type
procedure FlipVertRGBBitmap(Bitmap: TRGBBitmapCore); procedure FlipVertRGBBitmap(Bitmap: TRGBBitmapCore);
// intensity tables // intensity tables
function GetIntensityFloatTable(A, B: Single): TIntensityFloatTable; function GetIntensityFloatTable(A, B: single): TIntensityFloatTable;
// rotate clockwise // rotate clockwise
procedure Rotate90CWRGBBitmap(Bitmap: TRGBBitmapCore); procedure Rotate90CWRGBBitmap(Bitmap: TRGBBitmapCore);
@ -208,13 +205,15 @@ implementation
uses BmpRGBGraph; uses BmpRGBGraph;
function AbsByte(Src: Integer): Byte; inline; function AbsByte(Src: integer): byte; inline;
begin begin
if Src >= 0 then Result := Src if Src >= 0 then
else Result := -Src; Result := Src
else
Result := -Src;
end; end;
function RoundIntensityFloatInline(V: TIntensityFloat): Byte; inline; function RoundIntensityFloatInline(V: TIntensityFloat): byte; inline;
begin begin
Result := Max(0, Min(255, (V + 128) shr 8)); Result := Max(0, Min(255, (V + 128) shr 8));
end; end;
@ -223,10 +222,10 @@ end;
Creates look-up table T[I = 0..255] = A + I * B. Creates look-up table T[I = 0..255] = A + I * B.
*) *)
function GetIntensityFloatTable(A, B: Single): TIntensityFloatTable; function GetIntensityFloatTable(A, B: single): TIntensityFloatTable;
var var
I: Integer; I: integer;
C: Single; C: single;
begin begin
C := A; C := A;
for I := 0 to High(Result) do for I := 0 to High(Result) do
@ -278,12 +277,12 @@ end;
{ TRGBBitmapCore } { TRGBBitmapCore }
function TRGBBitmapCore.GetSize: Integer; function TRGBBitmapCore.GetSize: integer;
begin begin
end; end;
constructor TRGBBitmapCore.Create(AWidth, AHeight: Integer; ASizeOfPixel: Integer); constructor TRGBBitmapCore.Create(AWidth, AHeight: integer; ASizeOfPixel: integer);
begin begin
inherited Create; inherited Create;
@ -301,7 +300,7 @@ begin
FRectangleRoundness := 0; FRectangleRoundness := 0;
end; end;
constructor TRGBBitmapCore.CreateAsCopy(ABitmap: TRGBBitmapCore; ASizeOfPixel: Integer); constructor TRGBBitmapCore.CreateAsCopy(ABitmap: TRGBBitmapCore; ASizeOfPixel: integer);
begin begin
inherited Create; inherited Create;
@ -312,8 +311,8 @@ begin
FDataOwner := True; FDataOwner := True;
end; end;
constructor TRGBBitmapCore.CreateFromData(AData: Pointer; AWidth, AHeight: Integer; constructor TRGBBitmapCore.CreateFromData(AData: Pointer; AWidth, AHeight: integer;
ASizeOfPixel: Integer; ADataOwner: Boolean); ASizeOfPixel: integer; ADataOwner: boolean);
begin begin
inherited Create; inherited Create;
@ -333,8 +332,10 @@ end;
procedure TRGBBitmapCore.Assign(Source: TPersistent); procedure TRGBBitmapCore.Assign(Source: TPersistent);
begin begin
if Source = nil then Exit; if Source = nil then
if Source = Self then Exit; Exit;
if Source = Self then
Exit;
if Source is TRGBBitmapCore then if Source is TRGBBitmapCore then
begin begin
Width := (Source as TRGBBitmapCore).Width; Width := (Source as TRGBBitmapCore).Width;
@ -347,7 +348,8 @@ end;
procedure TRGBBitmapCore.SwapWith(ABitmap: TRGBBitmapCore); procedure TRGBBitmapCore.SwapWith(ABitmap: TRGBBitmapCore);
begin begin
if ABitmap = nil then Exit; if ABitmap = nil then
Exit;
SwapInt(Width, ABitmap.Width); SwapInt(Width, ABitmap.Width);
SwapInt(Height, ABitmap.Height); SwapInt(Height, ABitmap.Height);
SwapInt(FRowPixelStride, ABitmap.FRowPixelStride); SwapInt(FRowPixelStride, ABitmap.FRowPixelStride);
@ -356,131 +358,103 @@ end;
procedure TRGBBitmapCore.Clear; procedure TRGBBitmapCore.Clear;
begin begin
inherited;
end; end;
procedure TRGBBitmapCore.ClearWhite; procedure TRGBBitmapCore.ClearWhite;
begin begin
inherited;
end; end;
procedure TRGBBitmapCore.Invert; procedure TRGBBitmapCore.Invert;
begin begin
inherited;
end; end;
procedure TRGBBitmapCore.FlipHorz; procedure TRGBBitmapCore.FlipHorz;
begin begin
inherited;
end; end;
procedure TRGBBitmapCore.FlipVert; procedure TRGBBitmapCore.FlipVert;
begin begin
inherited;
end; end;
procedure TRGBBitmapCore.Rotate90; procedure TRGBBitmapCore.Rotate90;
begin begin
inherited;
end; end;
procedure TRGBBitmapCore.Rotate180; procedure TRGBBitmapCore.Rotate180;
begin begin
inherited;
end; end;
procedure TRGBBitmapCore.Rotate270; procedure TRGBBitmapCore.Rotate270;
begin begin
inherited;
end; end;
procedure TRGBBitmapCore.SetColor(X, Y: Integer; Value: TColor); procedure TRGBBitmapCore.SetColor(X, Y: integer; Value: TColor);
begin begin
Canvas.Pixels[X, Y] := Value; Canvas.Pixels[X, Y] := Value;
end; end;
function TRGBBitmapCore.GetColor(X, Y: Integer): TColor; function TRGBBitmapCore.GetColor(X, Y: integer): TColor;
begin begin
if (X > 0) and (X < Width) and (Y > 0) and (Y < Height) then Result := Canvas.Pixels[X, Y] if (X > 0) and (X < Width) and (Y > 0) and (Y < Height) then
else Result := clNone; Result := Canvas.Pixels[X, Y]
else
Result := clNone;
end; end;
function TRGBBitmapCore.GetFillColor: TColor; function TRGBBitmapCore.PixelMasked(X, Y: integer): boolean;
begin
Result := FFillColor;
end;
function TRGBBitmapCore.GetOutlineColor: TColor;
begin
Result := FOutlineColor;
end;
function TRGBBitmapCore.GetPaperColor: TColor;
begin
Result := FPaperColor;
end;
procedure TRGBBitmapCore.SetFillColor(const AValue: TColor);
begin
FFillColor := AValue;
end;
procedure TRGBBitmapCore.SetOutlineColor(const AValue: TColor);
begin
FOutlineColor := AValue;
end;
procedure TRGBBitmapCore.SetPaperColor(const AValue: TColor);
begin
FPaperColor := AValue;
end;
function TRGBBitmapCore.PixelMasked(X, Y: Integer): Boolean;
begin begin
end; end;
procedure TRGBBitmapCore.DrawOutlinePixel(X, Y: Integer); procedure TRGBBitmapCore.DrawOutlinePixel(X, Y: integer);
begin begin
end; end;
procedure TRGBBitmapCore.DrawFillPixel(X, Y: Integer); procedure TRGBBitmapCore.DrawFillPixel(X, Y: integer);
begin begin
end; end;
procedure TRGBBitmapCore.DrawPaperPixel(X, Y: Integer); procedure TRGBBitmapCore.DrawPaperPixel(X, Y: integer);
begin begin
end; end;
procedure TRGBBitmapCore.DrawReplacePixel(X, Y: Integer); procedure TRGBBitmapCore.DrawReplacePixel(X, Y: integer);
begin begin
end; end;
procedure TRGBBitmapCore.DrawRandomOutlinePixel(X, Y: Integer); procedure TRGBBitmapCore.DrawRandomOutlinePixel(X, Y: integer);
begin begin
if PixelMasked(X, Y) and (Random(MAXRANDOMDENSITY) < FRandomDensity) then if PixelMasked(X, Y) and (Random(MAXRANDOMDENSITY) < FRandomDensity) then;
end; end;
procedure TRGBBitmapCore.DrawRandomFillPixel(X, Y: Integer); procedure TRGBBitmapCore.DrawRandomFillPixel(X, Y: integer);
begin begin
if PixelMasked(X, Y) and (Random(MAXRANDOMDENSITY) < FRandomDensity) then if PixelMasked(X, Y) and (Random(MAXRANDOMDENSITY) < FRandomDensity) then;
end; end;
procedure TRGBBitmapCore.DrawRandomPaperPixel(X, Y: Integer); procedure TRGBBitmapCore.DrawRandomPaperPixel(X, Y: integer);
begin begin
if PixelMasked(X, Y) and (Random(MAXRANDOMDENSITY) < FRandomDensity) then if PixelMasked(X, Y) and (Random(MAXRANDOMDENSITY) < FRandomDensity) then;
end; end;
procedure TRGBBitmapCore.DrawEmptyPixel(X, Y: Integer); procedure TRGBBitmapCore.DrawEmptyPixel(X, Y: integer);
begin begin
//
end; end;
function TRGBBitmapCore.GetOutlineProcedure: TDrawPixelProcedure; function TRGBBitmapCore.GetOutlineProcedure: TDrawPixelProcedure;
@ -539,19 +513,18 @@ end;
procedure TRGBBitmapCore.Fill(Color: TColor); procedure TRGBBitmapCore.Fill(Color: TColor);
var var
I, J: Integer; I, J: integer;
begin begin
Canvas.Brush.Color := Color; Canvas.Brush.Color := Color;
Canvas.FillRect(Rect(0, 0, Width, Height)); Canvas.FillRect(Rect(0, 0, Width, Height));
end; end;
procedure TRGBBitmapCore.FillEllipse(X1, Y1, X2, Y2: Integer); procedure TRGBBitmapCore.FillEllipse(X1, Y1, X2, Y2: integer);
begin begin
Canvas.Brush.Color := clRed; inherited;
Canvas.FillRect(Rect(0, 0, Width, Height));
end; end;
procedure TRGBBitmapCore.MaskFloodFill(X, Y: Integer); procedure TRGBBitmapCore.MaskFloodFill(X, Y: integer);
begin begin
Canvas.Brush.Color := clBlack; Canvas.Brush.Color := clBlack;
Canvas.FillRect(Rect(0, 0, Width, Height)); Canvas.FillRect(Rect(0, 0, Width, Height));
@ -559,11 +532,11 @@ end;
// AAlpha is the alpha of the rectangle, ranging from // AAlpha is the alpha of the rectangle, ranging from
// 0 - fully transparent to 100 - fully opaque // 0 - fully transparent to 100 - fully opaque
procedure TRGBBitmapCore.AlphaRectangle(X1, Y1, X2, Y2, AAlpha: Integer); procedure TRGBBitmapCore.AlphaRectangle(X1, Y1, X2, Y2, AAlpha: integer);
var var
OldColor, NewColor: Integer; OldColor, NewColor: integer;
X, Y: LongInt; X, Y: longint;
OldR, OldG, OldB, NewR, NewG, NewB: Byte; OldR, OldG, OldB, NewR, NewG, NewB: byte;
begin begin
// If the rectangle is fully opaque this is the same as a normal rectangle // If the rectangle is fully opaque this is the same as a normal rectangle
if AAlpha = 100 then if AAlpha = 100 then
@ -573,7 +546,8 @@ begin
end; end;
// if it is fully transparent there is nothing to draw // if it is fully transparent there is nothing to draw
if AAlpha = 0 then Exit; if AAlpha = 0 then
Exit;
// A partially transparent rectangle // A partially transparent rectangle
for Y := Y1 to Y2 do for Y := Y1 to Y2 do
@ -590,10 +564,10 @@ begin
end; end;
end; end;
procedure TRGBBitmapCore.FuzzyRectangle(X1, Y1, X2, Y2: Integer); procedure TRGBBitmapCore.FuzzyRectangle(X1, Y1, X2, Y2: integer);
var var
X, Y: LongInt; X, Y: longint;
deltaX, deltaY: Integer; deltaX, deltaY: integer;
begin begin
for Y := Y1 to Y2 do for Y := Y1 to Y2 do
for X := X1 to X2 do for X := X1 to X2 do
@ -604,22 +578,24 @@ begin
deltaY := deltaX; deltaY := deltaX;
// Makes sure we won't get any invalid pixel positions // Makes sure we won't get any invalid pixel positions
if X < 5 then deltaX := -deltaX; if X < 5 then
if Y < 5 then deltaY := -deltaY; deltaX := -deltaX;
if Y < 5 then
deltaY := -deltaY;
// Change the color // Change the color
SetColor(X, Y, GetColor(X - deltaX, Y - deltaY)); SetColor(X, Y, GetColor(X - deltaX, Y - deltaY));
end; end;
end; end;
procedure TRGBBitmapCore.DrawTo(ACanvas: TCanvas; X, Y: Integer); procedure TRGBBitmapCore.DrawTo(ACanvas: TCanvas; X, Y: integer);
begin begin
if ACanvas <> nil then if ACanvas <> nil then
ACanvas.Draw(X, Y, Self); ACanvas.Draw(X, Y, Self);
end; end;
procedure TRGBBitmapCore.StretchDrawTo(ACanvas: TCanvas; DstX, DstY, DstWidth, procedure TRGBBitmapCore.StretchDrawTo(ACanvas: TCanvas;
DstHeight: Integer); DstX, DstY, DstWidth, DstHeight: integer);
begin begin
if ACanvas <> nil then if ACanvas <> nil then
ACanvas.StretchDraw(Rect(DstX, DstY, DstWidth, DstHeight), Self); ACanvas.StretchDraw(Rect(DstX, DstY, DstWidth, DstHeight), Self);
@ -627,7 +603,7 @@ end;
{ TRGB32BitmapCore } { TRGB32BitmapCore }
constructor TRGB32BitmapCore.Create(AWidth, AHeight: Integer); constructor TRGB32BitmapCore.Create(AWidth, AHeight: integer);
begin begin
inherited Create(AWidth, AHeight, 1); inherited Create(AWidth, AHeight, 1);
end; end;
@ -640,7 +616,7 @@ end;
constructor TRGB32BitmapCore.CreateFromLazIntfImage(AImage: TLazIntfImage); constructor TRGB32BitmapCore.CreateFromLazIntfImage(AImage: TLazIntfImage);
var var
I, J: Integer; I, J: integer;
begin begin
Create(AImage.Width, AImage.Height); Create(AImage.Width, AImage.Height);
@ -650,8 +626,8 @@ begin
end; end;
end; end;
constructor TRGB32BitmapCore.CreateFromData(AData: Pointer; AWidth, AHeight: Integer; constructor TRGB32BitmapCore.CreateFromData(AData: Pointer;
ADataOwner: Boolean); AWidth, AHeight: integer; ADataOwner: boolean);
begin begin
inherited CreateFromData(AData, AWidth, AHeight, 0, ADataOwner); inherited CreateFromData(AData, AWidth, AHeight, 0, ADataOwner);
end; end;
@ -675,8 +651,8 @@ end;
procedure TRGB32BitmapCore.SaveToLazIntfImage(AImage: TLazIntfImage; const ARect: TRect); procedure TRGB32BitmapCore.SaveToLazIntfImage(AImage: TLazIntfImage; const ARect: TRect);
var var
I, J: Integer; I, J: integer;
W, H: Integer; W, H: integer;
begin begin
W := ARect.Right - ARect.Left; W := ARect.Right - ARect.Left;
H := ARect.Bottom - ARect.Top; H := ARect.Bottom - ARect.Top;
@ -688,7 +664,6 @@ begin
for I := 0 to Pred(W) do for I := 0 to Pred(W) do
begin begin
end; end;
end; end;
except except
@ -703,7 +678,7 @@ end;
{ TRGB8BitmapCore } { TRGB8BitmapCore }
constructor TRGB8BitmapCore.Create(AWidth, AHeight: Integer); constructor TRGB8BitmapCore.Create(AWidth, AHeight: integer);
begin begin
inherited Create(AWidth, AHeight, 1); inherited Create(AWidth, AHeight, 1);
end; end;
@ -714,15 +689,15 @@ begin
inherited CreateAsCopy(ABitmap, 1); inherited CreateAsCopy(ABitmap, 1);
end; end;
constructor TRGB8BitmapCore.CreateFromData(AData: Pointer; AWidth, AHeight: Integer; constructor TRGB8BitmapCore.CreateFromData(AData: Pointer;
ADataOwner: Boolean); AWidth, AHeight: integer; ADataOwner: boolean);
begin begin
inherited CreateFromData(AData, AWidth, AHeight, 0, ADataOwner); inherited CreateFromData(AData, AWidth, AHeight, 0, ADataOwner);
end; end;
procedure TRGB8BitmapCore.LoadFromLazIntfImageAlpha(AImage: TLazIntfImage); procedure TRGB8BitmapCore.LoadFromLazIntfImageAlpha(AImage: TLazIntfImage);
var var
I, J: Integer; I, J: integer;
begin begin
for J := 0 to Pred(Height) do for J := 0 to Pred(Height) do
begin begin
@ -741,7 +716,7 @@ end;
procedure TRGB8BitmapCore.SaveToLazIntfImageAlpha(AImage: TLazIntfImage; procedure TRGB8BitmapCore.SaveToLazIntfImageAlpha(AImage: TLazIntfImage;
const ARect: TRect); const ARect: TRect);
var var
I, J: Integer; I, J: integer;
F: TFPColor; F: TFPColor;
begin begin
for J := 0 to Pred(AImage.Height) do for J := 0 to Pred(AImage.Height) do