TypeLib Xojo support Plugin

RawBitmap Class

A class to handle bitmaps on memory block level without dependency to Xojo’s Graphics functions.

Xojo’s console pictures suffer from loss of data because of the 7 bit alpha channel and their also extremely slow since their console images need to allocate one buffer per line in the image.

Xojo’s desktop pictures also are not consistent since some platforms use pre-multiplied alphas and others not. The premultiplied alphas also loose precision which makes them not suitable for most image processing.

See more info on the Xojo’s premultiplied alphas at: Premultiplied alpha channels in Xojo

Object
   RawBitmap

class RawBitmap

Constructors

RawBitmapConstructs a new 4 channel RawBitmap with a given width and given height.
RawBitmapConstructs a new RawBitmap with a given width, given height and given number of channels.
RawBitmapConstructs a new RawBitmap with a given width, given height, given number of channels and given rowBytes value.
RawBitmapConstructs a RawBitmap with a given color space. This constructor can either take external MemoryBlock or handle allocating the MemoryBlock buffer.

Properties

ChannelsReturns the number of channels in the bitmap.
ColorSpaceReturns info on what kind of colorspace the RawBitmap has. (RGB, Gray or CMYK). This can be any value from the RawBitmap.ColorSpaces enum.
DepthReturns the depth per channel of the bitmap.
HasAlphaChannelReturns true if the RawBitmap has alpha channel, else false.
HasICCColorProfileReturns true if the RawBitmap has ICC Color profile, else false
HeightReturns the height of the Bitmap in pixels.
HorizontalResolutionReturns the horizontal resolution of the image. (This can be set if the image was for example read from Jpg)
ICCColorProfileNameReturns set value of the name of the ICC Color profile.
ICCProfileDataReturns the raw ICC Color profile data if the RawBitmap contains ICC profile.
ImageFormatReturns the format of the color components in the RawBitmap
IsFloatPixelMapReturns true if the pixel map is based on floats.
IsValidReturns true if creating instance of the RawBitmap created valid instance, else false.
MemoryBlockReturns the memory block that is under the hood in the RawBitmap.
PixelBytesReturns number of bytes per pixel in the image.
PremultipliedReturns true if the bitmap is known to be premultiplied.
RowBytesReturns the number of bytes in each row of the bitmap.
VerticalResolutionReturns the vertical resolution of the image. (This can be set if the image was for example read from Jpg)
WidthReturns the width of the Bitmap in pixels.

Methods

ClearICCColorProfileRemoves ICC color profile from the RawBitmap
CloneClones the RawBitmap and optionally adds alpha channel.
ConvertConverts between RawBitmap formats.
CopyICCColorProfileFromCopies ICC profile from other RawBitmap instance and puts it on this instance of the RawBitmap
CropCrops the image, returning a new RawBitmap with the result or nil if no parts of the image were within the Crop parameters.
DrawBitmapDraws a RawBitmap into the RawBitmap
DrawEllipseDraws non filled ellipse.
DrawLineDraws a line at given location into the RawBitmap with a given color.
DrawLineAntialiasedDraws antialiased line at given location into the RawBitmap with a given color.
DrawPixelDraws pixel on the RawBitmap, doing alpha blending as needed depending on the color passed in,
DrawRectDraws non filled rectangle.
FillFills the Bitmap with given color, optionally using mask.
FillRectDraws filled rectangle of given color
FillRectAlphaDraws only the alpha channel of filled rectangle
FloodFillAdvanced flood fill method that takes fill color, location, tolerance and do normal straight fill or straight and diagonal.
FloodFillTaskAdvanced flood fill method that takes fill color, location, tolerance and do normal straight fill or straight and diagonal. This variant of the method does not perform the task but rather returns a EinhugurRuntime.Task object to execute the routine in a native thread.
GenerateFloodFillMaskGenerates magic wand mask by using flood fill algorithm.
GetPixelComponentsGets component floating point values for given pixel
PixelSets or gets the color of a pixel in the RawBitmap.
PixelAlphaSets or gets the alpha value for pixel at given location
SetPixelComponentsSets component floating point values for given pixel
UnpremultiplyUnpremultiplies the RawBitmap if it is premultiplied.

Delegates

ProgressDelegate (console safe) Delegate type to be used with various of bitmap operations.

Enumerations

RawBitmapFormatEnum that represents the format of the color components. The constants are named as follows:
  • g - Stands for grayscale channel.
  • A - Stands for alpha channel.
  • R - Stands for red channel.
  • G - Stands for green channel.
  • B - Stands for blue channel.
  • X - Stands for unused channel.
  • C - Stands for cyan channel.
  • M - Stands for magenta channel.
  • Y - Stands for yellow channel.
  • K - Stands for key channel. (used in CMYK color spaces)
  • ColorSpacesA enum that has definitions of color spaces.

    Supported Platforms:

  • macOS Intel 64 bit
  • macOS Apple Silicon
  • Windows 32 bit
  • Windows 64 bit
  • Windows ARM 64 bit
  • Linux 32 bit
  • Linux 64 bit
  • Linux ARM 32 bit
  • Linux ARM 64 bit
  • iOS