View: provide the transform between different coordinate spaces

There's currently no way for an application to convert between view and
drawing coordinates with a drawing states stack without keeping track of
all the transformations itself, which is not very convenient for helper
or library functions.

Handle other spaces too, for good measure.

Change-Id: Ic8404a1c111e273fff1eebf2f9f59f58246b796c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5775
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
Máximo Castañeda
2022-11-13 04:04:30 +00:00
committed by waddlesplash
parent 423e3645e1
commit 241f109ccb
7 changed files with 199 additions and 4 deletions
+6
View File
@@ -45,6 +45,7 @@ enum {
B_VIEW_WHICH_VIEW_COLOR_BIT = 0x00100000,
B_VIEW_WHICH_LOW_COLOR_BIT = 0x00200000,
B_VIEW_WHICH_HIGH_COLOR_BIT = 0x00400000,
B_VIEW_PARENT_COMPOSITE_BIT = 0x00800000,
B_VIEW_ALL_BITS = 0x00ffffff,
@@ -131,6 +132,11 @@ class ViewState {
float scale;
BAffineTransform transform;
// composite transformation stack
BPoint parent_composite_origin;
float parent_composite_scale;
BAffineTransform parent_composite_transform;
// line modes
join_mode line_join;
cap_mode line_cap;