mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 13:17:18 +02:00
Adds WindowOrg support for lazcanvas and a upsidedown init for graphtype
git-svn-id: trunk@33733 -
This commit is contained in:
parent
72ea67ba06
commit
a485ecf313
@ -152,6 +152,7 @@ type
|
|||||||
|
|
||||||
// Formats in RGB order
|
// Formats in RGB order
|
||||||
procedure Init_BPP24_R8G8B8_BIO_TTB(AWidth, AHeight: integer);
|
procedure Init_BPP24_R8G8B8_BIO_TTB(AWidth, AHeight: integer);
|
||||||
|
procedure Init_BPP24_R8G8B8_BIO_TTB_UpsideDown(AWidth, AHeight: integer);
|
||||||
|
|
||||||
// Formats in Windows pixels order: BGR
|
// Formats in Windows pixels order: BGR
|
||||||
procedure Init_BPP24_B8G8R8_BIO_TTB(AWidth, AHeight: integer);
|
procedure Init_BPP24_B8G8R8_BIO_TTB(AWidth, AHeight: integer);
|
||||||
@ -597,6 +598,30 @@ begin
|
|||||||
// MaskBitsPerPixel:=0;
|
// MaskBitsPerPixel:=0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TRawImageDescription.Init_BPP24_R8G8B8_BIO_TTB_UpsideDown(AWidth, AHeight: integer);
|
||||||
|
begin
|
||||||
|
// setup an artificial ScanLineImage with format RGB 24 bit, 24bit depth format
|
||||||
|
FillChar(Self, SizeOf(Self), 0);
|
||||||
|
|
||||||
|
Format := ricfRGBA;
|
||||||
|
Depth := 24; // used bits per pixel
|
||||||
|
Width := AWidth;
|
||||||
|
Height := AHeight;
|
||||||
|
BitOrder := riboBitsInOrder;
|
||||||
|
ByteOrder := riboLSBFirst;
|
||||||
|
LineOrder := riloBottomToTop;
|
||||||
|
BitsPerPixel := 24; // bits per pixel. can be greater than Depth.
|
||||||
|
LineEnd := rileDWordBoundary;
|
||||||
|
RedPrec := 8; // red precision. bits for red
|
||||||
|
RedShift := 0;
|
||||||
|
GreenPrec := 8;
|
||||||
|
GreenShift := 8; // bitshift. Direction: from least to most significant
|
||||||
|
BluePrec := 8;
|
||||||
|
BlueShift:=16;
|
||||||
|
// AlphaPrec:=0;
|
||||||
|
// MaskBitsPerPixel:=0;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TRawImageDescription.Init_BPP24_B8G8R8_BIO_TTB(AWidth, AHeight: integer);
|
procedure TRawImageDescription.Init_BPP24_B8G8R8_BIO_TTB(AWidth, AHeight: integer);
|
||||||
{ pf24bit:
|
{ pf24bit:
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ uses
|
|||||||
// RTL
|
// RTL
|
||||||
Classes, SysUtils,
|
Classes, SysUtils,
|
||||||
// FCL-Image
|
// FCL-Image
|
||||||
fpimgcanv, fpcanvas, fpimage,
|
fpimgcanv, fpcanvas, fpimage, clipping,
|
||||||
// regions
|
// regions
|
||||||
lazregions;
|
lazregions;
|
||||||
|
|
||||||
@ -55,10 +55,14 @@ type
|
|||||||
private
|
private
|
||||||
FAssignedBrush: TFPCustomBrush;
|
FAssignedBrush: TFPCustomBrush;
|
||||||
FAssignedPen: TFPCustomPen;
|
FAssignedPen: TFPCustomPen;
|
||||||
|
FBaseWindowOrg: TPoint;
|
||||||
FUseSimpleRectClipping: Boolean;
|
FUseSimpleRectClipping: Boolean;
|
||||||
FLazClipRegion: TLazRegion;
|
FLazClipRegion: TLazRegion;
|
||||||
|
FWindowOrg: TPoint; // already in absolute coords with BaseWindowOrg summed up
|
||||||
function GetAssignedBrush: TFPCustomBrush;
|
function GetAssignedBrush: TFPCustomBrush;
|
||||||
function GetAssignedPen: TFPCustomPen;
|
function GetAssignedPen: TFPCustomPen;
|
||||||
|
function GetWindowOrg: TPoint;
|
||||||
|
procedure SetWindowOrg(AValue: TPoint);
|
||||||
protected
|
protected
|
||||||
procedure SetColor (x,y:integer; const AValue:TFPColor); override;
|
procedure SetColor (x,y:integer; const AValue:TFPColor); override;
|
||||||
public
|
public
|
||||||
@ -72,7 +76,10 @@ type
|
|||||||
property AssignedPen: TFPCustomPen read GetAssignedPen write FAssignedPen;
|
property AssignedPen: TFPCustomPen read GetAssignedPen write FAssignedPen;
|
||||||
property AssignedBrush: TFPCustomBrush read GetAssignedBrush write FAssignedBrush;
|
property AssignedBrush: TFPCustomBrush read GetAssignedBrush write FAssignedBrush;
|
||||||
//
|
//
|
||||||
|
// SetWindowOrg operations will be relative to BaseWindowOrg, useful for customdrawn wincontrols
|
||||||
|
property BaseWindowOrg: TPoint read FBaseWindowOrg write FBaseWindowOrg;
|
||||||
property UseSimpleRectClipping: Boolean read FUseSimpleRectClipping write FUseSimpleRectClipping;
|
property UseSimpleRectClipping: Boolean read FUseSimpleRectClipping write FUseSimpleRectClipping;
|
||||||
|
property WindowOrg: TPoint read GetWindowOrg write SetWindowOrg;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
@ -95,9 +102,24 @@ begin
|
|||||||
Result := FAssignedPen;
|
Result := FAssignedPen;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TLazCanvas.SetColor(x, y: integer; const AValue: TFPColor);
|
function TLazCanvas.GetWindowOrg: TPoint;
|
||||||
begin
|
begin
|
||||||
inherited SetColor(x, y, AValue);
|
Result := Point(FWindowOrg.X-FBaseWindowOrg.X, FWindowOrg.Y-FBaseWindowOrg.Y)
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TLazCanvas.SetWindowOrg(AValue: TPoint);
|
||||||
|
begin
|
||||||
|
FWindowOrg.X := AValue.X+FBaseWindowOrg.X;
|
||||||
|
FWindowOrg.Y := AValue.Y+FBaseWindowOrg.Y;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TLazCanvas.SetColor(x, y: integer; const AValue: TFPColor);
|
||||||
|
var
|
||||||
|
lx, ly: Integer;
|
||||||
|
begin
|
||||||
|
lx := x + FWindowOrg.X;
|
||||||
|
ly := y + FWindowOrg.Y;
|
||||||
|
inherited SetColor(lx, ly, AValue);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TLazCanvas.create(AnImage: TFPCustomImage);
|
constructor TLazCanvas.create(AnImage: TFPCustomImage);
|
||||||
|
Loading…
Reference in New Issue
Block a user