Skip to content

Commit e908d5e

Browse files
committed
Allow pen function for fast tile alpha blending
1 parent 9124b37 commit e908d5e

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

libraries/pico_graphics/pico_graphics.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,8 @@ namespace pimoroni {
293293
virtual void frame_convert(PenType type, conversion_callback_func callback);
294294
virtual void sprite(void* data, const Point &sprite, const Point &dest, const int scale, const int transparent);
295295

296+
virtual bool render_pico_vector_tile(const Rect &bounds, uint8_t* alpha_data, uint32_t stride, uint8_t alpha_type) { return false; }
297+
296298
void set_font(const bitmap::font_t *font);
297299
void set_font(const hershey::font_t *font);
298300
void set_font(std::string_view name);

libraries/pico_vector/pico_vector.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ namespace pimoroni {
2121
uint8_t *tile_data = tile.data;
2222

2323
if(this->graphics->supports_alpha_blend() && pretty_poly::settings::antialias != pretty_poly::NONE) {
24+
if (this->graphics->render_pico_vector_tile({tile.bounds.x, tile.bounds.y, tile.bounds.w, tile.bounds.h},
25+
tile.data,
26+
tile.stride,
27+
(uint8_t)pretty_poly::settings::antialias)) {
28+
return;
29+
}
2430
for(auto y = 0; y < tile.bounds.h; y++) {
2531
for(auto x = 0; x < tile.bounds.w; x++) {
2632
uint8_t alpha = *tile_data++;

0 commit comments

Comments
 (0)