btrfs: [] on the end of a struct field is a variable length array.
[haiku.git] / headers / private / print / PicturePrinter.h
blob7d0dd40d641df9e4ff82a82a622b55f982243c9d
1 /*
3 PicturePrinter
5 Copyright (c) 2001, 2002 OpenBeOS.
7 Author:
8 Michael Pfeiffer
10 Permission is hereby granted, free of charge, to any person obtaining a copy of
11 this software and associated documentation files (the "Software"), to deal in
12 the Software without restriction, including without limitation the rights to
13 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
14 of the Software, and to permit persons to whom the Software is furnished to do
15 so, subject to the following conditions:
17 The above copyright notice and this permission notice shall be included in all
18 copies or substantial portions of the Software.
20 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
26 THE SOFTWARE.
30 #ifndef _PICTURE_PRINTER_H
31 #define _PICTURE_PRINTER_H
33 #include "PictureIterator.h"
35 #include <Shape.h>
37 class PicturePrinter : public PictureIterator
39 public:
40 PicturePrinter(int indent = 0);
42 // BPicture playback handlers
43 virtual void Op(int number);
44 virtual void MovePenBy(BPoint delta);
45 virtual void StrokeLine(BPoint start, BPoint end);
46 virtual void StrokeRect(BRect rect);
47 virtual void FillRect(BRect rect);
48 virtual void StrokeRoundRect(BRect rect, BPoint radii);
49 virtual void FillRoundRect(BRect rect, BPoint radii);
50 virtual void StrokeBezier(BPoint *control);
51 virtual void FillBezier(BPoint *control);
52 virtual void StrokeArc(BPoint center, BPoint radii, float startTheta, float arcTheta);
53 virtual void FillArc(BPoint center, BPoint radii, float startTheta, float arcTheta);
54 virtual void StrokeEllipse(BPoint center, BPoint radii);
55 virtual void FillEllipse(BPoint center, BPoint radii);
56 virtual void StrokePolygon(int32 numPoints, BPoint *points, bool isClosed);
57 virtual void FillPolygon(int32 numPoints, BPoint *points, bool isClosed);
58 virtual void StrokeShape(BShape *shape);
59 virtual void FillShape(BShape *shape);
60 virtual void DrawString(char *string, float escapement_nospace, float escapement_space);
61 virtual void DrawPixels(BRect src, BRect dest, int32 width, int32 height, int32 bytesPerRow, int32 pixelFormat, int32 flags, void *data);
62 virtual void SetClippingRects(BRect *rects, uint32 numRects);
63 virtual void ClipToPicture(BPicture *picture, BPoint point, bool clip_to_inverse_picture);
64 virtual void PushState();
65 virtual void PopState();
66 virtual void EnterStateChange();
67 virtual void ExitStateChange();
68 virtual void EnterFontState();
69 virtual void ExitFontState();
70 virtual void SetOrigin(BPoint pt);
71 virtual void SetPenLocation(BPoint pt);
72 virtual void SetDrawingMode(drawing_mode mode);
73 virtual void SetLineMode(cap_mode capMode, join_mode joinMode, float miterLimit);
74 virtual void SetPenSize(float size);
75 virtual void SetForeColor(rgb_color color);
76 virtual void SetBackColor(rgb_color color);
77 virtual void SetStipplePattern(pattern p);
78 virtual void SetScale(float scale);
79 virtual void SetFontFamily(char *family);
80 virtual void SetFontStyle(char *style);
81 virtual void SetFontSpacing(int32 spacing);
82 virtual void SetFontSize(float size);
83 virtual void SetFontRotate(float rotation);
84 virtual void SetFontEncoding(int32 encoding);
85 virtual void SetFontFlags(int32 flags);
86 virtual void SetFontShear(float shear);
87 virtual void SetFontFace(int32 flags);
89 private:
90 int fIndent;
92 void Print(const char* text);
93 void Print(BPoint* point);
94 void Print(BRect* rect);
95 void Print(int numPoints, BPoint* points);
96 void Print(int numRects, BRect* rects);
97 void Print(BShape* shape);
98 void Print(const char* label, float f);
99 void Print(const char* label, BPoint *point);
100 void Print(rgb_color color);
101 void Print(float f);
102 void Cr();
103 void Indent(int inc = 0);
104 void IncIndent();
105 void DecIndent();
107 friend class ShapePrinter;
110 class ShapePrinter : public BShapeIterator {
111 public:
112 ShapePrinter(PicturePrinter* printer);
113 ~ShapePrinter();
115 status_t IterateBezierTo(int32 bezierCount, BPoint *bezierPoints);
116 status_t IterateClose(void);
117 status_t IterateLineTo(int32 lineCount, BPoint *linePoints);
118 status_t IterateMoveTo(BPoint *point);
120 private:
121 PicturePrinter* fPrinter;
124 #endif // _PICTURE_PRINTER_H