kopia lustrzana https://github.com/pimoroni/pimoroni-pico
PicoVector: Pass PicoGraphics clip into Pretty Poly.
rodzic
c3919bd648
commit
5f730ff400
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
namespace pimoroni {
|
namespace pimoroni {
|
||||||
void PicoVector::polygon(std::vector<pretty_poly::contour_t<picovector_point_type>> contours, Point origin, int scale) {
|
void PicoVector::polygon(std::vector<pretty_poly::contour_t<picovector_point_type>> contours, Point origin, int scale) {
|
||||||
|
pretty_poly::settings::clip = {graphics->clip.x, graphics->clip.y, graphics->clip.w, graphics->clip.h};
|
||||||
pretty_poly::draw_polygon<picovector_point_type>(
|
pretty_poly::draw_polygon<picovector_point_type>(
|
||||||
contours,
|
contours,
|
||||||
pretty_poly::point_t<int>(origin.x, origin.y),
|
pretty_poly::point_t<int>(origin.x, origin.y),
|
||||||
|
@ -50,6 +51,8 @@ namespace pimoroni {
|
||||||
}
|
}
|
||||||
|
|
||||||
Point PicoVector::text(std::string_view text, Point origin) {
|
Point PicoVector::text(std::string_view text, Point origin) {
|
||||||
|
// Copy clipping bounds from the PicoGraphics instance
|
||||||
|
pretty_poly::settings::clip = {graphics->clip.x, graphics->clip.y, graphics->clip.w, graphics->clip.h};
|
||||||
// TODO: Normalize types somehow, so we're not converting?
|
// TODO: Normalize types somehow, so we're not converting?
|
||||||
pretty_poly::point_t<int> caret = pretty_poly::point_t<int>(origin.x, origin.y);
|
pretty_poly::point_t<int> caret = pretty_poly::point_t<int>(origin.x, origin.y);
|
||||||
|
|
||||||
|
@ -109,6 +112,8 @@ namespace pimoroni {
|
||||||
}
|
}
|
||||||
|
|
||||||
Point PicoVector::text(std::string_view text, Point origin, float angle) {
|
Point PicoVector::text(std::string_view text, Point origin, float angle) {
|
||||||
|
// Copy clipping bounds from the PicoGraphics instance
|
||||||
|
pretty_poly::settings::clip = {graphics->clip.x, graphics->clip.y, graphics->clip.w, graphics->clip.h};
|
||||||
// TODO: Normalize types somehow, so we're not converting?
|
// TODO: Normalize types somehow, so we're not converting?
|
||||||
pretty_poly::point_t<float> caret(0, 0);
|
pretty_poly::point_t<float> caret(0, 0);
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ namespace pimoroni {
|
||||||
tile_data += tile.stride - tile.bounds.w;
|
tile_data += tile.stride - tile.bounds.w;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, graphics->supports_alpha_blend() ? pretty_poly::X4 : pretty_poly::NONE, {0, 0, graphics->bounds.w, graphics->bounds.h});
|
}, graphics->supports_alpha_blend() ? pretty_poly::X4 : pretty_poly::NONE, {graphics->clip.x, graphics->clip.y, graphics->clip.w, graphics->clip.h});
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_antialiasing(pretty_poly::antialias_t antialias) {
|
void set_antialiasing(pretty_poly::antialias_t antialias) {
|
||||||
|
|
Ładowanie…
Reference in New Issue