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[121025]
2D Rotated Rectangles Collision Detection[90659]
Keyboard Hook[79324]
UDP[67183]
HTTP Proxy[42651]

::Top 5 Samples::
2D ColDet Rotated Rectangles[11652]
PS2 Mouse Driver[7046]
Wave Format Player[5875]
Reading FAT12[5688]
CodeGuru[5450]


All rights reserved to RageStorm © 2009