graphics/image.bi

Summary
graphics/image.bi
LicenseCopyright © 2007-2011, FreeBASIC Extended Library Development Group
ext.gfx
ImageProvides a New-able FB.IMAGE replacement with built-in memory management and convenience functions while maintaining compatibility with current fbgfx functions including ImageInfo.
Functions
constructorConstructs a blank image with the dimensions and color requested.
constructorConstructs an Image with an external FB.IMAGE.
copy constructorTakes over responsibility for an FB.IMAGE from the passed Image.
default constructorConstructs an invalid Image.
setImageSets the image to handle, freeing the current image if necessary.
heightReturns the height of the image.
widthReturns the width of the image.
pitchReturns the pitch of the image.
bppReturns the bits per pixel of the image.
DisplayCopies the image data to a buffer.
DisplayCopies the image data to a buffer.
DisplayCopies the image data to the screen.
DisplayCopies the image data to the screen.
PixelsUsed to access the raw pixels of the underlying image.

License

Copyright © 2007-2011, FreeBASIC Extended Library Development Group

Distributed under the FreeBASIC Extended Library Group license.  See accompanying file LICENSE.txt or copy at http://code.google.com/p/fb-extended-lib/wiki/License

ext.gfx

Image

Provides a New-able FB.IMAGE replacement with built-in memory management and convenience functions while maintaining compatibility with current fbgfx functions including ImageInfo.

Summary
Functions
constructorConstructs a blank image with the dimensions and color requested.
constructorConstructs an Image with an external FB.IMAGE.
copy constructorTakes over responsibility for an FB.IMAGE from the passed Image.
default constructorConstructs an invalid Image.
setImageSets the image to handle, freeing the current image if necessary.
heightReturns the height of the image.
widthReturns the width of the image.
pitchReturns the pitch of the image.
bppReturns the bits per pixel of the image.
DisplayCopies the image data to a buffer.
DisplayCopies the image data to a buffer.
DisplayCopies the image data to the screen.
DisplayCopies the image data to the screen.
PixelsUsed to access the raw pixels of the underlying image.

Functions

constructor

declare constructor(byval w_ as uinteger,  
byval h_ as uinteger,  
byval def_color as uinteger =  RGBA(255,0,255,255))

Constructs a blank image with the dimensions and color requested.

Parameters

w_the desired width of the image.
h_the desired height of the image.
def_colorthe desired default color of the image.  Defaults to RGBA(255,0,255,255)

constructor

declare constructor(byval _x_ as FB.IMAGE ptr)

Constructs an Image with an external FB.IMAGE.  Takes over responsibility for freeing the fb.image’s memory.

Parameters

_x_FB.IMAGE ptr to be used.

copy constructor

Takes over responsibility for an FB.IMAGE from the passed Image.

Parameters

_x_the Image class to take image data from.

default constructor

Constructs an invalid Image.  Use with the setImage function below.

setImage

declare sub setImage(byval _x_ as FB.IMAGE ptr)

Sets the image to handle, freeing the current image if necessary.

Parameters

_x_FB.IMAGE ptr to the new image data to use.

height

declare function height( ) as ext.SizeType

Returns the height of the image.

width

declare function width( ) as ext.SizeType

Returns the width of the image.

pitch

declare function pitch( ) as ext.SizeType

Returns the pitch of the image.

bpp

declare function bpp( ) as ext.SizeType

Returns the bits per pixel of the image.

Display

declare sub Display overload(byval _dest_ as FB.IMAGE ptr,  
byval _x_ as integer,  
byval _y_ as integer,  
byval _method_ as ext.gfx.DrawMethods =  XOR_,
byval _al as integer =  0)

Copies the image data to a buffer.  Equivalent to fbgfx’s put command.

Parameters

_dest_FB.IMAGE ptr to destination buffer.
_x_The X position to draw image at.
_y_The Y position to draw image at.
_method_The method to use to draw the image, one of DrawMethods.
_alOptional value to use with the Alpha_ draw method, defaults to 0.

Display

declare sub Display(byval _dest_ as FB.IMAGE ptr,  
byref _pos as const ext.math.vec2i,  
byval _method_ as ext.gfx.DrawMethods =  XOR_,
byval _al as integer =  0)

Copies the image data to a buffer.  Equivalent to fbgfx’s put command.

Parameters

_dest_FB.IMAGE ptr to destination buffer.
_posposition to draw image at.
_method_The method to use to draw the image, one of DrawMethods.
_alOptional value to use with the Alpha_ draw method, defaults to 0.

Display

declare sub Display(byval _x_ as integer,  
byval _y_ as integer,  
byval _method_ as ext.gfx.DrawMethods =  XOR_,
byval _al as integer =  0)

Copies the image data to the screen.  Equivalent to fbgfx’s put command.

Parameters

_x_The X position to draw image at.
_y_The Y position to draw image at.
_method_The method to use to draw the image, one of DrawMethods.
_alOptional value to use with the Alpha_ draw method, defaults to 0.

Display

declare sub Display(byref _pos as const ext.math.vec2i,  
byval _method_ as ext.gfx.DrawMethods =  XOR_,
byval _al as integer =  0)

Copies the image data to the screen.  Equivalent to fbgfx’s put command.

Parameters

_posposition to draw image at.
_method_The method to use to draw the image, one of DrawMethods.
_alOptional value to use with the Alpha_ draw method, defaults to 0.

Pixels

declare function Pixels(byref num_pixels as uinteger =  0) as uinteger ptr

Used to access the raw pixels of the underlying image.

Parameters

num_pixelsOptional value will be replaced by the number of pixels in the image if passed.

Returns

Uinteger ptr to image data.

declare constructor(byval w_ as uinteger,  
byval h_ as uinteger,  
byval def_color as uinteger =  RGBA(255,0,255,255))
Constructs a blank image with the dimensions and color requested.
declare sub setImage(byval _x_ as FB.IMAGE ptr)
Sets the image to handle, freeing the current image if necessary.
declare function height( ) as ext.SizeType
Returns the height of the image.
declare function width( ) as ext.SizeType
Returns the width of the image.
declare function pitch( ) as ext.SizeType
Returns the pitch of the image.
declare function bpp( ) as ext.SizeType
Returns the bits per pixel of the image.
declare sub Display overload(byval _dest_ as FB.IMAGE ptr,  
byval _x_ as integer,  
byval _y_ as integer,  
byval _method_ as ext.gfx.DrawMethods =  XOR_,
byval _al as integer =  0)
Copies the image data to a buffer.
declare function Pixels(byref num_pixels as uinteger =  0) as uinteger ptr
Used to access the raw pixels of the underlying image.
Used to determine the method to use when drawing an image.