• Welcome to Jose's Read Only Forum 2023.
 

GDI+: GdipDrawImagePointsI

Started by José Roca, June 23, 2008, 02:25:07 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

José Roca



The following example draws an image using an array of destination points.

C++


VOID Example_DrawImage(HDC hdc)

{

   Graphics graphics(hdc);

   // Create an Image object.
   Image image(L"climber.jpg");

   // Create an array of Point objects that specify the destination of the image.
   Point destPoints[3] = {
   Point(30, 30),
   Point(250, 50),
   Point(175, 120)};

   Point* pdestPoints = destPoints;

   // Draw the image.
   graphics.DrawImage(&image, pdestPoints, 3);
}


PowerBASIC


SUB GDIP_DrawImagePointsI (BYVAL hdc AS DWORD)

   LOCAL hStatus AS LONG
   LOCAL pGraphics AS DWORD
   LOCAL pImage AS DWORD
   LOCAL strFileName AS STRING
   DIM  destPoints(2) AS POINTL

   hStatus = GdipCreateFromHDC(hdc, pGraphics)

   ' // Create the Image object
   strFileName = UCODE$("climber.jpg")
   hStatus = GdipLoadImageFromFile(STRPTR(strFileName), pImage)

   ' // Create an array of PointL structures that specify the destination of the image.
   destPoints(0).x = 30 : destPoints(0).y = 30
   destPoints(1).x = 250 : destPoints(1).y = 50
   destPoints(2).x = 175 : destPoints(2).y = 120

   ' // Draw the image
   hStatus = GdipDrawImagePointsI(pGraphics, pImage, destpoints(0), 3)

   ' // Cleanup
   IF pImage THEN GdipDisposeImage(pImage)
   IF pGraphics THEN GdipDeleteGraphics(pGraphics)

END SUB