2 * Copyright 2006-2015 Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
6 * Stefano Ceccherini, burton666@libero.it
7 * Julian Harnath, <julian.harnath@rwth-achen.de>
9 #ifndef _PICTURE_DATA_WRITER_H
10 #define _PICTURE_DATA_WRITER_H
13 #include <AffineTransform.h>
14 #include <InterfaceDefs.h>
25 class PictureDataWriter
{
28 PictureDataWriter(BPositionIO
* data
);
29 virtual ~PictureDataWriter();
31 status_t
SetTo(BPositionIO
* data
);
33 status_t
WriteSetHighColor(const rgb_color
& color
);
34 status_t
WriteSetLowColor(const rgb_color
& color
);
35 status_t
WriteSetOrigin(const BPoint
& point
);
36 status_t
WriteSetDrawingMode(const drawing_mode
& mode
);
37 status_t
WriteSetPenLocation(const BPoint
& point
);
38 status_t
WriteSetPenSize(const float& penSize
);
39 status_t
WriteSetLineMode(const cap_mode
& cap
,
40 const join_mode
& join
,
41 const float& miterLimit
);
42 status_t
WriteSetScale(const float& scale
);
43 status_t
WriteSetTransform(BAffineTransform transform
);
44 status_t
WriteTranslateBy(double x
, double y
);
45 status_t
WriteScaleBy(double x
, double y
);
46 status_t
WriteRotateBy(double angleRadians
);
47 status_t
WriteSetPattern(const ::pattern
& pattern
);
48 status_t
WriteClipToPicture(int32 pictureToken
,
49 const BPoint
& origin
, bool inverse
);
50 status_t
WriteSetClipping(const BRegion
& region
);
51 status_t
WriteClearClipping();
53 status_t
WritePushState();
54 status_t
WritePopState();
56 status_t
WriteSetFontFamily(const font_family family
);
57 status_t
WriteSetFontStyle(const font_style style
);
58 status_t
WriteSetFontSpacing(const int32
& spacing
);
59 status_t
WriteSetFontSize(const float& size
);
60 status_t
WriteSetFontRotation(const float& rotation
);
61 status_t
WriteSetFontEncoding(const int32
& encoding
);
62 status_t
WriteSetFontFlags(const int32
& flags
);
63 status_t
WriteSetFontShear(const float& shear
);
64 status_t
WriteSetFontFace(const int32
& face
);
66 status_t
WriteStrokeLine(const BPoint
& start
,
68 status_t
WriteInvertRect(const BRect
& rect
);
69 status_t
WriteDrawRect(const BRect
& rect
,
71 status_t
WriteDrawRoundRect(const BRect
& rect
,
72 const BPoint
& radius
, const bool& fill
);
73 status_t
WriteDrawEllipse(const BRect
& rect
,
75 status_t
WriteDrawArc(const BPoint
& center
,
77 const float& startTheta
,
78 const float& arcTheta
, const bool& fill
);
79 status_t
WriteDrawPolygon(const int32
& numPoints
,
80 BPoint
* points
, const bool& isClosed
,
82 status_t
WriteDrawBezier(const BPoint points
[4],
84 status_t
WriteDrawString(const BPoint
& where
,
85 const char* string
, const int32
& length
,
86 const escapement_delta
& delta
);
87 status_t
WriteDrawShape(const int32
& opCount
,
88 const void* opList
, const int32
& ptCount
,
89 const void* ptList
, const bool& fill
);
90 status_t
WriteDrawBitmap(const BRect
& srcRect
,
91 const BRect
& dstRect
, const int32
& width
,
93 const int32
& bytesPerRow
,
94 const int32
& colorSpace
,
96 const void* data
, const int32
& length
);
98 status_t
WriteDrawPicture(const BPoint
& where
,
101 status_t
WriteBlendLayer(Layer
* layer
);
102 status_t
WriteClipToRect(const BRect
& rect
,
104 status_t
WriteClipToShape(int32 opCount
,
105 const void* opList
, int32 ptCount
,
106 const void* ptList
, bool inverse
);
109 // throw a status_t on error
110 void BeginOp(const int16
& op
);
112 void WriteData(const void* data
, size_t size
);
113 template <typename T
> void Write(const T
& data
)
114 { WriteData(&data
, sizeof(data
)); }
118 std::stack
<off_t
> fStack
;
122 #endif // _PICTURE_DATA_WRITER_H