PixelArray

An array of pixel color data.

  • PixelArray(size: Vec2)
  • PixelArray(file_path: str)

Properties


NameDescriptionType
color_keyThe color key used for transparency in the pixel arrayColor
alpha_modThe alpha modulation value for the pixel array (0-255)int
widthThe width of the pixel array in pixelsint
heightThe height of the pixel array in pixelsint
sizeThe size of the pixel arrayVec2

Methods


Fill

fill(color: Color) None

Fill the pixel array with a color.

Parameters

  • color: The color to fill the pixel array with.

Blit

blit(pixel_array: PixelArray, pos: Vec2, anchor: Anchor = CENTER, src: Rect = None) None

Blit another pixel array onto this one via position and anchor.

Parameters

  • pixel_array: The pixel array to blit onto this one.
  • pos: The position to blit the pixel array at.
  • anchor: The anchor point for the blit operation.
  • src: The source rectangle to blit from.

blit(pixel_array: PixelArray, dst: Rect, src: Rect = None) None

Blit another pixel array onto this one via destination and source rectangles.

Parameters

  • pixel_array: The pixel array to blit onto this one.
  • dst: The destination rectangle to blit to.
  • src: The source rectangle to blit from.

Get Rect

get_rect() Rect

Get the rectangle representing the pixel array's dimensions.

Returns

Rect : The pixel array's rectangle.

Get At

get_at(pos: Vec2) Color

Get the color of the pixel at the specified position.

Parameters

  • pos : The position of the pixel to get the color of.

Returns

Color : The color of the pixel at the specified position.

Set At

set_at(pos: Vec2, color: Color) None

Set the color of the pixel at the specified position.

Parameters

  • pos : The position of the pixel to set the color of.
  • color : The color to set the pixel to.

Copy

copy() PixelArray

Create a copy of the pixel array.

Returns

PixelArray : A new pixel array object that is a copy of the original.