#ifdef _ADV_2DAPI
/* Define grid stripple bitmap */
const unsigned char stipple_bits [] = "\x81\x42\x24\x18\x18\x24\x42\x81";
static STIPPLE my_stipple =
{
8, 8, 1, 8,
stipple_bits
};
/* Example code of advanced 2D GDI functions */
void GDIDemo_Adv2DAPI (HWND hWnd, HDC hdc)
{
POINT pt [10];
BITMAP bitmap;
/* Load a bitmap as brush tile bitmap */
if (LoadBitmap (hdc, &bitmap, "res/sample.bmp"))
return;
/* Set pen type, dash style and width */
SetPenType (hdc, PT_SOLID);
SetPenDashes (hdc, 0, "\1\1", 2);
SetPenWidth (hdc, 5);
/* Set the end point style of pen is “round end point” */
SetPenCapStyle (hdc, PT_CAP_ROUND);
/* Plot a line point */
LineEx (hdc, 10, 10, 50, 50);
/* Set pen jointing style as “bevel joining” */
SetPenJoinStyle (hdc, PT_JOIN_BEVEL);
/* Plot poly line segment */
pt [0].x = 20; pt [0].y = 20;
pt [1].x = 80; pt [1].y = 20;
pt [2].x = 80; pt [2].y = 80;
pt [3].x = 20; pt [3].y = 80;
pt [4].x = 20; pt [4].y = 20;
PolyLineEx (hdc, pt, 5);
/* Set pen width to be 20, pen color to be red, pen end point style to
/*be “round end point”
*/
SetPenWidth (hdc, 20);
SetPenColor (hdc, PIXEL_red);
SetPenCapStyle (hdc, PT_CAP_ROUND);
/* Plot a line segment */
LineEx (hdc, 80, 80, 400, 300);
/* Set pen color to be blue */
SetPenColor (hdc, PIXEL_blue);
/* Plot an arc across thid quadrant and forth quadrant */
ArcEx (hdc, 100, 100, 200, 300, 180*64, 180*64);
/* Set brush type as solid */
SetBrushType (hdc, BT_SOLID);
/* Set brush color as green */
SetBrushColor (hdc, PIXEL_green);
/* Fill arc from 0 degree to 120 degree */
FillArcEx (hdc, 100, 0, 200, 100, 0, 120*64);
/* Set brush type as tile */
SetBrushType (hdc, BT_TILED);
Marcadores