The GDI+
Posted
by Leandro Gustavo Biss Becker
on September 20th, 2001
I have found that the Microsft GDI+ can do many cool things for you. Previously you had to find code or write your own code to do the same things. One of these things is the ability to load or save the following types of images:
- BMP
- DIB
- RLE
- GIF
- JPEG
- EMF
- TIFF
- PNG
These can be loaded with just a few lines of code like this:
#include <Gdiplus.h> using namespace Gdiplus; #pragma comment(lib, "gdiplus.lib") Image Im(L"c:\\fig.jpg", FALSE); CLSID GifCodec; GetCodecClsid(L"image/gif", &GifCodec); Im.Save(L"c:\\fig.gif", &GifCodec, NULL);
Here is the code to GetCodecClsid
int GetCodecClsid(const WCHAR* format, CLSID* pClsid)
{
UINT num = 0; // number of image encoders
UINT size = 0; // size of the image encoder array in bytes
ImageCodecInfo* pImageCodecInfo = NULL;
GetImageEncodersSize(&num, &size);
if(size == 0)
return -1; // Failure
pImageCodecInfo = (ImageCodecInfo*)(malloc(size));
if(pImageCodecInfo == NULL)
return -1; // Failure
GetImageEncoders(num, size, pImageCodecInfo);
for(UINT j = 0; j < num; ++j)
{
if( wcscmp(pImageCodecInfo[j].MimeType, format) == 0 )
{
*pClsid = pImageCodecInfo[j].Clsid;
return j; // Success
}
} // for
return -1; // Failure
} // GetCodecClsid
All help about GDI+ can be found at: http://msdn.microsoft.com/library/default.asp
Downloads
Here is the library, headers and the dll to build the samples gdiplus.zip (900K):

Comments
NABGU jPc tnMF
Posted by MFCNYoNRux on 11/13/2012 06:30pmbuy soma online carisoprodol can you snort - carisoprodol drug interactions
ReplyGoal
Posted by snareenactina on 11/13/2012 09:17amBuild Bulk Cargo Handling Unit II-39 zelmenis The Finnish inventor's IndoorAtlas software uses magnetic field data to identify smartphone users' locations schmidt angiograms peakabove powerfulge admissible
ReplyNew one
Posted by snareenactina on 11/06/2012 04:40ampewclimate French literature reflects the nationââ¬â¢s multi-hued culture and political dynamism. Several literary movements like Dadaism, Surrealism, and Existentialism have been started and nurtured in France. Since the late 19th century, the nation has also come to be known as a sort of focal point for modern art, cinema, fashion, and cuisine. Cocteau, Dumont, and Godard are some of its celebrated film-makers, while Pierre Cardin, Chanel, Givenchy, and Louis Vuitton are iconic names in the contemporary world of fashion. Europe has only one advantage over the US and that is its ability to spend close to nothing on a military budget because the United States will defend Europe under any opposing threat. Europeââ¬â¢s very existence depends on US supremacy. If the US decides to become a socialist state like Europe or if China calls in our debts, China will be in position to become the next superpower. Evidence of this is the German prime minister being opposed to ââ¬ÅObama spendingââ¬Å¥. The real question is, does anybody here believe China, with a poor track-record of preserving human rights, will come to defend Europe from the Middle East when the US can no longer financially provide military aid? I think not. Try zooming out for a broader look. forerunner Growth and protectionism 157 suggests Some articles that match your query: scotlands Cranky, the New York Times editorial came out and rallied around Obama??? Wow, more breaking news from the Associated Press: The Pope is Catholic and the Chicago Cubs will go 112 years without winning the world series. I mean seriously Cranky. judiciaries Like the poster above me I'd like to thank you for another one of your generally excellent and insightful comments on the economy. Over the past couple of years they have probably been amongst the most accurate forecasts out there. beetles The Moitor highlights that while unemployment continues to rise, longer term propsecxts give cause fo optimism as a result of a number of major development projects being taken forward. exclusivists Source: mundane For some time now, blogs and op-eds have been circulating a common myth about ââ¬Âgreat recessionââ¬â¢ hiring. Namely, high unemployment is derived from a mismatch of job applicant skills versus job position skill requirements. And the absolutely true answer is: Chronic high unemployment is definitely NOT a supply side issue.
ReplyProblem with linking (GDI+ + CBuilder 5)
Posted by Legacy on 02/22/2004 12:00amOriginally posted by: dbf
Hello! My gdi program compiles quite good, but it after it it is linking error.
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
#define STRICT
#include <Gdiplus.h>
using std::min;
using std::max;
using namespace Gdiplus;
#pragma comment(lib, "gdiplus.lib")
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
Gdiplus::GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
CLSID pngClsid;
//GetEncoderClsid(L"image/png", &pngClsid);
//image.Save(L"Mosaic2.png", &pngClsid, NULL);
GdiplusShutdown( gdiplusToken );
}
//---------------------------------------------------------------------------
ReplyThe error is "Unresolved external call GdiplusStartupInput
Unresolved external call GdiplusShutdown " What should I do?
Problem getting GDI+ to work using DirectDraw & C++Builder
Posted by Legacy on 01/28/2004 12:00amOriginally posted by: Megan_G
ReplyHow to load a HICON or Bitmap object in Image handle?
Posted by Legacy on 11/21/2003 12:00amOriginally posted by: Yan Lee
How to load a HICON or Bitmap object in Image handle?
ReplyHow to load a HICON or Bitmap object in Image handle?
Posted by Legacy on 11/21/2003 12:00amOriginally posted by: Yan Lee
How to load a HICON or Bitmap object in Image handle?
ReplyHow to load a HICON or Bitmap object in Image handle?
Posted by Legacy on 11/21/2003 12:00amOriginally posted by: Wang Yan
How to load a HICON or Bitmap object in Image handle?
ReplyAlpha blending of an EMF Image
Posted by Legacy on 11/20/2003 12:00amOriginally posted by: khaldoun
ReplyGDIplus.lib linker error with c++ builder 6
Posted by Legacy on 11/19/2003 12:00amOriginally posted by: ouioui
I make a small app to rotate a jpeg image with c++ builder but i can't compile it. I get this error :
[Linker Error] 'C:TEST_GDI\GDIPLUS.LIB' contains invalid OMF record, type 0x21 (possibly COFF)
Thanks for help
Ouioui
ReplyLoading, Please Wait ...