v2026.6.4
All Bundles
Bundle SDL2 multimedia library for 2D graphics, input handling, audio playback, and window management. Core types: Window, Renderer, Texture, Surface, Event, and Mixer. Compile with -lib sdl2.

PixelFormat

PixelFormat class

Operations

GetAmask #

Get mask representing the location of the alpha component of the pixel or 0 if the pixel format doesn't have any alpha information

method : public : GetAmask() ~ Int

Return

TypeDescription
Intpixel mask

GetBitsPerPixel #

Get the number of significant bits in a pixel value

method : public : GetBitsPerPixel() ~ Int

Return

TypeDescription
Intbits per pixel

GetBmask #

Get mask representing the location of the blue component of the pixel

method : public : GetBmask() ~ Int

Return

TypeDescription
Intpixel mask

GetBytesPerPixel #

Get the number of bytes required to hold a pixel value

method : public : GetBytesPerPixel() ~ Int

Return

TypeDescription
Intbytes per pixel

GetFormat #

Get pixel format

method : public : GetFormat() ~ PixelValue

Return

TypeDescription
PixelValuepixel format

GetGmask #

Get mask representing the location of the green component of the pixel

method : public : GetGmask() ~ Int

Return

TypeDescription
Intpixel mask

GetRmask #

Get mask representing the location of the red component of the pixel

method : public : GetRmask() ~ Int

Return

TypeDescription
Intpixel mask

MapRGB #

Map an RGB triple to an opaque pixel value for a given pixel format

method : public : MapRGB(r:Int, g:Int, b:Int) ~ Int

Parameters

NameTypeDescription
rIntthe red component of the pixel in the range 0-255
gIntthe green component of the pixel in the range 0-255
bIntthe blue component of the pixel in the range 0-255

Return

TypeDescription
Intreturns a pixel value

MapRGBA #

Map an RGBA quadruple to a pixel value for a given pixel format

method : public : MapRGBA(r:Int, g:Int, b:Int, a:Int) ~ Int

Parameters

NameTypeDescription
rIntthe red component of the pixel in the range 0-255
gIntthe green component of the pixel in the range 0-255
bIntthe blue component of the pixel in the range 0-255
aIntthe alpha component of the pixel in the range 0-255

Return

TypeDescription
Intreturns a pixel value

SetAmask #

Set alpha mask

method : public : SetAmask(a_mask:Int) ~ Nil

Parameters

NameTypeDescription
a_maskIntalpha mask

SetBitsPerPixel #

Set bits per pixel

method : public : SetBitsPerPixel(bits_per_pixel:Int) ~ Nil

Parameters

NameTypeDescription
bits_per_pixelIntbits per pixel

SetBmask #

Set blue mask

method : public : SetBmask(b_mask:Int) ~ Nil

Parameters

NameTypeDescription
b_maskIntblue mask

SetBytesPerPixel #

Set bytes per pixel

method : public : SetBytesPerPixel(bytes_per_pixel:Int) ~ Nil

Parameters

NameTypeDescription
bytes_per_pixelIntbytes per pixel

SetFormat #

Set pixel format

method : public : SetFormat(format:Int) ~ Nil

Parameters

NameTypeDescription
formatIntpixel format

SetGmask #

Set green mask

method : public : SetGmask(g_mask:Int) ~ Nil

Parameters

NameTypeDescription
g_maskIntgreen mask

SetRmask #

Set red mask

method : public : SetRmask(r_mask:Int) ~ Nil

Parameters

NameTypeDescription
r_maskIntred mask