28 #ifndef _NANO_GFX_TYPES_H_ 29 #define _NANO_GFX_TYPES_H_ 36 #define lcd_gfx_min(a, b) ((a) < (b) ? (a) : (b)) 41 #define lcd_gfx_max(a, b) ((a) > (b) ? (a) : (b)) 84 void setPos(uint8_t x, uint8_t y);
109 return (((uint8_t)(x - lx) < w) || ((uint8_t)(lx - x) < w)) &&
110 (((uint8_t)(y - ly) < 8) || ((uint8_t)(ly -
y) < 8));
123 uint8_t right = ((x + w - 1) >> 3);
124 uint8_t bottom = ((y + 7) >> 3);
125 uint8_t left = x >> 3;
126 left = left < right ? left : 0;
127 uint8_t top = y >> 3;
128 top = top < bottom ? top : 0;
143 uint8_t right = (uint8_t)(lx + w - 1);
144 uint8_t bottom = (uint8_t)(ly + 7);
145 left = left < right ? left : 0;
146 top = top < bottom ? top : 0;
160 uint8_t right =
lcd_gfx_max((uint8_t)(x + w - 1), (uint8_t)(lx + w - 1));
161 if ( ((uint8_t)(lx + w - 1) < w) && (right > 2 * w) )
163 right = (uint8_t)(lx + w - 1);
165 uint8_t bottom =
lcd_gfx_max((uint8_t)(y + 7), (uint8_t)(ly + 7));
166 if ( ((uint8_t)(ly + 7) < 8) && (bottom > 16) )
168 bottom = (uint8_t)(ly + 7);
180 #endif // _NANO_GFX_TYPES_H_ struct SPRITE SPRITE
SPRITE structure represents logical graphics object.
const uint8_t * data
Pointer to PROGMEM data, representing sprite image.
void eraseTrace()
Clears some sprite parts in old position on the display.
SSD1306 HAL IO communication functions.
void erase()
Clears sprite from the display leaving black rectangle.
#define lcd_gfx_max(a, b)
Macros returning maximum of 2 numbers.
SPRITE structure represents logical graphics object.
Basic structures of canvas gfx library.
void draw()
Draws sprite on the display.
void setPos(uint8_t x, uint8_t y)
Updates active position of the sprite (doesn't redraw it)
uint8_t y
draw position Y on the screen
#define lcd_gfx_min(a, b)
Macros returning minimum of 2 numbers.
SSD1306_RECT getUpdateRect() const
Returns area in 8-pixel blocks, which includes old and new position For example, if sprite pixels coo...
uint8_t x
draw position X on the screen
SSD1306_RECT getRect() const
Returns area in 8-pixel blocks, which is used by the sprite.
uint8_t lx
last draw position X on the screen
bool isNearMove() const
Returns true if sprite is moved not far from previous position, and old and new rects have intersecti...
uint8_t ly
last draw position Y on the screen
SSD1306_RECT getLRect() const
Returns area in 8-pixel blocks, which was used by the sprite last time For example, if sprite pixels coordinates are 10,18 and size is 8x8, the rect will be (left:1,top:2,right:2,bottom:3).