libtonc
tonc_schr4c.c File Reference
#include "tonc_surface.h"
#include "tonc_video.h"
#include "tonc_math.h"

Macros

#define BLIT_CLIP(_ax, _aw, _w, _bx)
 

Functions

INLINE u32 chr4_lmask (uint left)
 Returns the clear-mask for the left side of a fill rect.
 
INLINE u32 chr4_rmask (uint right)
 Returns the clear-mask for the right side of a fill rect.
 
INLINE void chr4c_plot (int x, int y, u32 clr, void *dstBase, u32 dstP)
 
INLINE void chr4c_colset (u32 *dstD, uint left, uint right, uint height, u32 clr)
 Fill a rectangle inside a simple tile-column.
 
void schr4c_floodfill_internal (const TSurface *dst, int x, int y, u32 clrNew, u32 clrOld)
 Internal routine for floodfill.
 
void schr4c_prep_map (const TSurface *srf, u16 *map, u16 se0)
 Prepare a screen-entry map for use with chr4.
 
u32 * schr4c_get_ptr (const TSurface *srf, int x, int y)
 Special pointer getter for chr4: start of in-tile line.
 
u32 schr4c_get_pixel (const TSurface *src, int x, int y)
 Get the pixel value of src at (x, y).
 
void schr4c_plot (const TSurface *dst, int x, int y, u32 clr)
 Plot a single pixel on a 4bpp tiled surface.
 
void schr4c_hline (const TSurface *dst, int x1, int y, int x2, u32 clr)
 Draw a horizontal line on a 4bpp tiled surface.
 
void schr4c_vline (const TSurface *dst, int x, int y1, int y2, u32 clr)
 Draw a vertical line on a 4bpp tiled surface.
 
void schr4c_line (const TSurface *dst, int x1, int y1, int x2, int y2, u32 clr)
 Draw a line on a 4bpp tiled surface.
 
void schr4c_rect (const TSurface *dst, int left, int top, int right, int bottom, u32 clr)
 Render a rectangle on a 4bpp tiled canvas.
 
void schr4c_frame (const TSurface *dst, int left, int top, int right, int bottom, u32 clr)
 Draw a rectangle on a 4bpp tiled surface.
 
void schr4c_blit (const TSurface *dst, int dstX, int dstY, uint width, uint height, const TSurface *src, int srcX, int srcY)
 Blitter for 4bpp tiled surfaces. Copies a rectangle from one surface to another.
 
void schr4c_floodfill (const TSurface *dst, int x, int y, u32 clr)
 Floodfill an area of the same color with new color clr.
 

Variables

const TSurfaceProcTab chr4c_tab
 

Detailed Description

Author
J Vijn
Date
20080427 - 20080503
Todo:
Code consistency.

Macro Definition Documentation

◆ BLIT_CLIP

#define BLIT_CLIP (   _ax,
  _aw,
  _w,
  _bx 
)
Value:
do { \
if( (_ax) >= (_aw) || (_ax)+(_w) <= 0 ) \
return; \
if( (_ax)<0 ) \
{ _w += (_ax); _bx += (_ax); _ax= 0; } \
if( (_w) > (_aw)-(_ax) ) \
_w = (_aw)-(_ax); \
} while(0)

Function Documentation

◆ chr4c_colset()

INLINE void chr4c_colset ( u32 *  dstD,
uint  left,
uint  right,
uint  height,
u32  clr 
)

Fill a rectangle inside a simple tile-column.

Note
left and right must already be between 0 and 8.

References chr4_lmask(), and chr4_rmask().

Referenced by schr4c_rect().

◆ schr4c_floodfill_internal()

void schr4c_floodfill_internal ( const TSurface *  dst,
int  x,
int  y,
u32  clrNew,
u32  clrOld 
)

Internal routine for floodfill.

Note
This traverses the lines horizontally. Amazingly, this seems faster than vertically.

References _schr4c_get_pixel(), schr4c_floodfill_internal(), and schr4c_hline().

Referenced by schr4c_floodfill(), and schr4c_floodfill_internal().

Variable Documentation

◆ chr4c_tab

const TSurfaceProcTab chr4c_tab
Initial value:
=
{
"chr4c",
}
u32 schr4c_get_pixel(const TSurface *src, int x, int y)
Get the pixel value of src at (x, y).
Definition tonc_schr4c.c:121
void schr4c_hline(const TSurface *dst, int x1, int y, int x2, u32 clr)
Draw a horizontal line on a 4bpp tiled surface.
Definition tonc_schr4c.c:156
void schr4c_blit(const TSurface *dst, int dstX, int dstY, uint width, uint height, const TSurface *src, int srcX, int srcY)
Blitter for 4bpp tiled surfaces. Copies a rectangle from one surface to another.
Definition tonc_schr4c.c:417
void schr4c_plot(const TSurface *dst, int x, int y, u32 clr)
Plot a single pixel on a 4bpp tiled surface.
Definition tonc_schr4c.c:138
void schr4c_line(const TSurface *dst, int x1, int y1, int x2, int y2, u32 clr)
Draw a line on a 4bpp tiled surface.
Definition tonc_schr4c.c:240
void schr4c_frame(const TSurface *dst, int left, int top, int right, int bottom, u32 clr)
Draw a rectangle on a 4bpp tiled surface.
Definition tonc_schr4c.c:382
void schr4c_floodfill(const TSurface *dst, int x, int y, u32 clr)
Floodfill an area of the same color with new color clr.
Definition tonc_schr4c.c:548
void schr4c_vline(const TSurface *dst, int x, int y1, int y2, u32 clr)
Draw a vertical line on a 4bpp tiled surface.
Definition tonc_schr4c.c:211
void schr4c_rect(const TSurface *dst, int left, int top, int right, int bottom, u32 clr)
Render a rectangle on a 4bpp tiled canvas.
Definition tonc_schr4c.c:319