Home
Tutorials
Code Snippets
Code Samples
Downloads
Links

The Blog
Our Projects
About
Contact

::Add RageStorm to Favorites!::

The Blog | Our Projects | Guest Book | About | Contact

 
Code Snippet - Drawing a Picture
Author:Arkon
Category:Win32API
File Size:643 Bytes
Uploaded at:19-Aug-06 10:57:28 am
Description:
  With GDI+ it's very easy to load and draw any image format (BMP, ICON, GIF, JPEG, Exif, PNG, TIFF, WMF, and EMF).
  
#pragma comment(lib, "gdiplus.lib")
#include <windows.h>
#include <gdiplus.h>

using namespace Gdiplus;

GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;

void initGdiPlus()
{
  GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
}

void OnPaint(HDC hDC)
{
  Graphics graphics(hdc);
  Image image(L"untitled.jpg");
  // If you have the raw data of the image for some reason,
  // use the other snippet for making it an IStream
  // And use the Image constructor which recieves an IStream.
  graphics.DrawImage(&image, Point(0, 0));
}

void destroyGdiPlus()
{
  GdiplusShutdown(gdiplusToken);
}
NOTE:
Comments that will hurt anyone in any way will be deleted.
Don't ask for features, advertise or curse.
If you want to leave a message to the author use the contacts,
if you have any question in relation to your comments please use the forum.
Comments which violate any of these requests will be deleted without further
notice. Use the comment system decently.

Post your comment:
Name:
email:
Comment:
::Top 5 Tutorials::
Embedded Python[116365]
2D Rotated Rectangles Collision Detection[88469]
Keyboard Hook[76725]
UDP[65659]
HTTP Proxy[41049]

::Top 5 Samples::
2D ColDet Rotated Rectangles[11531]
PS2 Mouse Driver[6928]
Wave Format Player[5764]
Reading FAT12[5591]
CodeGuru[5327]


All rights reserved to RageStorm © 2009