Mercurial > octave
diff libinterp/corefcn/gl-render.h @ 29433:8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
* gl-render.{h,cc} (opengl-renderer::draw_texture_image): New private method
with code extracted from draw_image.
(opengl-renderer::render_text (uint8NDArray ...)): New method to prepare
text rendering and finally call draw_texture_image. Let the existing
render_text(std::string,...) call this one after preparing the pixels array
using text2pixels.
(opengl-renderer::set_ortho_coordinates): New method to setup orthogonal
transform.
(opengl-renderer::restore_previous_coordinates): New method to restore
previous transform.
(opengl-renderer::draw_text): Handle clipping manually for the text as well.
(opengl_texture::create): Add new case for uint8 RGBA image data.
* graphics.{in.h,cc} (text::properties::get_extent_matrix): Add a bool argument
"rotated" that defaults to "false". Re-compute the extent matrix if necessary.
(text::properties::get_extent): Make use of get_extent_matrix.
(text::properties::update_text_extent): Always call text2pixels with 0 degrees
rotation.
* __print_parse_opts__.m: By default, also use the opengl renderer for raster
images that include rotated text.
author | Pantxo Diribarne <pantxo.diribarne@gmail.com> |
---|---|
date | Fri, 12 Mar 2021 20:56:19 +0100 |
parents | 7854d5752dd2 |
children | 91f32bf0d497 |
line wrap: on
line diff
--- a/libinterp/corefcn/gl-render.h Fri Mar 12 19:12:04 2021 +0100 +++ b/libinterp/corefcn/gl-render.h Fri Mar 12 20:56:19 2021 +0100 @@ -183,8 +183,15 @@ | (z > zmax ? 1 : 0) << 5 | (is_nan_or_inf (x, y, z) ? 0 : 1) << 6); } + + void render_text (uint8NDArray pixels, Matrix bbox, + double x, double y, double z, double rotation); + + void set_normal (int bfl_mode, const NDArray& n, int j, int i); - void set_normal (int bfl_mode, const NDArray& n, int j, int i); + void set_ortho_coordinates (void); + + void restore_previous_coordinates (void); double points_to_pixels (const double val) const; @@ -204,6 +211,9 @@ void draw_all_lights (const base_properties& props, std::list<graphics_object>& obj_list); + void draw_texture_image (const octave_value cdata, + Matrix x, Matrix y, bool ortho = false); + protected: opengl_functions& m_glfcns;