を持たせ、アルバムファイル(*.alb)を読んだり、イメージをドラッグアンドドロップで追加する度にアルバム(CALBUM)が写真(CPHOTO)をC++の「CPHOTO* m_Photo[n] = new (CPHOTO)(コンストラクター);」で動的に追加し、追加された写真インスタンスに"new"で動的にフルパスファイル名を、それを使ってイメージインスタンスを、更に有ればコメントを同様に生成させる、というものでした。しかしこの方法は前に書いた通り数MBクラスのイメージを常時メモリーに駐在させることになり、リソースの負担が大きいことから、(速度は犠牲にしても)改善案ではイメージをCPHOTOクラスから排除し、
You can construct Image::Image objects based on files of a variety of types including BMP, Graphics Interchange Format (GIF), JPEG, PNG, TIFF, and EMF."(JPGやGIF等いろんなファイルでImageインスタンスを構築できます、と言っています)
Graphics
The Graphics class provides methods for drawing lines, curves, figures, images, and text. A Graphics object stores attributes of the display device and attributes of the items to be drawn.(線、曲線、図形、像や文章を描画するメソッドを規定するクラスで、その実体(インスタンス)は描画デバイスと描画対象の属性を保有します。)
Image
The Image class provides methods for loading and saving raster images (bitmaps) and vector images (metafiles).(ラスターイメージ(ビットマップ)とベクターイメージ(メタファイル)の読み込み、書き込みメソッドを規定するクラスです。)(注)
// Initialize GDI+.
GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
//Variables to use
UINT num; // number of image encoders
UINT size; // size, in bytes, of the image encoder array
ImageCodecInfo* pImageCodecInfo; //ImageCodeInfo
//<<< Encoder List>>>
// How many encoders are there?
// How big (in bytes) is the array of all ImageCodecInfo objects?
GetImageEncodersSize(&num, &size);
// Create a buffer large enough to hold the array of ImageCodecInfo
// objects that will be returned by GetImageEncoders.
pImageCodecInfo = (ImageCodecInfo*)(malloc(size));
// GetImageEncoders creates an array of ImageCodecInfo objects
// and copies that array into a previously allocated buffer.
// The third argument, imageCodecInfo, is a pointer to that buffer.
GetImageEncoders(num, size, pImageCodecInfo);
// Display the graphics file format (MimeType)
// for each ImageCodecInfo object.
printf("--------------------\r\nEncoder list of GDI+\r\n--------------------\r\n");
for(UINT j = 0; j < num; ++j) {
wprintf(L"%s\n", pImageCodecInfo[j].MimeType);
}
free(pImageCodecInfo);
//<<< Decoder List>>>
// How many decoders are there?
// How big (in bytes) is the array of all ImageCodecInfo objects?
GetImageDecodersSize(&num, &size);
// Create a buffer large enough to hold the array of ImageCodecInfo
// objects that will be returned by GetImageDecoders.
pImageCodecInfo = (ImageCodecInfo*)(malloc(size));
// GetImageDecoders creates an array of ImageCodecInfo objects
// and copies that array into a previously allocated buffer.
// The third argument, imageCodecInfo, is a pointer to that buffer.
GetImageDecoders(num, size, pImageCodecInfo);
// Display the graphics file format (MimeType)
// for each ImageCodecInfo object.
printf("--------------------\r\nDecoder list of GDI+\r\n--------------------\r\n");
for(UINT j = 0; j < num; ++j) {
wprintf(L"%s\n", pImageCodecInfo[j].MimeType);
}
free(pImageCodecInfo);