Leadtools.CF Send comments on this topic. | Back to Introduction - All Topics | Help Version 17.0.6.15
RasterImage Constructor
See Also 
Leadtools Namespace > RasterImage Class : RasterImage Constructor



flags
An RasterMemoryFlags enumeration indicating the type of memory to allocate for the image data.
width
Width of the image in pixels.
height
Height of the image in pixels.
bitsPerPixel
The number of bits per pixel.
Valid values are 0, 1, 2, 3, 4, 5, 6, 7, 8, 12, 16, 24, 32, 48, and 64.
Use 0 to create an 8-bit grayscale image. In that case, the function ignores the order and palette parameters.
order
Color order for 16-, 24-, 32-, 48- and 64-bit images.
If the resultant image is less than 16 bits per pixel, this will have no effect since palletized images have no order.
viewPerspective
An RasterViewPerspective specifying where the beginning of the image is stored.
Most file formats start in the lower left corner while some formats start in the upper left corner.
palette
The palette that the image will use. You can specify your own palette, or use null (Nothing in Visual Basic) for LEAD's fixed palette.
userData
Data array that will contain the image data when flags is RasterMemoryFlags.User.
This data must be aligned on a four byte boundary.
Constructs a new RasterImage object using the specified parameters.

Syntax

Visual Basic (Declaration) 
Public Function New( _
   ByVal flags As RasterMemoryFlags, _
   ByVal width As Integer, _
   ByVal height As Integer, _
   ByVal bitsPerPixel As Integer, _
   ByVal order As RasterByteOrder, _
   ByVal viewPerspective As RasterViewPerspective, _
   ByVal palette() As Color, _
   ByVal userData() As Byte _
)
Visual Basic (Usage)Copy Code
Dim flags As RasterMemoryFlags
Dim width As Integer
Dim height As Integer
Dim bitsPerPixel As Integer
Dim order As RasterByteOrder
Dim viewPerspective As RasterViewPerspective
Dim palette() As Color
Dim userData() As Byte
 
Dim instance As RasterImage(flags, width, height, bitsPerPixel, order, viewPerspective, palette, userData)
C# 
public RasterImage( 
   RasterMemoryFlags flags,
   int width,
   int height,
   int bitsPerPixel,
   RasterByteOrder order,
   RasterViewPerspective viewPerspective,
   Color[] palette,
   byte[] userData
)
C++/CLI 
public:
RasterImage( 
   RasterMemoryFlags flags,
   int width,
   int height,
   int bitsPerPixel,
   RasterByteOrder order,
   RasterViewPerspective viewPerspective,
   array<Color>^ palette,
   array<byte>^ userData
)

Parameters

flags
An RasterMemoryFlags enumeration indicating the type of memory to allocate for the image data.
width
Width of the image in pixels.
height
Height of the image in pixels.
bitsPerPixel
The number of bits per pixel.
Valid values are 0, 1, 2, 3, 4, 5, 6, 7, 8, 12, 16, 24, 32, 48, and 64.
Use 0 to create an 8-bit grayscale image. In that case, the function ignores the order and palette parameters.
order
Color order for 16-, 24-, 32-, 48- and 64-bit images.
If the resultant image is less than 16 bits per pixel, this will have no effect since palletized images have no order.
viewPerspective
An RasterViewPerspective specifying where the beginning of the image is stored.
Most file formats start in the lower left corner while some formats start in the upper left corner.
palette
The palette that the image will use. You can specify your own palette, or use null (Nothing in Visual Basic) for LEAD's fixed palette.
userData
Data array that will contain the image data when flags is RasterMemoryFlags.User.
This data must be aligned on a four byte boundary.

Remarks

Creating an image of type RasterMemoryFlags.User does not allocate memory for the image data. Instead, the data pointer userData is used.

There is some speed penalty (loss) for accessing RasterMemoryFlags.Tiled images. Therefore, it is not recommended for use with all images.

The RasterMemoryFlags.Tiled images are not used by default. LEADTOOLS will create them only if it failed to create RasterMemoryFlags.Conventional images and RasterMemoryFlags.NoTiled was not specified.

The following lists the distinct types of bitmaps:

  • Conventional (uncompressed and contiguous) This is the most common type.
  • Compressed (1-bit only)
  • Tiled (uncompressed, stored internally as up to 64MB tiles)

If you pass RasterMemoryFlags.User, you are responsible for freeing the image data.

Some image processing functions, such as RotateCommand, need to re-allocate the image data. If you create an image with RasterMemoryFlags.User, and pass it to these methods, they will fail and throw and exception.

For more information refer to Accounting for View Perspective.

Requirements

Target Platforms: Microsoft .NET CF Framework 2.0, Windows Mobile 5 PocketPC, Windows Mobile 5 Smartphone, Windows Mobile 6

See Also