Skip to content

Commit

Permalink
Merge pull request #839 from MichaelBell/feature/fast-blend
Browse files Browse the repository at this point in the history
Allow pen function for fast tile alpha blending
  • Loading branch information
Gadgetoid authored Sep 11, 2023
2 parents c045c40 + e908d5e commit 9735402
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions libraries/pico_graphics/pico_graphics.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,8 @@ namespace pimoroni {
virtual void frame_convert(PenType type, conversion_callback_func callback);
virtual void sprite(void* data, const Point &sprite, const Point &dest, const int scale, const int transparent);

virtual bool render_pico_vector_tile(const Rect &bounds, uint8_t* alpha_data, uint32_t stride, uint8_t alpha_type) { return false; }

void set_font(const bitmap::font_t *font);
void set_font(const hershey::font_t *font);
void set_font(std::string_view name);
Expand Down
6 changes: 6 additions & 0 deletions libraries/pico_vector/pico_vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ namespace pimoroni {
uint8_t *tile_data = tile.data;

if(this->graphics->supports_alpha_blend() && pretty_poly::settings::antialias != pretty_poly::NONE) {
if (this->graphics->render_pico_vector_tile({tile.bounds.x, tile.bounds.y, tile.bounds.w, tile.bounds.h},
tile.data,
tile.stride,
(uint8_t)pretty_poly::settings::antialias)) {
return;
}
for(auto y = 0; y < tile.bounds.h; y++) {
for(auto x = 0; x < tile.bounds.w; x++) {
uint8_t alpha = *tile_data++;
Expand Down

0 comments on commit 9735402

Please sign in to comment.