Difference between revisions of "Unit uBitmap"
From Ultibo.org
Line 55: | Line 55: | ||
|- | |- | ||
! '''Return''' | ! '''Return''' | ||
− | | True if successful or False | + | | True if successful or False if an error occurred |
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function DrawBitmapFromStream(Handle:TWindowHandle; Stream:TStream; X,Y:LongWord):Boolean;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' A function for drawing a standard bitmap image onto an Ultibo graphics console window from a stream</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Handle''' | ||
+ | | The handle of an existing graphics console window | ||
+ | |- | ||
+ | ! '''Stream''' | ||
+ | | A stream object containing the bitmap exactly as it would appear in a file (including the header etc) | ||
+ | |- | ||
+ | ! '''X''' | ||
+ | | The column position for the left edge of the bitmap | ||
+ | |- | ||
+ | ! '''Y''' | ||
+ | | The row position for the top row of the bitmap | ||
+ | |- | ||
+ | ! '''Return''' | ||
+ | | True if successful or False if an error occurred | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function DrawBitmapFromBuffer(Handle:TWindowHandle; const Buf; Len,X,Y:LongWord):Boolean;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' A function for drawing a standard bitmap image onto an Ultibo graphics console window from a memory buffer</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Handle''' | ||
+ | | The handle of an existing graphics console window | ||
+ | |- | ||
+ | ! '''Buf''' | ||
+ | | A memory buffer containing the bitmap exactly as it would appear in a file (including the header etc) | ||
+ | |- | ||
+ | ! '''X''' | ||
+ | | The column position for the left edge of the bitmap | ||
+ | |- | ||
+ | ! '''Y''' | ||
+ | | The row position for the top row of the bitmap | ||
+ | |- | ||
+ | ! '''Return''' | ||
+ | | True if successful or False if an error occurred | ||
|- | |- | ||
|} | |} | ||
Line 88: | Line 136: | ||
|- | |- | ||
! '''Return''' | ! '''Return''' | ||
− | | True if successful or False | + | | True if successful or False if an error occurred |
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function LoadBitmapToStream(const Filename:String; Stream:TStream; out Width,Height,Format:LongWord):Boolean;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' A function to extract a standard bitmap image into a stream object as a raw image and return the size and format</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Filename''' | ||
+ | | The name of the file to load the bitmap from | ||
+ | |- | ||
+ | ! '''Stream''' | ||
+ | | A stream object to receive the extracted image | ||
+ | |- | ||
+ | ! '''Width''' | ||
+ | | The width in pixels of the extracted image | ||
+ | |- | ||
+ | ! '''Height''' | ||
+ | | The height in pixels of the extracted image | ||
+ | |- | ||
+ | ! '''Format''' | ||
+ | | The color format of the extracted image (eg COLOR_FORMAT_RGB24) | ||
+ | |- | ||
+ | ! '''Return''' | ||
+ | | True if successful or False if an error occurred | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function LoadBitmapToBuffer(const Filename:String; var Buf; var Len:LongWord; out Width,Height,Format:LongWord):Boolean;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' A function to extract a standard bitmap image into a memory buffer as a raw image and return the size and format</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Filename''' | ||
+ | | The name of the file to load the bitmap from | ||
+ | |- | ||
+ | ! '''Buf''' | ||
+ | | A memory buffer to receive the extracted image (Must be large enough to contain the extracted image) | ||
+ | |- | ||
+ | ! '''Len''' | ||
+ | | The size in bytes of the extracted image (Pass 0 to find how many bytes are required) | ||
+ | |- | ||
+ | ! '''Width''' | ||
+ | | The width in pixels of the extracted image | ||
+ | |- | ||
+ | ! '''Height''' | ||
+ | | The height in pixels of the extracted image | ||
+ | |- | ||
+ | ! '''Format''' | ||
+ | | The color format of the extracted image (eg COLOR_FORMAT_RGB24) | ||
+ | |- | ||
+ | ! '''Return''' | ||
+ | | True if successful or False if an error occurred | ||
|- | |- | ||
|} | |} |
Revision as of 03:59, 27 September 2017
Return to Unit Reference
Description
Ultibo Bitmap utility unit
Functions to draw or save a standard bitmap image to or from an Ultibo graphics console window.
These functions originally appeared in the Ultibo forum and examples of how to use them can be found there:
- DrawBitmap - https://ultibo.org/forum/viewtopic.php?f=13&t=312
- SaveBitmap - https://ultibo.org/forum/viewtopic.php?f=13&t=313
Constants
None defined
Type definitions
None defined
Public variables
None defined
Function declarations
uBitmap functions
function DrawBitmap(Handle:TWindowHandle; const Filename:String; X,Y:LongWord):Boolean;
Description: A function for drawing a standard bitmap image onto an Ultibo graphics console window
Handle | The handle of an existing graphics console window |
---|---|
Filename | The name of the file to load the bitmap from |
X | The column position for the left edge of the bitmap |
Y | The row position for the top row of the bitmap |
Return | True if successful or False if an error occurred |
function DrawBitmapFromStream(Handle:TWindowHandle; Stream:TStream; X,Y:LongWord):Boolean;
Description: A function for drawing a standard bitmap image onto an Ultibo graphics console window from a stream
Handle | The handle of an existing graphics console window |
---|---|
Stream | A stream object containing the bitmap exactly as it would appear in a file (including the header etc) |
X | The column position for the left edge of the bitmap |
Y | The row position for the top row of the bitmap |
Return | True if successful or False if an error occurred |
function DrawBitmapFromBuffer(Handle:TWindowHandle; const Buf; Len,X,Y:LongWord):Boolean;
Description: A function for drawing a standard bitmap image onto an Ultibo graphics console window from a memory buffer
Handle | The handle of an existing graphics console window |
---|---|
Buf | A memory buffer containing the bitmap exactly as it would appear in a file (including the header etc) |
X | The column position for the left edge of the bitmap |
Y | The row position for the top row of the bitmap |
Return | True if successful or False if an error occurred |
function SaveBitmap(Handle:TWindowHandle; const Filename:String; X,Y,Width,Height,BPP:LongWord):Boolean;
Description: A function for saving all or part of an Ultibo graphics console window to a standard bitmap file
Handle | The handle of an existing graphics console window |
---|---|
Filename | The name of the file to save the bitmap to |
X | The column position for the left edge of the bitmap |
Y | The row position for the top row of the bitmap |
Width | The width (in pixels) of the bitmap |
Height | The height (in pixels) of the bitmap |
BPP | The bits per pixel value for the bitmap (eg 16, 24 or 32) |
Return | True if successful or False if an error occurred |
function LoadBitmapToStream(const Filename:String; Stream:TStream; out Width,Height,Format:LongWord):Boolean;
Description: A function to extract a standard bitmap image into a stream object as a raw image and return the size and format
Filename | The name of the file to load the bitmap from |
---|---|
Stream | A stream object to receive the extracted image |
Width | The width in pixels of the extracted image |
Height | The height in pixels of the extracted image |
Format | The color format of the extracted image (eg COLOR_FORMAT_RGB24) |
Return | True if successful or False if an error occurred |
function LoadBitmapToBuffer(const Filename:String; var Buf; var Len:LongWord; out Width,Height,Format:LongWord):Boolean;
Description: A function to extract a standard bitmap image into a memory buffer as a raw image and return the size and format
Filename | The name of the file to load the bitmap from |
---|---|
Buf | A memory buffer to receive the extracted image (Must be large enough to contain the extracted image) |
Len | The size in bytes of the extracted image (Pass 0 to find how many bytes are required) |
Width | The width in pixels of the extracted image |
Height | The height in pixels of the extracted image |
Format | The color format of the extracted image (eg COLOR_FORMAT_RGB24) |
Return | True if successful or False if an error occurred |
Return to Unit Reference