A draw command recorded from JS for replay in paint(). More...
#include <canvas_widget.hpp>
Public Attributes | |
| Type | type = Type::clear |
| float | x = 0 |
| float | y = 0 |
| float | w = 0 |
| float | h = 0 |
| float | x2 = 0 |
| float | y2 = 0 |
| float | x3 = 0 |
| float | y3 = 0 |
| canvas::Color | color {255, 255, 255, 255} |
| float | extra = 0 |
| std::string | text |
| std::string | shader_sksl |
| std::vector< canvas::Canvas::NamedUniform > | shader_uniforms |
| std::optional< canvas::Canvas::ShaderGeometry > | shader_geometry |
| int | int_val = 0 |
| std::vector< canvas::Color > | gradient_colors |
| std::vector< float > | gradient_positions |
| bool | use_active_style = false |
| When true on a fill_rect / stroke_rect cmd, the paint loop must NOT call set_fill_color / set_stroke_color from color before drawing. | |
| bool | has_source_rect = false |
| When true on a draw_image cmd, x2/y2/x3/y3 carry the source rect (sx, sy, sw, sh) for the 9-arg ctx.drawImage(img, sx,sy,sw,sh, dx,dy,dw,dh) form. | |
A draw command recorded from JS for replay in paint().
Maps to CanvasRenderingContext2D methods.
|
strong |
| Enumerator | |
|---|---|
| fill_rect | |
| stroke_rect | |
| fill_rounded_rect | |
| stroke_rounded_rect | |
| fill_circle | |
| stroke_circle | |
| stroke_line | |
| stroke_arc | |
| fill_text | |
| set_font | |
| set_text_align | |
| set_text_baseline | |
| stroke_text | |
| set_font_full | |
| set_fill_color | |
| set_stroke_color | |
| set_line_width | |
| set_line_cap | |
| set_line_join | |
| set_global_alpha | |
| set_blend_mode | |
| set_fill_gradient_linear | |
| set_fill_gradient_radial | |
| clear_fill_gradient | |
| set_fill_gradient_radial_two_circles | Canvas2D ctx.createRadialGradient(x0,y0,r0,x1,y1,r1) two-circle form. Inner circle (x0,y0,r0) packed as (x, y, extra), outer circle (x1,y1,r1) packed as (x2, y2, w). Routes to set_fill_gradient_radial_two_circles (Skia: MakeTwoPointConical; CG: full CGContextDrawRadialGradient with both circles). |
| set_fill_gradient_conic | |
| set_stroke_gradient_linear | |
| set_stroke_gradient_radial | |
| set_stroke_gradient_radial_two_circles | |
| set_stroke_gradient_conic | |
| clear_stroke_gradient | |
| set_fill_pattern | |
| set_stroke_pattern | |
| begin_path | |
| move_to | |
| line_to | |
| quad_to | |
| cubic_to | |
| close_path | |
| fill_path | |
| stroke_path | |
| clip_path | |
| path_arc | |
| path_arc_to | |
| path_ellipse | |
| path_round_rect | |
| save | |
| restore | |
| translate | |
| scale | |
| rotate | |
| clip_rect | |
| set_transform | |
| clip | |
| draw_image | |
| draw_sdf | |
| set_line_dash | pattern in gradient_positions, phase in extra |
| put_image_data | RGBA pixels in text (binary), int_val=width, x2=height (as int). |
| set_shadow_color | color in color |
| set_shadow_blur | blur (px) in extra |
| set_shadow_offset_x | dx (px) in extra |
| set_shadow_offset_y | dy (px) in extra |
| set_miter_limit | limit in extra |
| set_image_smoothing | enabled in int_val (0/1), quality in extra (0=low,1=med,2=high) |
| set_direction | |
| set_filter | |
| clear | |
| clear_rect | |
| replay_group | |
| canvas::Color pulp::view::CanvasDrawCmd::color {255, 255, 255, 255} |
| float pulp::view::CanvasDrawCmd::extra = 0 |
| std::vector<canvas::Color> pulp::view::CanvasDrawCmd::gradient_colors |
| std::vector<float> pulp::view::CanvasDrawCmd::gradient_positions |
| float pulp::view::CanvasDrawCmd::h = 0 |
| bool pulp::view::CanvasDrawCmd::has_source_rect = false |
When true on a draw_image cmd, x2/y2/x3/y3 carry the source rect (sx, sy, sw, sh) for the 9-arg ctx.drawImage(img, sx,sy,sw,sh, dx,dy,dw,dh) form.
The renderer routes through Canvas::draw_image_from_*_rect so the source sub-rectangle of the decoded image maps onto the destination rect (sprite-sheet slicing). Without the flag the dst-only path runs.
| int pulp::view::CanvasDrawCmd::int_val = 0 |
| std::optional<canvas::Canvas::ShaderGeometry> pulp::view::CanvasDrawCmd::shader_geometry |
| std::string pulp::view::CanvasDrawCmd::shader_sksl |
| std::vector<canvas::Canvas::NamedUniform> pulp::view::CanvasDrawCmd::shader_uniforms |
| std::string pulp::view::CanvasDrawCmd::text |
| Type pulp::view::CanvasDrawCmd::type = Type::clear |
| bool pulp::view::CanvasDrawCmd::use_active_style = false |
When true on a fill_rect / stroke_rect cmd, the paint loop must NOT call set_fill_color / set_stroke_color from color before drawing.
The most recent set_fill_color, set_stroke_color, or set_fill_gradient_* on the underlying canvas stays active. Bridge sets this when the JS caller omitted the color arg (e.g. canvasRect(id, x, y, w, h) — Canvas2D ctx.fillRect() shim that relies on a previously-set ctx.fillStyle, including gradients).
| float pulp::view::CanvasDrawCmd::w = 0 |
| float pulp::view::CanvasDrawCmd::x = 0 |
| float pulp::view::CanvasDrawCmd::x2 = 0 |
| float pulp::view::CanvasDrawCmd::x3 = 0 |
| float pulp::view::CanvasDrawCmd::y = 0 |
| float pulp::view::CanvasDrawCmd::y2 = 0 |
| float pulp::view::CanvasDrawCmd::y3 = 0 |