Difference between revisions of "Unit uBitmap"

From Ultibo.org
Jump to: navigation, search
 
(One intermediate revision by the same user not shown)
Line 5: Line 5:
 
----
 
----
  
'''Ultibo Bitmap utility unit'''
+
'''Ultibo Bitmap Utility unit'''
  
 
Functions to draw or save a standard bitmap image to or from an Ultibo graphics console window.  
 
Functions to draw or save a standard bitmap image to or from an Ultibo graphics console window.  
Line 42: Line 42:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Handle'''
+
! Handle
 
| The handle of an existing graphics console window
 
| The handle of an existing graphics console window
 
|-
 
|-
! '''Filename'''
+
! Filename
 
| The name of the file to load the bitmap from
 
| The name of the file to load the bitmap from
 
|-
 
|-
! '''X'''
+
! X
 
| The column position for the left edge of the bitmap
 
| The column position for the left edge of the bitmap
 
|-
 
|-
! '''Y'''
+
! Y
 
| The row position for the top row of the bitmap
 
| The row position for the top row of the bitmap
 
|-
 
|-
! '''Return'''
+
! Return
 
| True if successful or False if an error occurred
 
| True if successful or False if an error occurred
 
|-
 
|-
Line 66: Line 66:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Handle'''
+
! Handle
 
| The handle of an existing graphics console window
 
| The handle of an existing graphics console window
 
|-
 
|-
! '''Stream'''
+
! Stream
 
| A stream object containing the bitmap exactly as it would appear in a file (including the header etc)
 
| A stream object containing the bitmap exactly as it would appear in a file (including the header etc)
 
|-
 
|-
! '''X'''
+
! X
 
| The column position for the left edge of the bitmap
 
| The column position for the left edge of the bitmap
 
|-
 
|-
! '''Y'''
+
! Y
 
| The row position for the top row of the bitmap
 
| The row position for the top row of the bitmap
 
|-
 
|-
! '''Return'''
+
! Return
 
| True if successful or False if an error occurred
 
| True if successful or False if an error occurred
 
|-
 
|-
Line 90: Line 90:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Handle'''
+
! Handle
 
| The handle of an existing graphics console window
 
| The handle of an existing graphics console window
 
|-
 
|-
! '''Buf'''
+
! Buf
 
| A memory buffer containing the bitmap exactly as it would appear in a file (including the header etc)
 
| A memory buffer containing the bitmap exactly as it would appear in a file (including the header etc)
 
|-
 
|-
! '''X'''
+
! X
 
| The column position for the left edge of the bitmap
 
| The column position for the left edge of the bitmap
 
|-
 
|-
! '''Y'''
+
! Y
 
| The row position for the top row of the bitmap
 
| The row position for the top row of the bitmap
 
|-
 
|-
! '''Return'''
+
! Return
 
| True if successful or False if an error occurred
 
| True if successful or False if an error occurred
 
|-
 
|-
Line 114: Line 114:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Handle'''
+
! Handle
 
| The handle of an existing graphics console window
 
| The handle of an existing graphics console window
 
|-
 
|-
! '''Filename'''
+
! Filename
 
| The name of the file to save the bitmap to
 
| The name of the file to save the bitmap to
 
|-
 
|-
! '''X'''
+
! X
 
| The column position for the left edge of the bitmap
 
| The column position for the left edge of the bitmap
 
|-
 
|-
! '''Y'''
+
! Y
 
| The row position for the top row of the bitmap
 
| The row position for the top row of the bitmap
 
|-
 
|-
! '''Width'''
+
! Width
 
| The width (in pixels) of the bitmap
 
| The width (in pixels) of the bitmap
 
|-
 
|-
! '''Height'''
+
! Height
 
| The height (in pixels) of the bitmap
 
| The height (in pixels) of the bitmap
 
|-
 
|-
! '''BPP'''
+
! BPP
 
| The bits per pixel value for the bitmap (eg 16, 24 or 32)
 
| The bits per pixel value for the bitmap (eg 16, 24 or 32)
 
|-
 
|-
! '''Return'''
+
! Return
 
| True if successful or False if an error occurred
 
| True if successful or False if an error occurred
 
|-
 
|-
Line 147: Line 147:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Filename'''
+
! Filename
 
| The name of the file to load the bitmap from
 
| The name of the file to load the bitmap from
 
|-
 
|-
! '''Stream'''
+
! Stream
 
| A stream object to receive the extracted image
 
| A stream object to receive the extracted image
 
|-
 
|-
! '''Width'''
+
! Width
 
| The width in pixels of the extracted image
 
| The width in pixels of the extracted image
 
|-
 
|-
! '''Height'''
+
! Height
 
| The height in pixels of the extracted image
 
| The height in pixels of the extracted image
 
|-
 
|-
! '''Format'''
+
! Format
 
| The color format of the extracted image (eg COLOR_FORMAT_RGB24)
 
| The color format of the extracted image (eg COLOR_FORMAT_RGB24)
 
|-
 
|-
! '''Return'''
+
! Return
 
| True if successful or False if an error occurred
 
| True if successful or False if an error occurred
 
|-
 
|-
Line 174: Line 174:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Filename'''
+
! Filename
 
| The name of the file to load the bitmap from
 
| The name of the file to load the bitmap from
 
|-
 
|-
! '''Buf'''
+
! Buf
 
| A memory buffer to receive the extracted image (Must be large enough to contain the extracted image)
 
| A memory buffer to receive the extracted image (Must be large enough to contain the extracted image)
 
|-
 
|-
! '''Len'''
+
! Len
 
| The size in bytes of the extracted image (Pass 0 to find how many bytes are required)
 
| The size in bytes of the extracted image (Pass 0 to find how many bytes are required)
 
|-
 
|-
! '''Width'''
+
! Width
 
| The width in pixels of the extracted image
 
| The width in pixels of the extracted image
 
|-
 
|-
! '''Height'''
+
! Height
 
| The height in pixels of the extracted image
 
| The height in pixels of the extracted image
 
|-
 
|-
! '''Format'''
+
! Format
 
| The color format of the extracted image (eg COLOR_FORMAT_RGB24)
 
| The color format of the extracted image (eg COLOR_FORMAT_RGB24)
 
|-
 
|-
! '''Return'''
+
! Return
 
| True if successful or False if an error occurred
 
| True if successful or False if an error occurred
 
|-
 
|-

Latest revision as of 06:18, 31 August 2021

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:

Constants


None defined

Type definitions


None defined

Public variables


None defined

Function declarations



uBitmap functions

[Expand]
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


[Expand]
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


[Expand]
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


[Expand]
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


[Expand]
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


[Expand]
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


Return to Unit Reference