Mercurial > octave-nkf
comparison src/graphics.cc @ 14413:4f160344236a
2011-04-26 Daniel Wagenaar <daw@caltech.edu>
* graphics.cc: Modified the text::properties::get_extent method
to return correct (x0,y0,w,h). Added FIXME comment to
text::properties::get_extent_matrix method, and general comments
to text::properties::update_text_extent method.
author | Ben Abbott <bpabbott@mac.com> |
---|---|
date | Sat, 25 Feb 2012 19:33:28 -0500 |
parents | e41e538e9d03 |
children | eff4a5933e28 |
comparison
equal
deleted
inserted
replaced
14412:c4a2eac243b4 | 14413:4f160344236a |
---|---|
6880 } | 6880 } |
6881 | 6881 |
6882 Matrix | 6882 Matrix |
6883 text::properties::get_extent_matrix (void) const | 6883 text::properties::get_extent_matrix (void) const |
6884 { | 6884 { |
6885 // FIXME: Should this function also add the (x,y) base position? | |
6885 return extent.get ().matrix_value (); | 6886 return extent.get ().matrix_value (); |
6886 } | 6887 } |
6887 | 6888 |
6888 octave_value | 6889 octave_value |
6889 text::properties::get_extent (void) const | 6890 text::properties::get_extent (void) const |
6890 { | 6891 { |
6892 // FIXME: This doesn't work right for 3D plots. | |
6893 // (It doesn't in Matlab either, at least not in version 6.5.) | |
6891 Matrix m = extent.get ().matrix_value (); | 6894 Matrix m = extent.get ().matrix_value (); |
6895 Matrix pos = get_position ().matrix_value (); | |
6896 Matrix p = convert_text_position (pos, *this, get_units (), "pixels"); | |
6897 | |
6898 m(0) += p(0); | |
6899 m(1) += p(1); | |
6892 | 6900 |
6893 return convert_text_position (m, *this, "pixels", get_units ()); | 6901 return convert_text_position (m, *this, "pixels", get_units ()); |
6894 } | 6902 } |
6895 | 6903 |
6896 void | 6904 void |
6934 | 6942 |
6935 string_vector sv = string_prop.all_strings (); | 6943 string_vector sv = string_prop.all_strings (); |
6936 | 6944 |
6937 renderer.text_to_pixels (sv.join ("\n"), pixels, bbox, | 6945 renderer.text_to_pixels (sv.join ("\n"), pixels, bbox, |
6938 halign, valign, get_rotation ()); | 6946 halign, valign, get_rotation ()); |
6947 /* The bbox is relative to the text's position. | |
6948 We'll leave it that way, because get_position() does not return | |
6949 valid results when the text is first constructed. | |
6950 Conversion to proper coordinates is performed in get_extent. */ | |
6939 set_extent (bbox); | 6951 set_extent (bbox); |
6940 | 6952 |
6941 #endif | 6953 #endif |
6942 | 6954 |
6943 if (autopos_tag_is ("xlabel") || autopos_tag_is ("ylabel") || | 6955 if (autopos_tag_is ("xlabel") || autopos_tag_is ("ylabel") || |