ImageClass
Previous  

The ImageClass object provides the following methods and a single property.


Methods

New1: Create an instance of ImageClass. Must called before trying to use an ImageClass object.


Entire image manipulation methods

CombineImagesHorizontal(Image1, Image2): Returns a new Image. The Left part is Image1 and right part is Image2. New width = width1+width2 and new height = height of the highest Image. The empty space is filled with the colour of pixel(0,0) of Image1.

CombineImagesVertical(Image1, Image2): Returns a new Image. The upper part is Image1 and bottom part is Image2. New height = height1+height2 and new width = width of the wider Image. The empty space is filled with the colour of pixel(0,0) of Image1.

CopyImage(sourceImage, x,y,width, height): Copies a part of an image. Returns the selected area of the original image.

CreateEmptyImage(Width, Height, alpha, red, green, blue): Return a new image of the size and background colour specified.

DrawImage(targetImage, sourceImage, x, y, width, height): Draws the entire sourceImage in a rectangle (x,y,width, height) on a copy of targetImage. Returns the new combined image leaving the originals unchanged.

ImageSize(Image): Returns an array(2) containing width and height of the image, array(0) = width and array(1) = height.

ImageToByteArray(Image): Returns an array of bytes which contains the whole Image.

ByteArrayToImage(byte()): Converts the byte array to an Image.

FlipHorizontal(sourceImage): Flips the image horizontally.

FlipVertical(sourceImage): Flips the image vertically.

InvertImage(sourceImage): Inverts the colours of the image

RotateImage(sourceImage, angle): Rotates an image. Angle must be one of 0, 90, 180, 270. Returns the rotated Image.

ZoomImage(sourceImage, Percent): Zooms an image Percent% of the original (Percent = 0 to 1000). Returns the Zoomed Image


Screen capture methods

ControlCapture(ControlName,x,y,width,Height): Captures part of a control. x,y are relative to the upper left corner of the control. The control can be a form or any other control.

ScreenCapture: Captures the whole screen.

ScreenCapture2(x,y,width,Height): Captures part of the screen.


Save image methods

SaveImageBMP(Image, FileName): Saves the Image in BMP format to a file with filename Filename.

SaveImageJPEG(Image, FileName): Saves the Image inJPG format to a file with filename Filename.

SaveImageGIF(Image, FileName): Saves the Image inGIF format to a file with filename Filename.


Individual pixel methods

GetPixel(x, y): Returns a byte array(4) with the values of the internal stored image's pixel data. "Dim Type(Alpha, Red, Green, Blue) As byte"

SetPixel(x, y, Alpha, Red, Green, Blue): Set the values of the pixel data in position x,y of the internal stored image to Alpha, Red, Green, Blue.


"Fast" methods using low-level techniques to achieve fast execution

FastPixelsStart: This must be called before using any "Fast" method. Any number of "Fast" functions can then be called.

FastPixelsEnd: This must be called after using the last "Fast" method to unlock the image for further use.

 FastGetPixel(x, y): Returns a byte array(4) with the values of the internal stored image's pixel data. "Dim Type(Alpha, Red, Green, Blue) pixel As byte".

 FastSetPixel(x, y, alpha, red, green, blue): Set the values of the pixel data in position X,Y of the internal stored image to Alpha, Red, Green, Blue.

FastRotateImage(sourceImage, angle):  Rotates an image. Angle can be any but 0, 90, 180, 270 are optimised. The empty space is filled with the colour of pixel(0,0) of the original image. Returns the rotated Image


Properties

I signifies readable, O signifies settable.


Image: Image [I/O] :The recently captured image