// Method igpgraphics. drawline (); {draw line} igpgraphics. drawlines (); {draw a line} igpgraphics. drawarc (); {draw an arc} igpgraphics. drawbesuppliers (); {draw besuppliers} igpgraphics. drawbeziers (); {draw a group of besuppliers} igpgraphics. drawrectangle (); {draw rectangle} igpgraphics. drawrectangles (); {draw a group of rectangles} igpgraphics. drawellipse (); {draw an ellipse} igpgraphics. drawpie (); {pie} igpgraphics. drawpolygon (); {draw polygon} igpgraphics. drawcurve (); {draw curve} igpgraphics. drawclosedcurve (); {draw closed curve} igpgraphics. drawpath (); {drawing path} igpgraphics. fillrectangle (); {filled rectangle} igpgraphics. fillrectangles (); {fill a group of rectangles} igpgraphics. fillpolygon (); {fill polygon} igpgraphics. fillellipse (); {fill elliptic} igpgraphics. fillpie (); {fill pie} igpgraphics. fillpath (); {fill path} igpgraphics. fillclosedcurve (); {fill closed curve} igpgraphics. fillregion (); {fill area} igpgraphics. drawimage (); {rendered image} igpgraphics. drawcachedbitmap (); {present the cachedbitmap image} igpgraphics. addmetafilecomment (); {Add comments to the current Metafile} igpgraphics. enumeratemetafile (); {enumeration of graphical commands in Metafile} igpgraphics. drawstring (); {draw text} igpgraphics. measurestring (); {obtain the rectangle required by the string in the specified format} igpgraphics. drawdriverstring (); {draw the text with the specified spacing} igpgraphics. measuredriverstring (); {obtain the rectangle range required for the specified spacing text} igpgraphics. measurecharacterranges (); {obtain the region where the specified character is located} igpgraphics. setclip (); {set the drawing area of graphics} igpgraphics. intersectclip (); {set a new cut area through the intersection operation} igpgraphics. excludeclip (); {minus cut area} igpgraphics. resetclip; {reset cut area} igpgraphics. translateclip (); {translation cut area} igpgraphics. isvisible (); {determine whether the specified vertex or rectangle is included in the visible cut area of graphics} igpgraphics. clear (); {clear the drawing surface and fill with the specified background color} igpgraphics. save; {Save the current status of graphics} igpgraphics. restore (); {restore the status saved by Save} igpgraphics. flush (); {force all pending graphic operations and return immediately without waiting for the Operation to complete} igpgraphics. getnearestcolor (); {obtain the system color closest to the specified color parameter} igpgraphics. gethdc; {obtain the HDC associated with graphics} igpgraphics. releasehdc (); {release the HDC} igpgraphics associated with graphics. getrenderingorigin (); {retrieve origin} igpgraphics. setrenderingorigin (); {set origin} igpgraphics. multiplytransform (); {multiply the world transformation of graphics by the specified matrix} igpgraphics. translatetransform (); {translation transformation} igpgraphics. scaletransform (); {scale-down Conversion} igpgraphics. rotatetransform (); {Rotation Transformation} igpgraphics. resettransform; {reset transform} igpgraphics. begincontainer (); {Save the previous state and start a new State} igpgraphics. endcontainer (); {restore the status saved by begincontainer} igpgraphics. transformpoints (); {convert point array to coordinate space} // attribute igpgraphics. dpix; {obtain graphics horizontal resolution} igpgraphics. dpiy; {obtain graphics vertical resolution} igpgraphics. renderingorigin; {origin} igpgraphics. pagescale; {Get or set the ratio between the global unit and the page unit of graphics} igpgraphics. pageunit; {Get or set the measurement unit of page coordinates in graphics} igpgraphics. transform; {Get or set matrix transformation} igpgraphics. compositingmode; {combination of foreground and background colors} igpgraphics. interpolationmode; {interpolation mode} igpgraphics. pixeloffsetmode; {pixel offset mode} igpgraphics. compositingquality; {image synthesis quality} igpgraphics. smoothingmode; {drawing quality} igpgraphics. textrenderinghint; {Get or set text rendering mode} igpgraphics. textcontrast; {Get or set the gray correction value of the text (GAMMA value correction for eliminating serticate and cleartype text: 0 .. 12, default 4)} igpgraphics. clip; {obtain or set the drawing area of graphics} igpgraphics. clipbounds; {obtain the rectangular boundary of the cut area; Float Type} igpgraphics. clipboundsi; {obtain the rectangular border of the cut area; integer} igpgraphics. visibleclipbounds; {rectangular boundary of the visible cut area; Float Type} igpgraphics. visibleclipboundsi; {rectangular border of the visible cut area; integer} igpgraphics. isclipempty; {whether the cut area is empty} igpgraphics. isvisibleclipempty; {whether the visible cut area is Blank}
Example of a cut area:
uses GdiPlus;var Graphics: IGPGraphics; Image: IGPImage;procedure TForm1.FormCreate(Sender: TObject);var Rect1, Rect2: TGPRect; Path1, Path2: IGPGraphicsPath;begin Image := TGPImage.Create('C:\GdiPlusImg\ImageFileSmall.jpg'); Graphics := TGPGraphics.Create(Handle); Rect1.Initialize(20, 20, 120, 120); Rect2.Initialize(120, 20, 120, 120); Path1 := TGPGraphicsPath.Create; Path2 := TGPGraphicsPath.Create; Path1.AddEllipse(Rect1); Path2.AddEllipse(Rect2); Graphics.SetClip(Path1); Graphics.SetClip(Path2, CombineModeUnion);end;procedure TForm1.FormPaint(Sender: TObject);begin if not Graphics.IsVisibleClipEmpty then begin Graphics.SetClip(Graphics.VisibleClipBoundsI, CombineModeIntersect); Graphics.DrawImage(Image, 10, 10); end;end;
Pageunit and pagescale test:
Uses gdiplus; Procedure tform1.formpaint (Sender: tobject); var graphics: igpgraphics; pen: igppen; rect: tgprect; begin graphics: = tgpgraphics. create (handle); rect. initialize (20, 20,200,150); pen: = tgppen. create ($ ffc0c0c0, 3); graphics. drawrectangle (pen, rect); graphics. pageunit: = unitdocument; {pagescale is valid only under page coordinates} graphics. pagescale: = 1.0; // default pen. color: = $ ff0000ff; graphics. drawrectangle (pen, rect); pen. color: = $ ffff0000; graphics. pagescale: = 2.0; graphics. drawrectangle (pen, rect); end;
Begincontainer and endcontainer start transformation, while the latter is reset to the status before transformation:
Uses gdiplus; Procedure tform1.formpaint (Sender: tobject); var graphics: igpgraphics; pen: igppen; rect: tgprect; begin graphics: = tgpgraphics. create (handle); rect. initialize (60, 60,100,100); pen: = tgppen. create ($ ffc0c0c0, 2); graphics. drawrectangle (pen, rect); pen. color: = $ ff0000ff; Tag: = graphics. begincontainer; graphics. rotatetransform (18); graphics. drawrectangle (pen, rect); graphics. endcontainer (TAG); pen. color: = $ ffff0000; Tag: = graphics. begincontainer; graphics. rotatetransform (-18); graphics. drawrectangle (pen, rect); graphics. endcontainer (TAG); end; // code repeated by Save and restore: Uses gdiplus; Procedure tform1.formpaint (Sender: tobject); var graphics: igpgraphics; pen: igppen; rect: tgprect; begin graphics: = tgpgraphics. create (handle); rect. initialize (60, 60,100,100); pen: = tgppen. create ($ ffc0c0c0, 2); graphics. drawrectangle (pen, rect); pen. color: = $ ff0000ff; Tag: = graphics. save; graphics. rotatetransform (18); graphics. drawrectangle (pen, rect); graphics. restore (TAG); pen. color: = $ ffff0000; graphics. restore (TAG); graphics. rotatetransform (-18); graphics. drawrectangle (pen, rect); graphics. restore (TAG); end;
The origin (renderingorigin conversion is two different) and the shadow paint brush test:
Uses gdiplus; Procedure tform1.formpaint (Sender: tobject); var graphics: igpgraphics; brush: igphatchbrush; rect: tgprect; begin graphics: = tgpgraphics. create (handle); brush: = tgphatchbrush. create (hatchstylesoliddiamond, $ ff8b0000, $ ffffd700); rect. initialize (10, 10,108, 60); graphics. setrenderingorigin (0, 0); // This is the default value of graphics. fillrectangle (brush, rect); graphics. translatetransform (0, rect. Y + rect. height); graphics. setrenderingorigin (rect. x, rect. Y + trunc (graphics. transform. offsety); graphics. fillrectangle (brush, rect); end;