GrafX2 2.9.3227
The ultimate 256-color painting program
gfx2surface.h File Reference

Memory representation of a 8bits picture. More...

#include "struct.h"
+ Include dependency graph for gfx2surface.h:
+ This graph shows which files directly or indirectly include this file:

Data Structures

struct  T_GFX2_Surface
 to load 256 color pictures into memory More...
 

Functions

T_GFX2_SurfaceNew_GFX2_Surface (word width, word height)
 Allocate a new surface. More...
 
void Free_GFX2_Surface (T_GFX2_Surface *surface)
 Free the surface object and the associated pixel data. More...
 
byte Get_GFX2_Surface_pixel (const T_GFX2_Surface *surface, int x, int y)
 Retrieve a pixel value. More...
 
void Set_GFX2_Surface_pixel (T_GFX2_Surface *surface, int x, int y, byte value)
 Set a pixel. More...
 

Detailed Description

Memory representation of a 8bits picture.

Function Documentation

◆ New_GFX2_Surface()

T_GFX2_Surface * New_GFX2_Surface ( word  width,
word  height 
)

Allocate a new surface.

Parameters
width,heightdimension of the new surface. Cannot be 0
Returns
the new surface
NULL in case of error

References GFX2_malloc, T_GFX2_Surface::h, NULL, T_GFX2_Surface::palette, T_GFX2_Surface::pixels, and T_GFX2_Surface::w.

Referenced by GFX2_Set_mode(), Pre_load(), and Render_text_SFont().

◆ Free_GFX2_Surface()

void Free_GFX2_Surface ( T_GFX2_Surface surface)

Free the surface object and the associated pixel data.

Parameters
surfaceThe surface to free

References T_GFX2_Surface::pixels.

Referenced by Load_font(), Load_graphics(), Pre_load(), Render_text_SFont(), SFont_FreeFont(), Test_C64_Formats(), Test_Load(), and Test_Save().

◆ Get_GFX2_Surface_pixel()

byte Get_GFX2_Surface_pixel ( const T_GFX2_Surface surface,
int  x,
int  y 
)

Retrieve a pixel value.

Parameters
surfaceThe surface to access
x,ythe coordinate of the pixel to read
Returns
the pixel 8 bits value
0 for out of bound access

References GFX2_Log(), GFX2_WARNING, T_GFX2_Surface::h, NULL, T_GFX2_Surface::pixels, and T_GFX2_Surface::w.

Referenced by GUI_seek_down(), GUI_seek_right(), Parse_font(), Parse_skin(), Read_GUI_block(), and SFont_InitFont().

◆ Set_GFX2_Surface_pixel()

void Set_GFX2_Surface_pixel ( T_GFX2_Surface surface,
int  x,
int  y,
byte  value 
)

Set a pixel.

Nothing is done if the coordinates are out of bound.

Parameters
surfaceThe surface to access
x,ythe coordinate of the pixel to write
valuethe 8 bits pixel value

References GFX2_Log(), GFX2_WARNING, T_GFX2_Surface::h, NULL, T_GFX2_Surface::pixels, and T_GFX2_Surface::w.

Referenced by Set_pixel().