Partager via


GDI Plus Bitmap Foundation Class

The gpBitmap class encapsulates a GDI+ bitmap, which consists of the pixel data for a graphics image and its attributes. A Bitmap object is an object used to work with images defined by pixel data.

Category

Reporting

Default Catalog

Visual FoxPro Catalog\Foundation Classes\Output\GDIplus

Class

gpBitmap

Base Class

Custom

Class Library

_GDIPLUS.vcx

Parent Class

gpImage (GDI Plus Image Foundation Class)

Remarks

The following table lists public properties and methods added by this class to its parent class, gpImage.

Properties and methods

Description

Create Method

Creates a bitmap object.

Syntax: ? THIS.Create(tnWidth, tnHeight[, tnPixelFormat])

Return Values: Logical, representing success or failure.

Parameters: 

tnWidth, required, width of the new bitmap in pixels.

tnHeight, required, height of the new bitmap in pixels.

tnPixelFormat, optional, one of GDIPLUS_PIXELFORMAT_* constants, defaults to GDIPLUS_PIXELFORMAT_32bppARGB.

Remarks: This method is equivalent to the .NET constructor Bitmap(int, int, PixelFormat).

CreateFromFile Method

Creates a bitmap object by loading from a file.

Syntax: ? THIS.CreateFromFile(tcFileName[, tlUseEmbeddedColorMgmt])

Return Values: Logical, representing success or failure.

Parameters: 

tcFileName, required, the name of the file to read.

tlUseEmbeddedColorMgmt, optional, indicates whether the color management info embedded in the file, rather than defaults, should be used for the resulting bitmap object.

Remarks: This method is equivalent to the .NET constructor Bitmap(string,bool). This method will always create a rasterized bitmap even if the source file is in a vector format. To retain the vector format in memory, use the GDI Plus Image Foundation Class (gpImage).

CreateFromGraphics Method

Creates a bitmap object from a graphics object specifying the bitmap's properties.

Syntax: ? THIS.CreateFromGraphics(toGraphics, tnWidth, tnHeight)

Return Values: Logical, representing success or failure.

Parameters: 

toGraphics, required, instance of gpGraphics or GDI+ Graphics handle, from which to create the bitmap.

tnWidth, required, width of the new bitmap in pixels.

tnHeight, required, height of the new bitmap in pixels.

Remarks: This method is equivalent to the .NET constructor Bitmap(int, int, Graphics).

The pixel format of the bitmap cannot be set; it will default to GDIPLUS_PIXELFORMAT_32bppARGB.

GetPixel Method

Gets the color value of an individual pixel.

Syntax: nValue = THIS.GetPixel(tX, tY)

Return Values: Integer, ARGB color value of the pixel. Returns null (.NULL.) on failure.

Parameters: 

tX, required, integer X-coordinate of pixel to get.

tY, required, integer X-coordinate of pixel to get.

Remarks: This method is equivalent to the .NET Bitmap.GetPixel(int, int).

SetPixel Method

Sets the color value of an individual pixel.

Syntax: THIS.SetPixel( tX, tY, tvColor )

Return Values: Logical, representing success or failure.

Parameters: 

tX, required, integer X-coordinate of pixel to get.

tY, required, integer X-coordinate of pixel to get.

tvColor, required, GDI Plus Color Foundation Class object (gpColor) or integer ARGB color value.

Remarks: This method is equivalent to the .NET Bitmap.SetPixel(int, int,Color).

SetResolution Method

Sets the resolution of the Bitmap in dots per inch.

Syntax: THIS.SetResolution( tnDPIx, tnDPIy)

Return Values: Logical, representing success or failure.

Parameters: 

tnDPIx, the horizontal resolution, in dots per inch, of the bitmap.

tnDPIy, the vertical resolution, in dots per inch, of the bitmap.

Remarks: This method is equivalent to the .NET Bitmap.SetResolution(float,float).

See Also

Concepts

Guidelines for Using Visual FoxPro Foundation Classes

Reference

Visual FoxPro Foundation Classes A-Z

GDI Plus API Wrapper Foundation Classes