Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Image.GetFlags method

Applies to: desktop apps only

The Image::GetFlags method gets a set of flags that indicate certain attributes of this Image object.

Syntax

UINT GetFlags();

Parameters

This method has no parameters.

Return value

Type:

Type: UINT

This method returns a value that holds a set of single-bit flags. The flags are defined in the ImageFlags enumeration.

Examples

The following console application creates an Image object based on a PNG file. The code calls the Image::GetFlags method of that Image object to obtain its collection of flags. The code prints the hexadecimal value of the flag collection and then determines whether certain individual flags are set.


#include <windows.h>
#include <gdiplus.h>
#include <stdio.h>
using namespace Gdiplus;

INT main()
{
   GdiplusStartupInput gdiplusStartupInput;
   ULONG_PTR gdiplusToken;
   GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);

   Image* image = new Image(L"Mosaic.png");

   UINT flags = image->GetFlags();
   printf("The value of flags, in hexadecimal form, is %x.\n", flags);

   // Is the ColorSpaceRGB flag set?
   if(flags & ImageFlagsColorSpaceRGB)
      printf("The ColorSpaceRGB flag is set.\n");
   else
     printf("The ColorSpaceRGB flag is not set.\n");

   // Is the HasAlpha flag set?
   if(flags & ImageFlagsHasAlpha)
      printf("The HasAlpha flag is set.\n");
   else
      printf("The HasAlpha flag is not set.\n");

   delete(image);
   GdiplusShutdown(gdiplusToken);
   return 0;
}

The preceding code, along with a particular file, Mosaic.png, produced the following output:


The value of flags, in hexadecimal form, is 13010.
The ColorSpaceRGB flag is set.
The HasAlpha flag is not set.

Requirements

Minimum supported client

Windows XP, Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Product

GDI+ 1.0

Header

Gdiplusheaders.h (include Gdiplus.h)

Library

Gdiplus.lib

DLL

Gdiplus.dll

See also

Image
ImageFlags
Using Images, Bitmaps, and Metafiles
Images, Bitmaps, and Metafiles

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012

Community Additions

Show: