Gdiplus [49]: image (I) Overview

Source: Internet
Author: User
Three main image-related interfaces are: igpimage, igpbitmap, and igpmetafile.

Igpbitmap and igpmetafile are inherited from igpimage, which are used to process bitmap and graph files respectively.

In addition, the igpcachedbitmap inherited from igpbitmap is used to quickly present images.

Igpimage methods and attributes:

// Method igpimage. clone; {clone} igpimage. save (); {save to file or stream} igpimage in the specified format. saveadd (); {Add pages to images with multiple pages allowed} igpimage. getphysicaldimension (); {obtain the image size (width, height)} igpimage. getbounds (); {obtain the boundary rectangle of the image in the specified unit} igpimage. getthumbnailimage (); {retrieve thumbnail} igpimage. getframedimensions; {Get a guid array. Each guid represents one frame.} igpimage. getframecount (); {Get frames} igpimage. selectactiveframe (); {select the frame of the specified index as the current frame} igpimage. rotateflip (); {rotated image} igpimage. getpropertyitem (); {Get attribute item} igpimage. setpropertyitem (); {set attribute item} igpimage. removepropertyitem (); {Delete attribute item} igpimage. getencoderparameterlist (); {obtain the parameter information supported by the image encoder} // attribute igpimage. imagetype; {image type (Bitmap/Metafile/unknown)} igpimage. width; {width (in pixels)} igpimage. height; {height (in pixels)} igpimage. horizontalresolution; {obtain the horizontal resolution (in pixels/inches)} igpimage. verticalresolution; {obtain the vertical resolution (in pixels/inches)} igpimage. flags; {Get the attribute flag of the image pixel} igpimage. rawformat; {file format for obtaining images} igpimage. pixelformat; {pixel format for obtaining the image} igpimage. palette; {retrieve or set the palette} igpimage. propertyidlist; {Get image attribute ID array} igpimage. propertyitems; {retrieving image attribute sets}
 
   
 

Igpbitmap adds methods and attributes based on igpimage:

 
// Method igpbitmap. gethbitmap (); {create a bitmap in GDI format and return a handle} igpbitmap. gethicon; {create an icon file and return a handle} igpbitmap. lockbits (); {lock the pixel data in the memory of the object} igpbitmap. unlockbits (); {unlock lockbits} igpbitmap. setresolution (); {set resolution} // attribute igpbitmap. pixels; {retrieve or set the color of the specified pixel}

  

Igpmetafile:

 
// Method igpmetafile. getmetafileheader; {retrieve Metafile's metafileheader} igpmetafile. gethenhmetafile; {obtain the Windows handle of the Enhanced Metafile} igpmetafile. playrecord (); {playing a single Metafile record} // attribute igpmetafile. downlevelrasterizationlimit ;{}

  

There are also several public inline functions related to images:

Function getpixelformatsize (); {returns the color depth of the specified pixel format (the number of digits of each pixel)} function isindexedpixelformat (); {determines whether the pixel format is indexed} function isalphapixelformat (); {determine whether the pixel format contains Alpha information} function iscanonicalpixelformat (); {whether the pixel format is 32 bits per pixel (standard)} function isextendedpixelformat (); {whether the pixel format is 64 bits per pixel}

  

There are multiple auxiliary interfaces such as igpimageattributes.

The igpcachedbitmap mentioned above does not have its own unique methods and attributes. The following example shows a comparison test between it and igpbitmap:

 // the test result is about three times faster than the bitmap. uses gdiplus; procedure merge (Sender: tobject); const COUNT = 1000; var graphic: igpgraphics; bitmap: igpbitmap; cachedbitmap: igpcachedbitmap; T1, T2, X, Y: Cardinal; i: integer; begin graphic: = tgpgraphics. create (handle); bitmap: = tgpbitmap. create ('C: \ gdiplusimg \ texture.jpg '); cachedbitmap: = tgpcachedbitmap. create (bitmap, graphic); X: = clientwidth-bitmap. width; Y: = clientheight-bitmap. height; T1: = gettickcount; for I: = 0 to count-1 do graphic. drawimage (bitmap, random (x), random (y); T1: = gettickcount-T1; t2: = gettickcount; for I: = 0 to count-1 do graphic. drawcachedbitmap (cachedbitmap, random (x), random (y); t2: = gettickcount-t2; text: = format ('% d: % d', [T1, t2]); end;

   

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.