![]() |
GFXprim
2D bitmap graphics library with emphasis on speed and correctness
|
A pattern fill constants. More...
Go to the source code of this file.
Macros | |
#define | GP_PIXEL_PATTERN_CNT 10 |
Number of patterns. | |
#define | GP_PIXEL_PATTERN_MASK 0x0f00 |
Pattern mask. | |
#define | GP_PIXEL_PATTERN_SHIFT 8 |
Pattern shift. | |
#define | GP_PIXEL_PATTERN_FG_MASK 0x000f |
Pattern foreground color mask. | |
#define | GP_PIXEL_PATTERN_FG_SHIFT 0 |
Pattern foreground color shift. | |
#define | GP_PIXEL_PATTERN_BG_MASK 0x00f0 |
Pattern background color mask. | |
#define | GP_PIXEL_PATTERN_BG_SHIFT 4 |
Pattern background color shift. | |
#define | GP_PIXEL_PATTERN_W 4 |
Pattern width. | |
#define | GP_PIXEL_PATTERN_H 4 |
Pattern height. | |
Enumerations | |
enum | gp_pixel_pattern { GP_PIXEL_PATTERN_NONE = 0x00 , GP_PIXEL_PATTERN_50 = 0x01 , GP_PIXEL_PATTERN_ASC_25 = 0x02 , GP_PIXEL_PATTERN_DSC_25 = 0x03 , GP_PIXEL_PATTERN_ASC_75 = 0x04 , GP_PIXEL_PATTERN_DSC_75 = 0x05 , GP_PIXEL_PATTERN_DOTS_12_5 = 0x06 , GP_PIXEL_PATTERN_DOTS_25 = 0x07 , GP_PIXEL_PATTERN_DOTS_75 = 0x08 , GP_PIXEL_PATTERN_DOTS_87_5 = 0x09 } |
Pattern fill constants. More... | |
Functions | |
static enum gp_pixel_pattern | gp_pixel_pattern_get (gp_pixel pixel) |
Returns a pattern for a grayscale pixel. | |
static gp_pixel | gp_pixel_pattern_fg_get (gp_pixel pixel) |
Returns a pattern foreground for a grayscale pixel. | |
static gp_pixel | gp_pixel_pattern_bg_get (gp_pixel pixel) |
Returns a pattern background for a grayscale pixel. | |
static gp_pixel | gp_pixel_pattern (uint8_t fg_color, uint8_t bg_color, enum gp_pixel_pattern pattern) |
Creates a pattern from a colors and pattern type. | |
static uint8_t * | gp_pixel_pattern_lookup_table_get (enum gp_pixel_pattern pattern) |
Returns a pattern lookup table. | |
static gp_pixel | gp_pixel_pattern_pixel_get (uint8_t *lookup, gp_pixel fg, gp_pixel bg, uint8_t x_mod, uint8_t y_mod) |
Looks up a pixel color in a pattern based on x and y offsets. | |
Variables | |
uint8_t * | gp_pixel_pattern_lookup_table [10] |
A pattern lookup tables. | |
A pattern fill constants.
Constants for different fill patterns for 1bpp fill runtines.
Definition in file gp_pattern_fill.h.
#define GP_PIXEL_PATTERN_H 4 |
Pattern height.
All patterns are limited to this height.
Definition at line 301 of file gp_pattern_fill.h.
#define GP_PIXEL_PATTERN_MASK 0x0f00 |
Pattern mask.
After applying a pattern mask on a pixel the value can be compared to the pattern constants.
Definition at line 208 of file gp_pattern_fill.h.
Referenced by gp_pixel_pattern(), and gp_pixel_pattern_get().
#define GP_PIXEL_PATTERN_SHIFT 8 |
Pattern shift.
The pattern value is shifted to the left by this number of bits.
Definition at line 215 of file gp_pattern_fill.h.
Referenced by gp_pixel_pattern(), and gp_pixel_pattern_get().
#define GP_PIXEL_PATTERN_W 4 |
Pattern width.
All patterns are limited to this width.
Definition at line 294 of file gp_pattern_fill.h.
enum gp_pixel_pattern |
Pattern fill constants.
The upper bits enable a pattern and the bottom bit changes the starting offset, i.e. wheter pixel at even address starts as a black or white.
Definition at line 27 of file gp_pattern_fill.h.
|
inlinestatic |
Creates a pattern from a colors and pattern type.
fg_color | A pattern foreground color. |
bg_color | A pattern background color. |
pattern | A pattern. |
Definition at line 279 of file gp_pattern_fill.h.
References GP_PIXEL_PATTERN_BG_MASK, GP_PIXEL_PATTERN_BG_SHIFT, GP_PIXEL_PATTERN_FG_MASK, GP_PIXEL_PATTERN_FG_SHIFT, GP_PIXEL_PATTERN_MASK, and GP_PIXEL_PATTERN_SHIFT.
Returns a pattern background for a grayscale pixel.
@pixel A 1bpp pixel.
Definition at line 265 of file gp_pattern_fill.h.
References GP_PIXEL_PATTERN_BG_MASK, and GP_PIXEL_PATTERN_BG_SHIFT.
Returns a pattern foreground for a grayscale pixel.
@pixel A 1bpp pixel.
Definition at line 254 of file gp_pattern_fill.h.
References GP_PIXEL_PATTERN_FG_MASK, and GP_PIXEL_PATTERN_FG_SHIFT.
|
inlinestatic |
Returns a pattern for a grayscale pixel.
@pixel A 1bpp pixel.
Definition at line 243 of file gp_pattern_fill.h.
References GP_PIXEL_PATTERN_MASK, and GP_PIXEL_PATTERN_SHIFT.
|
inlinestatic |
Returns a pattern lookup table.
The table is then passed down to the gp_pixel_pattern_pixel() function to determine a pixel value at a given coordinates.
pattern | A pixel pattern. |
Definition at line 317 of file gp_pattern_fill.h.
References gp_pixel_pattern_lookup_table.
|
inlinestatic |
Looks up a pixel color in a pattern based on x and y offsets.
lookup | A pattern lookup table. |
fg | A foreground pixel color. |
bg | A background pixel color. |
x_mod | An X offset of the pixel, i.e. x coordinate modulo GP_PIXEL_PATTERN_W. |
y_mod | An Y offset of the pixel, i.e. y coordinate modulo GP_PIXEL_PATTERN_H. |
Definition at line 333 of file gp_pattern_fill.h.