Added WIP support for affine transformations to BViews.
Everything untested, but compiles, so it must work. The idea is to introduce BAffineTransform additionally to the existing Origin and Scale properties of BViews. One may use it in parallel or as an alternative. Painter in app_server is not yet aware of the additional transformation. It is however already used to transform drawing coordinates. It probably needs to work differently, perhaps only in Painter and AGGTextRenderer.
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#define _VIEW_H
|
||||
|
||||
|
||||
#include <AffineTransform.h>
|
||||
#include <Alignment.h>
|
||||
#include <Font.h>
|
||||
#include <Handler.h>
|
||||
@@ -285,6 +286,12 @@ public:
|
||||
void SetOrigin(float x, float y);
|
||||
BPoint Origin() const;
|
||||
|
||||
// Works in addition to Origin and Scale.
|
||||
// May be used in parallel or as a much
|
||||
// more powerful alternative.
|
||||
void SetTransform(BAffineTransform transform);
|
||||
BAffineTransform Transform() const;
|
||||
|
||||
void PushState();
|
||||
void PopState();
|
||||
|
||||
|
||||
@@ -341,6 +341,10 @@ enum {
|
||||
AS_DUMP_ALLOCATOR,
|
||||
AS_DUMP_BITMAPS,
|
||||
|
||||
// transformation in addition to origin/scale
|
||||
AS_VIEW_SET_TRANSFORM,
|
||||
AS_VIEW_GET_TRANSFORM,
|
||||
|
||||
AS_LAST_CODE
|
||||
};
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#define APP_SERVER_PROTOCOL_STRUCTS_H
|
||||
|
||||
|
||||
#include <AffineTransform.h>
|
||||
#include <Rect.h>
|
||||
|
||||
|
||||
@@ -21,6 +22,7 @@ struct ViewSetStateInfo {
|
||||
drawing_mode drawingMode;
|
||||
BPoint origin;
|
||||
float scale;
|
||||
BAffineTransform transform;
|
||||
join_mode lineJoin;
|
||||
cap_mode lineCap;
|
||||
float miterLimit;
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#define _PICTURE_DATA_WRITER_H
|
||||
|
||||
|
||||
#include <AffineTransform.h>
|
||||
#include <InterfaceDefs.h>
|
||||
#include <Font.h>
|
||||
#include <OS.h>
|
||||
@@ -35,6 +36,7 @@ public:
|
||||
status_t WriteSetPenSize(const float &penSize);
|
||||
status_t WriteSetLineMode(const cap_mode &cap, const join_mode &join, const float &miterLimit);
|
||||
status_t WriteSetScale(const float &scale);
|
||||
status_t WriteSetTransform(BAffineTransform transform);
|
||||
status_t WriteSetPattern(const pattern &pat);
|
||||
status_t WriteSetClipping(const BRegion ®ion);
|
||||
status_t WriteClearClipping();
|
||||
|
||||
@@ -2,40 +2,40 @@
|
||||
#define _PICTUREPROTOCOL_H
|
||||
|
||||
enum {
|
||||
B_PIC_MOVE_PEN_BY = 0x0010,
|
||||
B_PIC_MOVE_PEN_BY = 0x0010,
|
||||
|
||||
B_PIC_STROKE_LINE = 0x0100,
|
||||
B_PIC_STROKE_RECT = 0x0101,
|
||||
B_PIC_FILL_RECT = 0x0102,
|
||||
B_PIC_STROKE_LINE = 0x0100,
|
||||
B_PIC_STROKE_RECT = 0x0101,
|
||||
B_PIC_FILL_RECT = 0x0102,
|
||||
B_PIC_STROKE_ROUND_RECT = 0x0103,
|
||||
B_PIC_FILL_ROUND_RECT = 0x0104,
|
||||
B_PIC_STROKE_BEZIER = 0x0105,
|
||||
B_PIC_FILL_BEZIER = 0x0106,
|
||||
B_PIC_STROKE_BEZIER = 0x0105,
|
||||
B_PIC_FILL_BEZIER = 0x0106,
|
||||
B_PIC_STROKE_POLYGON = 0x010B,
|
||||
B_PIC_FILL_POLYGON = 0x010C,
|
||||
B_PIC_STROKE_SHAPE = 0x010D,
|
||||
B_PIC_FILL_SHAPE = 0x010E,
|
||||
B_PIC_DRAW_STRING = 0x010F,
|
||||
B_PIC_DRAW_PIXELS = 0x0110,
|
||||
B_PIC_DRAW_PICTURE = 0x0112,
|
||||
B_PIC_STROKE_ARC = 0x0113,
|
||||
B_PIC_FILL_ARC = 0x0114,
|
||||
B_PIC_FILL_POLYGON = 0x010C,
|
||||
B_PIC_STROKE_SHAPE = 0x010D,
|
||||
B_PIC_FILL_SHAPE = 0x010E,
|
||||
B_PIC_DRAW_STRING = 0x010F,
|
||||
B_PIC_DRAW_PIXELS = 0x0110,
|
||||
B_PIC_DRAW_PICTURE = 0x0112,
|
||||
B_PIC_STROKE_ARC = 0x0113,
|
||||
B_PIC_FILL_ARC = 0x0114,
|
||||
B_PIC_STROKE_ELLIPSE = 0x0115,
|
||||
B_PIC_FILL_ELLIPSE = 0x0116,
|
||||
B_PIC_FILL_ELLIPSE = 0x0116,
|
||||
|
||||
B_PIC_ENTER_STATE_CHANGE = 0x0200,
|
||||
B_PIC_SET_CLIPPING_RECTS = 0x0201,
|
||||
B_PIC_CLIP_TO_PICTURE = 0x0202,
|
||||
B_PIC_PUSH_STATE = 0x0203,
|
||||
B_PIC_POP_STATE = 0x0204,
|
||||
B_PIC_PUSH_STATE = 0x0203,
|
||||
B_PIC_POP_STATE = 0x0204,
|
||||
B_PIC_CLEAR_CLIPPING_RECTS = 0x0205,
|
||||
|
||||
B_PIC_SET_ORIGIN = 0x0300,
|
||||
B_PIC_SET_ORIGIN = 0x0300,
|
||||
B_PIC_SET_PEN_LOCATION = 0x0301,
|
||||
B_PIC_SET_DRAWING_MODE = 0x0302,
|
||||
B_PIC_SET_LINE_MODE = 0x0303,
|
||||
B_PIC_SET_PEN_SIZE = 0x0304,
|
||||
B_PIC_SET_SCALE = 0x0305,
|
||||
B_PIC_SET_LINE_MODE = 0x0303,
|
||||
B_PIC_SET_PEN_SIZE = 0x0304,
|
||||
B_PIC_SET_SCALE = 0x0305,
|
||||
B_PIC_SET_FORE_COLOR = 0x0306,
|
||||
B_PIC_SET_BACK_COLOR = 0x0307,
|
||||
B_PIC_SET_STIPLE_PATTERN = 0x0308,
|
||||
@@ -46,15 +46,16 @@ enum {
|
||||
B_PIC_SET_FONT_SPACING = 0x0382,
|
||||
B_PIC_SET_FONT_ENCODING = 0x0383,
|
||||
B_PIC_SET_FONT_FLAGS = 0x0384,
|
||||
B_PIC_SET_FONT_SIZE = 0x0385,
|
||||
B_PIC_SET_FONT_SIZE = 0x0385,
|
||||
B_PIC_SET_FONT_ROTATE = 0x0386,
|
||||
B_PIC_SET_FONT_SHEAR = 0x0387,
|
||||
B_PIC_SET_FONT_BPP = 0x0388,
|
||||
B_PIC_SET_FONT_FACE = 0x0389,
|
||||
B_PIC_SET_FONT_BPP = 0x0388,
|
||||
B_PIC_SET_FONT_FACE = 0x0389,
|
||||
B_PIC_SET_TRANSFORM = 0x0390,
|
||||
};
|
||||
|
||||
|
||||
const static uint32 kOpsTableSize = 48;
|
||||
const static uint32 kOpsTableSize = 49;
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -39,8 +39,9 @@ enum {
|
||||
B_VIEW_LOW_COLOR_BIT = 0x00008000,
|
||||
B_VIEW_VIEW_COLOR_BIT = 0x00010000,
|
||||
B_VIEW_PATTERN_BIT = 0x00020000,
|
||||
B_VIEW_TRANSFORM_BIT = 0x00040000,
|
||||
|
||||
B_VIEW_ALL_BITS = 0x0003ffff,
|
||||
B_VIEW_ALL_BITS = 0x0007ffff,
|
||||
|
||||
// these used for archiving only
|
||||
B_VIEW_RESIZE_BIT = 0x00001000,
|
||||
@@ -111,7 +112,11 @@ class ViewState {
|
||||
::drawing_mode drawing_mode;
|
||||
BRegion clipping_region;
|
||||
bool clipping_region_used;
|
||||
|
||||
// transformation
|
||||
BPoint origin;
|
||||
float scale;
|
||||
BAffineTransform transform;
|
||||
|
||||
// line modes
|
||||
join_mode line_join;
|
||||
@@ -122,8 +127,6 @@ class ViewState {
|
||||
source_alpha alpha_source_mode;
|
||||
alpha_function alpha_function_mode;
|
||||
|
||||
float scale;
|
||||
|
||||
// fonts
|
||||
BFont font;
|
||||
uint16 font_flags;
|
||||
|
||||
Reference in New Issue
Block a user