20 #ifndef FASTUIDRAW_PAINTER_BRUSH_HPP 21 #define FASTUIDRAW_PAINTER_BRUSH_HPP 111 repeat_window_x_spread_type_bit0,
319 m_data.m_color = pcolor;
345 m_data.m_color =
color;
353 color(
float r,
float g,
float b,
float a = 1.0f)
364 return m_data.m_color;
413 const vec2 &start_p,
const vec2 &end_p,
416 m_data.m_gradient.linear_gradient(cs, start_p, end_p);
417 update_gradient_bits(spread);
433 const vec2 &start_p,
float start_r,
434 const vec2 &end_p,
float end_r,
437 m_data.m_gradient.radial_gradient(cs, start_p, start_r, end_p, end_r);
438 update_gradient_bits(spread);
458 m_data.m_gradient.radial_gradient(cs, p, 0.0f, p, r);
459 update_gradient_bits(spread);
477 const vec2 &p,
float theta,
float F,
480 m_data.m_gradient.sweep_gradient(cs, p, theta, F);
481 update_gradient_bits(spread);
502 const vec2 &p,
float theta,
507 m_data.m_gradient.sweep_gradient(cs, p, theta, orientation,
508 rotation_orientation, F);
509 update_gradient_bits(spread);
532 const vec2 &p,
float theta,
537 m_data.m_gradient.sweep_gradient(cs, p, theta, orientation,
538 rotation_orientation);
539 update_gradient_bits(spread);
549 m_data.m_gradient.reset();
560 return m_data.m_gradient.type();
570 m_data.m_transformation_p = p;
581 return m_data.m_transformation_p;
591 m_data.m_transformation_matrix = m;
602 return m_data.m_transformation_matrix;
613 m_data.m_transformation_matrix = m_data.m_transformation_matrix * m;
626 m_data.m_transformation_matrix(0, 0) *= sx;
627 m_data.m_transformation_matrix(1, 0) *= sx;
628 m_data.m_transformation_matrix(0, 1) *= sy;
629 m_data.m_transformation_matrix(1, 1) *= sy;
659 m_data.m_transformation_p += m_data.m_transformation_matrix * p;
685 m_data.m_transformation_p =
vec2(0.0f, 0.0f);
696 m_data.m_transformation_matrix =
float2x2();
723 m_data.m_window_position = pos;
724 m_data.m_window_size = size;
727 m_data.m_features_raw |=
pack_bits(repeat_window_x_spread_type_bit0,
730 m_data.m_features_raw |=
pack_bits(repeat_window_y_spread_type_bit0,
744 *pos = m_data.m_window_position;
745 *size = m_data.m_window_size;
760 m_data.m_features_raw);
775 m_data.m_features_raw);
823 return m_data.m_image.image();
834 return m_data.m_gradient.color_stops();
846 dst[0] = m_data.m_image.image();
847 dst[1] = m_data.m_gradient.color_stops();
859 return m_data.m_image.bind_images();
868 m_color(1.0f, 1.0f, 1.0f, 1.0f),
869 m_window_position(0.0f, 0.0f),
870 m_window_size(1.0f, 1.0f),
871 m_transformation_matrix(),
872 m_transformation_p(0.0f, 0.0f)
875 uint32_t m_features_raw;
879 vec2 m_window_position, m_window_size;
881 vec2 m_transformation_p;
887 uint32_t gradient_bits;
889 gradient_bits = (m_data.m_gradient.type() !=
gradient_non) ?
897 m_data.m_features_raw |= gradient_bits;
file painter_image_brush_shader.hpp
static uint32_t sub_shader_id(enum spread_type_t, enum gradient_type_t)
#define FASTUIDRAW_MASK(BIT0, NUMBITS)
transformation_translation_offset_t
Enumeration that provides offset from the start of repeat transformation translation to data for the ...
uint32_t unpack_bits(uint32_t bit0, uint32_t num_bits, uint32_t value)
PainterBrush & transformation(const vec2 &p, const float2x2 &m)
PainterBrush & no_image(void)
const reference_counted_ptr< const Image > & image(void) const
PainterBrush & no_transformation(void)
unsigned int data_size(void) const override
PainterBrush & apply_shear(float sx, float sy)
A PainterGradientBrushShaderData defines the PainterBrushShaderData that the shaders of a PainterGrad...
screen_orientation
Enumeration to indicate in what direction the y-coordinate increases.
all classes and functions of FastUIDraw are in the namespace fastuidraw.
uint32_t features(void) const
feature_bits
Enumeration describing the roles of the bits for features().
unsigned int number_resources(void) const override
A wrapper over a pointer to implement reference counting.
PainterBrush & apply_translate(const vec2 &p)
PainterBrush & transformation_matrix(const float2x2 &m)
PainterBrush & radial_gradient(const reference_counted_ptr< const ColorStopSequence > &cs, const vec2 &p, float r, enum spread_type_t spread)
A PainterImageBrushShaderData defines the PainterBrushShaderData that the shaders of a PainterImageBr...
PainterBrush & linear_gradient(const reference_counted_ptr< const ColorStopSequence > &cs, const vec2 &start_p, const vec2 &end_p, enum spread_type_t spread)
PainterBrush & no_transformation_translation(void)
PainterBrush & no_gradient(void)
PainterBrush & operator=(const PainterBrush &obj)
file painter_gradient_brush_shader.hpp
void pack_data(c_array< uvec4 > dst) const override
PainterBrush(const vec4 &pcolor)
PainterBrush & sub_image(const reference_counted_ptr< const Image > &im, uvec2 xy, uvec2 wh, enum filter_t f=filter_linear, enum mipmap_t mipmap_filtering=apply_mipmapping)
matrixNxM< 2, 2, float > float2x2
Convenience typedef to matrixNxM<2, float>
PainterBrush & sweep_gradient(const reference_counted_ptr< const ColorStopSequence > &cs, const vec2 &p, float theta, enum PainterEnums::screen_orientation orientation, enum PainterEnums::rotation_orientation_t rotation_orientation, float F, enum spread_type_t spread)
file painter_shader_data.hpp
file painter_brush_shader_data.hpp
PainterBrush & reset(void)
PainterBrush & color(float r, float g, float b, float a=1.0f)
transformation_matrix_offset_t
Enumeration that provides offset from the start of repeat transformation matrix to data for the trans...
PainterBrush & apply_rotate(float angle)
PainterBrush & no_transformation_matrix(void)
const vec4 & color(void) const
PainterBrush(const PainterBrush &obj)
enum gradient_type_t gradient_type(void) const
Base class to hold custom data for custom brush shaders.
enum spread_type_t repeat_window_y_spread_type(void) const
A c_array is a wrapper over a C pointer with a size parameter to facilitate bounds checking and provi...
PainterBrush & sweep_gradient(const reference_counted_ptr< const ColorStopSequence > &cs, const vec2 &p, float theta, enum PainterEnums::screen_orientation orientation, enum PainterEnums::rotation_orientation_t rotation_orientation, enum spread_type_t spread)
rotation_orientation_t
Enumeration to specify orientation of a rotation.
A PainterBrush defines a brush for painting via Painter.
PainterBrush & transformation_translate(const vec2 &p)
PainterBrush & color(const vec4 &color)
uint32_t pack_bits(uint32_t bit0, uint32_t num_bits, uint32_t value)
bool repeat_window(vec2 *pos, vec2 *size) const
packing_order_t
Enumeration giving the packing order for data of a brush. Each enumeration is an entry and when data ...
enum spread_type_t repeat_window_x_spread_type(void) const
PainterBrush & no_repeat_window(void)
filter_t
Enumeration specifying what filter to apply to an image.
const float2x2 & transformation_matrix(void) const
void save_resources(c_array< reference_counted_ptr< const resource_base > > dst) const override
PainterBrush & apply_matrix(const float2x2 &m)
PainterBrush & sweep_gradient(const reference_counted_ptr< const ColorStopSequence > &cs, const vec2 &p, float theta, float F, enum spread_type_t spread)
PainterBrush & repeat_window(const vec2 &pos, const vec2 &size, enum spread_type_t x_mode=spread_repeat, enum spread_type_t y_mode=spread_repeat)
const vec2 & transformation_translate(void) const
feature_masks
Masks generated from feature_bits, use these masks on the return value of features() to get what feat...
Class to contain various enumerations needed for describing a brush.
header_offset_t
enumerations for offsets to color values
repeat_window_offset_t
Enumeration that provides offset from the start of repeat window packing to data for repeat window da...
PainterBrush & radial_gradient(const reference_counted_ptr< const ColorStopSequence > &cs, const vec2 &start_p, float start_r, const vec2 &end_p, float end_r, enum spread_type_t spread)
c_array< const reference_counted_ptr< const Image > > bind_images(void) const override
const reference_counted_ptr< const ColorStopSequence > & color_stops(void) const
file reference_counted.hpp