mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-22 16:19:36 +02:00
MG: added TCanvas.Ellipse, TCanvas.Pie
git-svn-id: trunk@557 -
This commit is contained in:
parent
e15e87f526
commit
5a1f41e5ad
@ -442,9 +442,12 @@ type
|
||||
Procedure CopyRect(const Dest : TRect; Canvas : TCanvas; const Source : TRect);
|
||||
destructor Destroy; override;
|
||||
Procedure Draw(X,Y: Integer; Graphic : TGraphic);
|
||||
procedure Ellipse(x1, y1, x2, y2: Integer);
|
||||
procedure Ellipse(const Rect: TRect);
|
||||
procedure Pie(x,y,width,height,angle1,angle2 : Integer);
|
||||
Procedure FillRect(const Rect : TRect);
|
||||
Procedure Rectangle(X1,Y1,X2,Y2 : Integer); overload;
|
||||
Procedure Rectangle(const Rect: TRect); overload;
|
||||
Procedure Rectangle(X1,Y1,X2,Y2 : Integer);
|
||||
Procedure Rectangle(const Rect: TRect);
|
||||
Procedure Line(X1,Y1,X2,Y2 : Integer);
|
||||
Procedure MoveTo(X1,Y1 : Integer);
|
||||
Procedure LineTo(X1,Y1 : Integer);
|
||||
@ -732,6 +735,9 @@ end.
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.19 2001/12/28 11:41:50 lazarus
|
||||
MG: added TCanvas.Ellipse, TCanvas.Pie
|
||||
|
||||
Revision 1.18 2001/12/21 18:16:59 lazarus
|
||||
Added TImage class
|
||||
Shane
|
||||
|
@ -217,13 +217,64 @@ end;
|
||||
Params: x,y,width,height,angle1,angle2
|
||||
Returns: Nothing
|
||||
|
||||
Use Arc to draw an elliptically curved line with the current Pen.
|
||||
The angles angle1 and angle2 are 1/16th of a degree. For example, a full
|
||||
circle equals 5760 (16*360). Positive values of Angle and AngleLength mean
|
||||
counter-clockwise while negative values mean clockwise direction.
|
||||
Zero degrees is at the 3'o clock position.
|
||||
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TCanvas.Arc(x,y,width,height,angle1,angle2 : Integer);
|
||||
begin
|
||||
RequiredState([csHandleValid, csBrushValid, csPenValid]);
|
||||
RequiredState([csHandleValid, csPenValid]);
|
||||
LCLLinux.Arc(FHandle,x,y,width,height,angle1,angle2);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TCanvas.Pie
|
||||
Params: x,y,width,height,angle1,angle2
|
||||
Returns: Nothing
|
||||
|
||||
Use Pie to draw a filled pie-shaped wedge on the canvas.
|
||||
The angles angle1 and angle2 are 1/16th of a degree. For example, a full
|
||||
circle equals 5760 (16*360). Positive values of Angle and AngleLength mean
|
||||
counter-clockwise while negative values mean clockwise direction.
|
||||
Zero degrees is at the 3'o clock position.
|
||||
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TCanvas.Pie(x,y,width,height,angle1,angle2 : Integer);
|
||||
begin
|
||||
RequiredState([csHandleValid, csBrushValid, csPenValid]);
|
||||
LCLLinux.Pie(FHandle,x,y,width,height,angle1,angle2);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TCanvas.Ellipse
|
||||
Params: X1, Y1, X2, Y2
|
||||
Returns: Nothing
|
||||
|
||||
Use Ellipse to draw a filled circle or ellipse on the canvas.
|
||||
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TCanvas.Ellipse(x1, y1, x2, y2: Integer);
|
||||
begin
|
||||
RequiredState([csHandleValid, csBrushValid, csPenValid]);
|
||||
LCLLinux.Ellipse(FHandle,x1,y1,x2,y2);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TCanvas.Ellipse
|
||||
Params: X1, Y1, X2, Y2
|
||||
Returns: Nothing
|
||||
|
||||
Use Ellipse to draw a filled circle or ellipse on the canvas.
|
||||
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TCanvas.Ellipse(const Rect: TRect);
|
||||
begin
|
||||
Ellipse(Rect.Left,Rect.Top,Rect.Right,Rect.Bottom);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TCanvas.FillRect
|
||||
Params: Rect
|
||||
@ -623,6 +674,9 @@ end;
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.13 2001/12/28 11:41:51 lazarus
|
||||
MG: added TCanvas.Ellipse, TCanvas.Pie
|
||||
|
||||
Revision 1.12 2001/12/27 16:31:28 lazarus
|
||||
MG: implemented TCanvas.Arc
|
||||
|
||||
|
@ -161,7 +161,12 @@ end;
|
||||
|
||||
function TInterfaceBase.EnableWindow(hWnd: HWND; bEnable: Boolean): Boolean;
|
||||
begin
|
||||
Result := False;
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
function TInterfaceBase.Ellipse(DC: HDC; x1, y1, x2, y2: Integer): Boolean;
|
||||
begin
|
||||
Result:=false;
|
||||
end;
|
||||
|
||||
function TInterfaceBase.ExtTextOut(DC: HDC; X, Y: Integer; Options: Longint; Rect: PRect; Str: PChar; Count: Longint; Dx: PInteger): Boolean;
|
||||
@ -317,16 +322,22 @@ begin
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
function TInterfaceBase.PostMessage(hWnd: HWND; Msg: Cardinal; wParam: LongInt; lParam: LongInt): Boolean;
|
||||
begin
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
function TInterfaceBase.PeekMessage(var lpMsg : TMsg; Handle : HWND; wMsgFilterMin, wMsgFilterMax,wRemoveMsg : UINT): Boolean;
|
||||
Begin
|
||||
Result := False;
|
||||
End;
|
||||
|
||||
function TInterfaceBase.Pie(DC: HDC;
|
||||
x,y,width,height,angle1,angle2 : Integer): Boolean;
|
||||
begin
|
||||
Result := false;
|
||||
end;
|
||||
|
||||
function TInterfaceBase.PostMessage(hWnd: HWND; Msg: Cardinal; wParam: LongInt; lParam: LongInt): Boolean;
|
||||
begin
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
function TInterfaceBase.RealizePalette(DC: HDC): Cardinal;
|
||||
begin
|
||||
Result := 0;
|
||||
@ -503,6 +514,9 @@ end;
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.23 2001/12/28 11:41:51 lazarus
|
||||
MG: added TCanvas.Ellipse, TCanvas.Pie
|
||||
|
||||
Revision 1.22 2001/12/27 16:31:28 lazarus
|
||||
MG: implemented TCanvas.Arc
|
||||
|
||||
|
@ -21,7 +21,6 @@ begin
|
||||
Result := InterfaceObject.Arc(DC,x,y,width,height,angle1,angle2);
|
||||
end;
|
||||
|
||||
|
||||
function BitBlt(DestDC: HDC; X, Y, Width, Height: Integer; SrcDC: HDC; XSrc, YSrc: Integer; Rop: DWORD): Boolean;
|
||||
begin
|
||||
Result := InterfaceObject.BitBlt(DestDC, X, Y, Width, Height, SrcDC, XSrc, YSrc, Rop);
|
||||
@ -166,6 +165,11 @@ begin
|
||||
Result := InterfaceObject.EnableWindow(hWnd, bEnable);
|
||||
end;
|
||||
|
||||
function Ellipse(DC: HDC; x1,y1,x2,y2: Integer): Boolean;
|
||||
begin
|
||||
Result := InterfaceObject.Ellipse(DC,x1,y1,x2,y2);
|
||||
end;
|
||||
|
||||
function ExtTextOut(DC: HDC; X, Y: Integer; Options: Longint; Rect: PRect; Str: PChar; Count: Longint; Dx: PInteger): Boolean;
|
||||
begin
|
||||
Result := InterfaceObject.ExtTextOut(DC, X, Y, Options, Rect, Str, Count, Dx);
|
||||
@ -321,6 +325,11 @@ begin
|
||||
Result := InterfaceObject.PeekMessage(lpMsg,Handle,wMsgFilterMin,wMsgFilterMax,wRemoveMsg);
|
||||
end;
|
||||
|
||||
function Pie(DC: HDC; x,y,width,height,angle1,angle2 : Integer): Boolean;
|
||||
begin
|
||||
Result := InterfaceObject.Pie(DC,x,y,width,height,angle1,angle2);
|
||||
end;
|
||||
|
||||
function PostMessage(hWnd: HWND; Msg: Cardinal; wParam: LongInt; lParam: LongInt): Boolean;
|
||||
begin
|
||||
Result := InterfaceObject.PostMessage(hWnd, Msg, wParam, lParam);
|
||||
@ -1033,6 +1042,9 @@ end;
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.22 2001/12/28 11:41:51 lazarus
|
||||
MG: added TCanvas.Ellipse, TCanvas.Pie
|
||||
|
||||
Revision 1.21 2001/12/27 16:31:28 lazarus
|
||||
MG: implemented TCanvas.Arc
|
||||
|
||||
|
@ -61,6 +61,7 @@ function DrawEdge(DC: HDC; var Rect: TRect; edge: Cardinal; grfFlags: Cardinal):
|
||||
function EnableMenuItem(hMenu: HMENU; uIDEnableItem: Integer; bEnable: Boolean): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||
function EnableScrollBar(Wnd: HWND; wSBflags, wArrows: Cardinal): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||
function EnableWindow(hWnd: HWND; bEnable: Boolean): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||
function Ellipse(DC: HDC; x1, y1, x2, y2: Integer): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||
//function EqualRect --> independent
|
||||
function ExtTextOut(DC: HDC; X, Y: Integer; Options: Longint; Rect: PRect; Str: PChar; Count: Longint; Dx: PInteger): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||
|
||||
@ -109,6 +110,7 @@ function MoveToEx(DC: HDC; X, Y: Integer; OldPoint: PPoint): Boolean; {$IFDEF IF
|
||||
//function OffsetRect --> independent
|
||||
|
||||
function PeekMessage(var lpMsg : TMsg; Handle : HWND; wMsgFilterMin, wMsgFilterMax,wRemoveMsg : UINT): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||
function Pie(DC: HDC; x,y,width,height,angle1,angle2 : Integer): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||
function PostMessage(hWnd: HWND; Msg: Cardinal; wParam: LongInt; lParam: LongInt): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||
//function PtInRect --> independent
|
||||
|
||||
@ -243,6 +245,9 @@ function UnionRect(var lprcDst: TRect; const lprcSrc1, lprcSrc2: TRect): Boolean
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.18 2001/12/28 11:41:51 lazarus
|
||||
MG: added TCanvas.Ellipse, TCanvas.Pie
|
||||
|
||||
Revision 1.17 2001/12/27 16:31:28 lazarus
|
||||
MG: implemented TCanvas.Arc
|
||||
|
||||
|
@ -32,12 +32,16 @@ const
|
||||
//##apiwiz##sps## // Do not remove
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Function: Arc
|
||||
Params: none
|
||||
Returns: Nothing
|
||||
Method: Arc
|
||||
Params: x,y,width,height,angle1,angle2
|
||||
Returns: Nothing
|
||||
|
||||
Use Arc to draw an elliptically curved line with the current Pen.
|
||||
The angles angle1 and angle2 are 1/16th of a degree. For example, a full
|
||||
circle equals 5760 (16*360). Positive values of Angle and AngleLength mean
|
||||
counter-clockwise while negative values mean clockwise direction.
|
||||
Zero degrees is at the 3'o clock position.
|
||||
|
||||
The Arc function draws an arc. The arc is outlined by using
|
||||
the current pen.
|
||||
------------------------------------------------------------------------------}
|
||||
function TgtkObject.Arc(DC: HDC;
|
||||
x,y,width,height,angle1,angle2 : Integer): Boolean;
|
||||
@ -48,7 +52,7 @@ begin
|
||||
begin
|
||||
if GC = nil
|
||||
then begin
|
||||
WriteLn('WARNING: [TgtkObject.Rectangle] Uninitialized GC');
|
||||
WriteLn('WARNING: [TgtkObject.Arc] Uninitialized GC');
|
||||
Result := False;
|
||||
end
|
||||
else begin
|
||||
@ -62,7 +66,6 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Function: BitBlt
|
||||
Params: DestDC: The destination devicecontext
|
||||
@ -1623,6 +1626,47 @@ begin
|
||||
Result:=false;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: Ellipse
|
||||
Params: X1, Y1, X2, Y2
|
||||
Returns: Nothing
|
||||
|
||||
Use Ellipse to draw a filled circle or ellipse.
|
||||
|
||||
------------------------------------------------------------------------------}
|
||||
function TgtkObject.Ellipse(DC: HDC;
|
||||
x1,y1,x2,y2: Integer): Boolean;
|
||||
var x,y,width,height: integer;
|
||||
begin
|
||||
Result := IsValidDC(DC);
|
||||
if Result
|
||||
then with PDeviceContext(DC)^ do
|
||||
begin
|
||||
if GC = nil
|
||||
then begin
|
||||
WriteLn('WARNING: [TgtkObject.Ellipse] Uninitialized GC');
|
||||
Result := False;
|
||||
end
|
||||
else begin
|
||||
x:=(x1+x2) shr 1;
|
||||
y:=(y1+y2) shr 1;
|
||||
width:=(x2-x1);
|
||||
if width<0 then width:=-width;
|
||||
width:=width shr 1;
|
||||
height:=(y2-y1);
|
||||
if height<0 then height:=-height;
|
||||
height:=height shr 1;
|
||||
// first draw interior in brush color
|
||||
SelectGDKBrushProps(DC);
|
||||
gdk_draw_arc(Drawable, GC, 1, x, y, Width, Height, 0, 360 shl 6);
|
||||
// Draw outline
|
||||
SelectGDKPenProps(DC);
|
||||
gdk_draw_arc(Drawable, GC, 0, x, y, Width, Height, 0, 360 shl 6);
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Function: ExtTextOut
|
||||
Params: none
|
||||
@ -2981,6 +3025,44 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: Pie
|
||||
Params: x,y,width,height,angle1,angle2
|
||||
Returns: Nothing
|
||||
|
||||
Use Pie to draw a filled pie-shaped wedge on the canvas.
|
||||
The angles angle1 and angle2 are 1/16th of a degree. For example, a full
|
||||
circle equals 5760 (16*360). Positive values of Angle and AngleLength mean
|
||||
counter-clockwise while negative values mean clockwise direction.
|
||||
Zero degrees is at the 3'o clock position.
|
||||
|
||||
------------------------------------------------------------------------------}
|
||||
function TgtkObject.Pie(DC: HDC;
|
||||
x,y,width,height,angle1,angle2 : Integer): Boolean;
|
||||
begin
|
||||
Result := IsValidDC(DC);
|
||||
if Result
|
||||
then with PDeviceContext(DC)^ do
|
||||
begin
|
||||
if GC = nil
|
||||
then begin
|
||||
WriteLn('WARNING: [TgtkObject.Pie] Uninitialized GC');
|
||||
Result := False;
|
||||
end
|
||||
else begin
|
||||
// first draw interior in brush color
|
||||
SelectGDKBrushProps(DC);
|
||||
gdk_draw_arc(Drawable, GC, 1, X, Y, Width, Height,
|
||||
Angle1 shl 2, Angle2 shl 2);
|
||||
// Draw outline
|
||||
SelectGDKPenProps(DC);
|
||||
gdk_draw_arc(Drawable, GC, 0, X, Y, Width, Height,
|
||||
Angle1 shl 2, Angle2 shl 2);
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Function: PostMessage
|
||||
Params: hWnd:
|
||||
@ -4128,6 +4210,9 @@ end;
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.54 2001/12/28 11:41:51 lazarus
|
||||
MG: added TCanvas.Ellipse, TCanvas.Pie
|
||||
|
||||
Revision 1.53 2001/12/27 16:31:28 lazarus
|
||||
MG: implemented TCanvas.Arc
|
||||
|
||||
|
@ -45,6 +45,7 @@ function DrawEdge(DC: HDC; var Rect: TRect; edge: Cardinal; grfFlags: Cardinal):
|
||||
function EnableMenuItem(hMenu: HMENU; uIDEnableItem: Integer; bEnable: Boolean): Boolean; override;
|
||||
function EnableScrollBar(Wnd: HWND; wSBflags, wArrows: Cardinal): Boolean; override;
|
||||
function EnableWindow(hWnd: HWND; bEnable: Boolean): Boolean; override;
|
||||
function Ellipse(DC: HDC; x1,y1,x2,y2: Integer): Boolean; override;
|
||||
function ExtTextOut(DC: HDC; X, Y: Integer; Options: Longint; Rect: PRect; Str: PChar; Count: Longint; Dx: PInteger): Boolean; override;
|
||||
|
||||
function FillRect(DC: HDC; const Rect: TRect; Brush: HBRUSH): Boolean; override;
|
||||
@ -83,6 +84,7 @@ function MessageBox(hWnd: HWND; lpText, lpCaption: PChar; uType: Cardinal): inte
|
||||
function MoveToEx(DC: HDC; X, Y: Integer; OldPoint: PPoint): Boolean; override;
|
||||
|
||||
function PeekMessage(var lpMsg : TMsg; Handle : HWND; wMsgFilterMin, wMsgFilterMax,wRemoveMsg : UINT): Boolean;
|
||||
function Pie(DC: HDC; x,y,width,height,angle1,angle2 : Integer): Boolean; override;
|
||||
function PostMessage(hWnd: HWND; Msg: Cardinal; wParam: LongInt; lParam: LongInt): Boolean; override;
|
||||
|
||||
function RealizePalette(DC: HDC): Cardinal; override;
|
||||
@ -128,6 +130,9 @@ Function WindowFromPoint(Point : TPoint) : HWND; override;
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.22 2001/12/28 11:41:51 lazarus
|
||||
MG: added TCanvas.Ellipse, TCanvas.Pie
|
||||
|
||||
Revision 1.21 2001/12/27 16:31:28 lazarus
|
||||
MG: implemented TCanvas.Arc
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user