HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
Public Member Functions | Friends
tt::draw_context Class Reference

#include <ttauri/GFX/draw_context.hpp>

Public Member Functions

 draw_context (draw_context const &rhs) noexcept=default
 
 draw_context (draw_context &&rhs) noexcept=default
 
draw_contextoperator= (draw_context const &rhs) noexcept=default
 
draw_contextoperator= (draw_context &&rhs) noexcept=default
 
 draw_context (gfx_device_vulkan &device, size_t frame_buffer_index, extent2 surface_size, aarectangle scissor_rectangle, vspan< pipeline_box::vertex > &boxVertices, vspan< pipeline_image::vertex > &imageVertices, vspan< pipeline_SDF::vertex > &sdfVertices) noexcept
 
draw_context make_child_context (matrix3 parent_to_local, matrix3 local_to_window, aarectangle clipping_rectangle) const noexcept
 
size_t frame_buffer_index () const noexcept
 
aarectangle scissor_rectangle () const noexcept
 
aarectangle clipping_rectangle () const noexcept
 
void set_clipping_rectangle (aarectangle clipping_rectangle) noexcept
 
matrix3 transform () const noexcept
 
gfx_devicedevice () const noexcept
 
void draw_box (rectangle box, color fill_color, color line_color, float line_width=1.0, tt::corner_shapes corner_shapes=tt::corner_shapes{}) const noexcept
 Draw an axis aligned box This function will draw the given box.
 
void draw_box (rectangle box, color fill_color, color line_color, tt::corner_shapes corner_shapes) const noexcept
 
void draw_box (rectangle box, color fill_color, tt::corner_shapes corner_shapes) const noexcept
 
void draw_box (rectangle box, color fill_color) const noexcept
 
void draw_box_with_border_inside (rectangle rectangle, color fill_color, color line_color, float line_width=1.0, tt::corner_shapes corner_shapes=tt::corner_shapes{}) const noexcept
 Draw an axis aligned box This function will shrink to include the size of the border inside the given rectangle.
 
void draw_box_with_border_inside (rectangle rectangle, color fill_color, color line_color, tt::corner_shapes corner_shapes) const noexcept
 
void draw_box_with_border_outside (rectangle rectangle, color fill_color, color line_color, float line_width=1.0, tt::corner_shapes corner_shapes=tt::corner_shapes{}) const noexcept
 Draw an axis aligned box This function will expand to include the size of the border outside the given rectangle.
 
void draw_box_with_border_outside (rectangle rectangle, color fill_color, color line_color, tt::corner_shapes corner_shapes) const noexcept
 
void draw_image (pipeline_image::image &image, matrix3 image_transform) const noexcept
 Draw an image This function will draw an image.
 
void draw_text (shaped_text const &text, std::optional< color > text_color={}, matrix3 transform=geo::identity{}) const noexcept
 Draw shaped text.
 
void draw_glyph (font_glyph_ids const &glyph, float glyph_size, rectangle box, color text_color) const noexcept
 Draw a glyph.
 

Friends

bool overlaps (draw_context const &context, aarectangle const &rectangle) noexcept
 

Detailed Description

Draw context for drawing using the TTauri shaders.

Member Function Documentation

◆ draw_box()

void tt::draw_context::draw_box ( rectangle box,
color fill_color,
color line_color,
float line_width = 1.0,
tt::corner_shapes corner_shapes = tt::corner_shapes{} ) const
noexcept

Draw an axis aligned box This function will draw the given box.

This will use the current:

  • transform, to transform the opposite corner (rotation is not recommended).
  • clippingRectangle
  • fill_color
  • borderSize
  • border_color
  • shadowSize
  • cornerShapes

◆ draw_box_with_border_inside()

void tt::draw_context::draw_box_with_border_inside ( rectangle rectangle,
color fill_color,
color line_color,
float line_width = 1.0,
tt::corner_shapes corner_shapes = tt::corner_shapes{} ) const
noexcept

Draw an axis aligned box This function will shrink to include the size of the border inside the given rectangle.

This will make the border be drawn sharply.

This will also adjust rounded corners to the shrunk box.

This function will draw the given box. This will use the current:

  • transform, to transform the opposite corner (rotation is not recommended).
  • clipping_rectangle
  • fill_color
  • border_size
  • border_color
  • corner_shapes

◆ draw_box_with_border_outside()

void tt::draw_context::draw_box_with_border_outside ( rectangle rectangle,
color fill_color,
color line_color,
float line_width = 1.0,
tt::corner_shapes corner_shapes = tt::corner_shapes{} ) const
noexcept

Draw an axis aligned box This function will expand to include the size of the border outside the given rectangle.

This will make the border be drawn sharply.

This will also adjust rounded corners to the shrunk box.

This function will draw the given box. This will use the current:

  • transform, to transform the opposite corner (rotation is not recommended).
  • clippingRectangle
  • fill_color
  • borderSize
  • border_color
  • shadowSize
  • cornerShapes

◆ draw_glyph()

void tt::draw_context::draw_glyph ( font_glyph_ids const & glyph,
float glyph_size,
rectangle box,
color text_color ) const
noexcept

Draw a glyph.

Parameters
glyphThe glyphs to draw.
glyph_sizeThe scale with which the glyph is being drawn.
boxThe size and position of the glyph. The size must be the size of the bounding box of the glyph multiplied by glyph_size.
text_colorThe color that the glyph should be drawn in.

◆ draw_image()

void tt::draw_context::draw_image ( pipeline_image::image & image,
matrix3 image_transform ) const
noexcept

Draw an image This function will draw an image.

This will use the current:

  • transform, to transform the image.
  • clippingRectangle

◆ draw_text()

void tt::draw_context::draw_text ( shaped_text const & text,
std::optional< color > text_color = {},
matrix3 transform = geo::identity{} ) const
noexcept

Draw shaped text.

This function will draw the shaped text. The SDF-image-atlas needs to be prepared ahead of time. This will use the current:

  • transform, to transform the shaped-text's bounding box
  • clippingRectangle
Parameters
textThe shaped text to draw.
useContextColorWhen true display the text in the context's color, if false use text style color

The documentation for this class was generated from the following file: