sge::texture::part_unique_ptr sge::font::draw::create_texture( sge::renderer::device::core &_renderer, sge::font::text &_text, sge::image::color::format const _color_format, sge::renderer::texture::emulate_srgb const _emulate_srgb ) { sge::texture::part_unique_ptr result( sge::texture::wrap_npot( _renderer, sge::renderer::texture::planar_parameters( fcppt::math::dim::structure_cast< sge::renderer::dim2, fcppt::cast::size_fun >( fcppt::math::dim::to_unsigned( _text.rect().size() ) ), sge::renderer::texture::color_format( _color_format, _emulate_srgb ), sge::renderer::texture::mipmap::off(), sge::renderer::resource_flags_field::null(), sge::renderer::texture::capabilities_field::null() ) ) ); if( fcppt::math::dim::contents( result->size() ) != 0u ) { sge::renderer::texture::scoped_planar_lock const lock( result->texture(), sge::renderer::lock_mode::writeonly ); _text.render( lock.value() ); } return result; }
void sge::graph::object::render( sge::renderer::context::ffp &_context) { { sge::renderer::texture::scoped_planar_lock const lock( *texture_, sge::renderer::lock_mode::writeonly); fcppt::variant::apply_unary( sge::graph::detail::draw_visitor( *this), lock.value().get()); } sge::sprite::process::one( _context, sprite_object_, sprite_buffers_, sprite_state_ ); }
sge::graph::object::object( sge::graph::position const &_position, sge::renderer::dim2 const &_dim, sge::renderer::device::ffp &_renderer, sge::graph::baseline _baseline, sge::graph::optional_axis_constraint const &_axis_constraint, sge::graph::color_scheme const &_color_scheme ) : dim_( _dim), texture_( _renderer.create_planar_texture( sge::renderer::texture::planar_parameters( _dim, sge::renderer::texture::color_format( sge::image::color::format::rgba8, sge::renderer::texture::emulate_srgb::no ), sge::renderer::texture::mipmap::off(), sge::renderer::resource_flags_field::null(), sge::renderer::texture::capabilities_field( sge::renderer::texture::capabilities_field::null() ) ) ) ), sprite_object_{ sge::sprite::roles::pos{} = fcppt::math::vector::structure_cast< sprite_object::vector, fcppt::cast::float_to_int_fun >( _position.get() ), sge::sprite::roles::texture0{} = sprite_object::texture_type{ fcppt::make_shared_ptr< sge::texture::part_raw_ref >( *texture_ ) } }, sprite_buffers_( _renderer, sge::sprite::buffers::option::dynamic ), sprite_state_( _renderer, sprite_state_parameters() ), data_buffer_( dim_.w()), baseline_( _baseline.get()), color_scheme_( _color_scheme), axis_constraint_( _axis_constraint), current_min_( std::min( 0., baseline_) ), current_max_( 1. + std::max( current_min_, baseline_) ) { sge::renderer::texture::scoped_planar_lock const lock( *texture_, sge::renderer::lock_mode::writeonly); fcppt::variant::apply_unary( sge::graph::detail::draw_visitor( *this), lock.value().get()); }