1. In stdafx. h
Comment out # define win32_lean_and_meanOr add # include
Visual Studio 2012 does not seem to need to be changed by default.
2. Locate a CPP file and add:
# Include Using namespace gdiplus;# Pragma comment (Lib, "gdiplus. lib ")
3. Add at the top of the winmain Function
Ulong_ptr token;Gdiplusstartupinput GSI;Gdiplusstartup ( token, GSI, 0 );
4. Add at the bottom of winmainGdiplusshutdo
The startcap and endcap attributes are used to read and write the line caps of the two segments respectively. Test figure:
Startcap and endcap TestCode:
Uses gdiplus; Procedure tform1.formpaint (Sender: tobject); const caparr: array [0 .. 8] of byte = (0, 1, 2, 3, $10, $11, $12, $13, $14); var graphics: igpgraphics; pen: igppen; pt1, pt2: tgppoint; I: integer; begin pt1.initialize (20, 20); pt2.initialize (200, 20); graphics: =
The simplest igppathgradientbrush is a gradient with a central color and a set of peripheral colors.
The attributes of centercolor, surroundcolors, and setsurroundcolors are involved here.
Test 1:
Test 1Code:
// Use setsurroundcolors to set the peripheral color group: Uses gdiplus, kernel; Procedure tform1.formpaint (Sender: tobject); var brush: kernel; rect: tgprect; Path: igpgraphicspath; begin rect. initialize (1
Igpgraphicspath. flatten (); // convert the curve in the path to an approximate straight line segment (only the betiller line and straight line in the path ). igpgraphicspath. outline (); // same as flatten (); igpgraphicspath. warp (); // The quadrilateral or parallelogram is distorted. igpgraphicspath. widen (); // converts a contour to a range. igpgraphicspath. transform (); // matrix transformation; in fact, the above methods contain parameters of matrix transformation.
Flatten test diagra
Igpgraphicspathiterator can traverse sub-paths and path tags in a path.
Igpgraphicspathiterator. count; {total number of points} igpgraphicspathiterator. subpathcount; {number of sub-paths} igpgraphicspathiterator. hascurve; {include curve} igpgraphicspathiterator. rewind; {re-start, used before traversing} igpgraphicspathiterator. nextsubpath (); {next sub-path} igpgraphicspathiterator. nextpathtype (); {type of the starting point of the current sub-path; must be used together with nextsubpat
is infinitely large} igpregion. getbounds (); {Get boundary rectangle} igpregion. gethrgn (); {obtain hrgn (Windows region handle)} igpregion. clone; {copy} igpregion. equals (); {judge whether it is the same}
Two important uses of a region:
1. igpregion. isvisible ();
2. igpgraphics. Clip or igpgraphics. setclip ();
Isvisible test:
Unit unit1; interfaceuses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs; Type tform1 = Class (
Tgpcolor is the color subject of gdiplus. Although it is a struct, methods and attributes are readily available like classes.
I don't think it is defined as a class or interface. I think it mainly needs to be implicitly converted with an integer, which requires operator overloading (currently only the structure is available ).
Multiple tgpcolor construction methods:
VaR C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11: tgpcolor; begin C1: = t
Related methods:
Igpgraphics. drawimage (); igpimage. getthumbnailimage (); igpimage. rotateflip ();
Whether to specify the difference between width and height when using drawimage to present an image:
// If the image resolution is inconsistent with that of graphics, it is necessary to specify the width and height. uses gdiplus; Procedure tform1.formpaint (Sender: tobject); var graphics: igpgraphics; Image: igpimage; ix, Iy
You can use igpcustomlinecap and igpadjustablearrowcap to customize the line cap.
The latter inherits from the former and is used to modify the arrow caps.
Igpadjustablearrowcap test:
Igpadjustablearrowcap test code:
uses GdiPlus;procedure TForm1.FormPaint(Sender: TObject);var Graphics: IGPGraphics; Pen: IGPPen; Cap1,Cap2: IGPAdjustableArrowCap;begin Graphics := TGPGraphics.Create(Handle); Pen := TGPPen.Create($FFDC143C, 4); Cap1 := TGPAd
Graphics (canvas in The VCL system) has four methods to obtain graphics:
1. Get through the window handle;2. Get it through canvas. handle in the window;3. Get the togpgraphics method added to some VCL objects through gdiplus using helper technology;4. Obtain the image object.
In this example:
Unit unit1; interfaceuses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs, stdctrls; Type tform1 = C
Method 2: tgplineargradientbrush. Create (rectangle, color 1, color 2, gradient mode );
Third Construction Method: tgplineargradientbrush. Create (rectangle, color 1, color 2, angle );
In the third construction method, the "angle" (X axis, clockwise) is equivalent to the custom gradient mode. The following two testsCodeThe results are the same.
In addition, the third construction method also has a Boolean parameter with the default value of false, indicating whether the specified angle i
correspondingByte contains two pixels, the upper nibble is the leftmost and the lower nibble is the rightmost of two pixels. the four bits of the upper and lower nibble are used to select the color from the 16 color palette.
Format1bppindexedGiven the X and Y coordinates, the byte containing the pixel is calculatedScan0 + (y * STRIDE) + (X/8). The Byte contains8 bits, each bit is one pixel with the leftmost pixel in BIT 8 and the rightmost pixel in bit 0. The bits select from the two entry col
The bitmap provided by gdiplus supports reading and displaying GIF files.
However, for some GIF images, the interval between frames may be 0. Therefore, the default interval is 100 ms in this case. I don't know if I am not correct. If you have any suggestions, please feel free to contact us! (The interval between frames is also 0 in the gimp test. I think there should be a default value. The Ms effect is acceptable and can be borrowed for the moment)
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.