10#include "gui_device_vulkan.hpp"
11#include "gui_window.hpp"
13#include "pipeline_image_image.hpp"
14#include "pipeline_flat_device_shared.hpp"
15#include "pipeline_box_device_shared.hpp"
16#include "pipeline_image_device_shared.hpp"
17#include "pipeline_SDF_device_shared.hpp"
18#include "pipeline_flat_vertex.hpp"
19#include "pipeline_box_vertex.hpp"
20#include "pipeline_image_vertex.hpp"
21#include "pipeline_SDF_vertex.hpp"
22#include "../numeric_array.hpp"
23#include "../aarect.hpp"
24#include "../vspan.hpp"
25#include "../text/shaped_text.hpp"
26#include "../color/color.hpp"
78 _scissor_rectangle(scissor_rectangle),
79 _flat_vertices(&flatVertices),
80 _box_vertices(&boxVertices),
81 _image_vertices(&imageVertices),
82 _sdf_vertices(&sdfVertices),
89 _flat_vertices->clear();
90 _box_vertices->clear();
91 _image_vertices->clear();
92 _sdf_vertices->clear();
95 draw_context(draw_context
const &rhs)
noexcept =
default;
96 draw_context(draw_context &&rhs)
noexcept =
default;
97 draw_context &operator=(draw_context
const &rhs)
noexcept =
default;
98 draw_context &operator=(draw_context &&rhs)
noexcept =
default;
99 ~draw_context() =
default;
101 gui_window &window() const noexcept
107 gui_device &device() const noexcept
109 auto device = window().device();
123 tt_axiom(_flat_vertices !=
nullptr);
139 draw_filled_quad(r.corner<0>(), r.corner<1>(), r.corner<2>(), r.corner<3>());
155 tt_axiom(_box_vertices !=
nullptr);
157 pipeline_box::device_shared::placeVertices(
178 tt_axiom(_box_vertices !=
nullptr);
182 ttlet new_rectangle = shrink(rectangle, shrink_value);
184 ttlet new_corner_shapes =
190 pipeline_box::device_shared::placeVertices(
212 tt_axiom(_box_vertices !=
nullptr);
216 ttlet new_rectangle = expand(rectangle, shrink_value);
218 ttlet new_corner_shapes =
224 pipeline_box::device_shared::placeVertices(
236 tt_axiom(_image_vertices !=
nullptr);
253 tt_axiom(_sdf_vertices !=
nullptr);
255 if (useContextColor) {
256 narrow_cast<gui_device_vulkan &>(device()).SDFPipeline->placeVertices(
259 narrow_cast<gui_device_vulkan &>(device()).SDFPipeline->placeVertices(
266 tt_axiom(_sdf_vertices !=
nullptr);
268 narrow_cast<gui_device_vulkan &>(device()).SDFPipeline->placeVertices(
272 [[nodiscard]]
friend bool overlaps(draw_context
const &context, aarect
const &rectangle)
noexcept
274 return overlaps(context._scissor_rectangle, rectangle);
280 aarect _scissor_rectangle;
282 vspan<pipeline_flat::vertex> *_flat_vertices;
283 vspan<pipeline_box::vertex> *_box_vertices;
284 vspan<pipeline_image::vertex> *_image_vertices;
285 vspan<pipeline_SDF::vertex> *_sdf_vertices;
This is a RGBA floating point color.
Definition color.hpp:39
Definition identity.hpp:11
Draw context for drawing using the TTauri shaders.
Definition draw_context.hpp:33
void draw_text(shaped_text const &text, bool useContextColor=false) const noexcept
Draw shaped text.
Definition draw_context.hpp:251
void draw_filled_quad(aarect r) const noexcept
Draw a rectangle of one color.
Definition draw_context.hpp:137
void draw_filled_quad(f32x4 p1, f32x4 p2, f32x4 p3, f32x4 p4) const noexcept
Draw a polygon with four corners of one color.
Definition draw_context.hpp:121
aarect clipping_rectangle
The clipping rectangle when drawing.
Definition draw_context.hpp:62
void draw_box_with_border_inside(aarect rectangle) const noexcept
Draw an axis aligned box This function will shrink to include the size of the border inside the given...
Definition draw_context.hpp:176
color line_color
Foreground color.
Definition draw_context.hpp:36
matrix3 transform
Transform used on the given coordinates.
Definition draw_context.hpp:68
void draw_box(aarect box) const noexcept
Draw an axis aligned box This function will draw the given box.
Definition draw_context.hpp:153
void draw_box_with_border_outside(aarect rectangle) const noexcept
Draw an axis aligned box This function will expand to include the size of the border outside the give...
Definition draw_context.hpp:210
void draw_image(pipeline_image::Image &image) const noexcept
Draw an image This function will draw an image.
Definition draw_context.hpp:234
float line_width
Size of lines.
Definition draw_context.hpp:42
color fill_color
Fill color.
Definition draw_context.hpp:39
f32x4 corner_shapes
Shape of the corners of a box.
Definition draw_context.hpp:56
Definition gui_window.hpp:39
This is a image that is uploaded into the texture atlas.
Definition pipeline_image_image.hpp:30
Definition font_glyph_ids.hpp:78
shaped_text represent a piece of text shaped to be displayed.
Definition shaped_text.hpp:22