Deprecated: Array and string offset access syntax with curly braces is deprecated in /homepages/21/d38531796/htdocs/jose/smfforum/Sources/Subs.php on line 3825
GDI+: GdipDrawImage

Author Topic: GDI+: GdipDrawImage  (Read 4958 times)

0 Members and 1 Guest are viewing this topic.

Offline José Roca

  • Administrator
  • Hero Member
  • *****
  • Posts: 2487
  • User-Rate: +204/-0
GDI+: GdipDrawImage
« on: June 23, 2008, 02:04:18 AM »

The following example draws an image with its upper-left corner at (10, 10).

C++

Code: [Select]
VOID Example_DrawImage14(HDC hdc)

{
   Graphics graphics(hdc);

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

   // Draw the image.
   graphics.DrawImage(&image, 10.0f, 10.0f);
}

PowerBASIC

Code: [Select]
SUB GDIP_DrawImage (BYVAL hdc AS DWORD)

   LOCAL hStatus AS LONG
   LOCAL pGraphics AS DWORD
   LOCAL pImage AS DWORD
   LOCAL strFileName AS STRING

   hStatus = GdipCreateFromHDC(hdc, pGraphics)

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

   ' // Draw the image
   hStatus = GdipDrawImage(pGraphics, pImage, 10, 10)

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

END SUB


« Last Edit: August 08, 2011, 12:25:16 AM by José Roca »