LazMapViewer: Add methods to store/restore the state of the drawing engine (pen, brush, font, opacity).
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@9712 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
parent
7e03ffb4f8
commit
310132d9f5
@ -47,6 +47,11 @@ type
|
||||
{ TMvCustomDrawingEngine }
|
||||
|
||||
TMvCustomDrawingEngine = class(TComponent)
|
||||
private
|
||||
FSavedBrush: TMvBrush;
|
||||
FSavedFont: TMvFont;
|
||||
FSavedOpacity: Single;
|
||||
FSavedPen: TMvPen;
|
||||
protected
|
||||
function GetBrushColor: TColor; virtual; abstract;
|
||||
function GetBrushStyle: TBrushStyle; virtual; abstract;
|
||||
@ -107,6 +112,9 @@ type
|
||||
procedure TextOut(X, Y: Integer; const AText: String); virtual; abstract;
|
||||
function TextWidth(const AText: String): Integer;
|
||||
|
||||
procedure StoreState;
|
||||
procedure RestoreState;
|
||||
|
||||
property BrushColor: TColor read GetBrushColor write SetBrushColor;
|
||||
property BrushStyle: TBrushStyle read GetBrushStyle write SetBrushStyle;
|
||||
property FontColor: TColor read GetFontColor write SetFontColor;
|
||||
@ -762,6 +770,22 @@ begin
|
||||
PaintToCanvas(ACanvas, Point(0, 0));
|
||||
end;
|
||||
|
||||
procedure TMvCustomDrawingEngine.RestoreState;
|
||||
begin
|
||||
SetPen(FSavedPen);
|
||||
SetBrush(FSavedBrush);
|
||||
SetFont(FSavedFont);
|
||||
SetOpacity(FSavedOpacity);
|
||||
end;
|
||||
|
||||
procedure TMvCustomDrawingEngine.StoreState;
|
||||
begin
|
||||
FSavedPen := GetPen;
|
||||
FSavedBrush := GetBrush;
|
||||
FSavedFont := GetFont;
|
||||
FSavedOpacity := GetOpacity;
|
||||
end;
|
||||
|
||||
procedure TMvCustomDrawingEngine.SetBrush(ABrush: TMvBrush);
|
||||
begin
|
||||
SetBrush(ABrush.Style, ABrush.Color);
|
||||
|
Loading…
Reference in New Issue
Block a user