2 * Copyright 2001-2007, Haiku Inc.
3 * Distributed under the terms of the MIT License.
6 * Marc Flerackers (mflerackers@androme.be)
7 * Stefano Ceccherini (stefano.ceccherini@gmail.com)
8 * Marcus Overhagen (marcus@overhagen.de)
10 #ifndef _PICTURE_PLAYER_H
11 #define _PICTURE_PLAYER_H
13 /*! PicturePlayer is used to play picture data. */
16 #include <GraphicsDefs.h>
17 #include <InterfaceDefs.h>
22 class BAffineTransform
;
32 struct picture_player_callbacks
{
33 void (*move_pen_by
)(void* userData
, const BPoint
& where
);
34 void (*stroke_line
)(void* userData
, const BPoint
& start
, const BPoint
& end
);
35 void (*draw_rect
)(void* userData
, const BRect
& rect
, bool fill
);
36 void (*draw_round_rect
)(void* userData
, const BRect
& rect
,
37 const BPoint
& radii
, bool fill
);
38 void (*draw_bezier
)(void* userData
, size_t numControlPoints
,
39 const BPoint controlPoints
[], bool fill
);
40 void (*draw_arc
)(void* userData
, const BPoint
& center
, const BPoint
& radii
,
41 float startTheta
, float arcTheta
, bool fill
);
42 void (*draw_ellipse
)(void* userData
, const BRect
& rect
, bool fill
);
43 void (*draw_polygon
)(void* userData
, size_t numPoints
,
44 const BPoint points
[], bool isClosed
, bool fill
);
45 void (*draw_shape
)(void* userData
, const BShape
& shape
, bool fill
);
46 void (*draw_string
)(void* userData
, const char* string
, size_t length
,
47 float spaceEscapement
, float nonSpaceEscapement
);
48 void (*draw_pixels
)(void* userData
, const BRect
& source
,
49 const BRect
& destination
, uint32 width
, uint32 height
,
50 size_t bytesPerRow
, color_space pixelFormat
, uint32 flags
,
51 const void* data
, size_t length
);
52 void (*draw_picture
)(void* userData
, const BPoint
& where
, int32 token
);
53 void (*set_clipping_rects
)(void* userData
, size_t numRects
,
55 void (*clip_to_picture
)(void* userData
, int32 token
,
56 const BPoint
& where
, bool clipToInverse
);
57 void (*push_state
)(void* userData
);
58 void (*pop_state
)(void* userData
);
59 void (*enter_state_change
)(void* userData
);
60 void (*exit_state_change
)(void* userData
);
61 void (*enter_font_state
)(void* userData
);
62 void (*exit_font_state
)(void* userData
);
63 void (*set_origin
)(void* userData
, const BPoint
& origin
);
64 void (*set_pen_location
)(void* userData
, const BPoint
& location
);
65 void (*set_drawing_mode
)(void* userData
, drawing_mode mode
);
66 void (*set_line_mode
)(void* userData
, cap_mode capMode
, join_mode joinMode
,
68 void (*set_pen_size
)(void* userData
, float size
);
69 void (*set_fore_color
)(void* userData
, const rgb_color
& color
);
70 void (*set_back_color
)(void* userData
, const rgb_color
& color
);
71 void (*set_stipple_pattern
)(void* userData
, const pattern
& patter
);
72 void (*set_scale
)(void* userData
, float scale
);
73 void (*set_font_family
)(void* userData
, const char* familyName
,
75 void (*set_font_style
)(void* userData
, const char* styleName
,
77 void (*set_font_spacing
)(void* userData
, uint8 spacing
);
78 void (*set_font_size
)(void* userData
, float size
);
79 void (*set_font_rotation
)(void* userData
, float rotation
);
80 void (*set_font_encoding
)(void* userData
, uint8 encoding
);
81 void (*set_font_flags
)(void* userData
, uint32 flags
);
82 void (*set_font_shear
)(void* userData
, float shear
);
83 void (*set_font_face
)(void* userData
, uint16 face
);
84 void (*set_blending_mode
)(void* userData
, source_alpha alphaSourceMode
,
85 alpha_function alphaFunctionMode
);
86 void (*set_transform
)(void* userData
, const BAffineTransform
& transform
);
87 void (*translate_by
)(void* userData
, double x
, double y
);
88 void (*scale_by
)(void* userData
, double x
, double y
);
89 void (*rotate_by
)(void* userData
, double angleRadians
);
90 void (*blend_layer
)(void* userData
, Layer
* layer
);
91 void (*clip_to_rect
)(void* userData
, const BRect
& rect
, bool inverse
);
92 void (*clip_to_shape
)(void* userData
, int32 opCount
, const uint32 opList
[],
93 int32 ptCount
, const BPoint ptList
[], bool inverse
);
100 PicturePlayer(const void* data
, size_t size
, BList
* pictures
);
101 virtual ~PicturePlayer();
103 status_t
Play(void** callbacks
, int32 tableEntries
,
105 status_t
Play(const picture_player_callbacks
& callbacks
,
106 size_t callbacksSize
, void* userData
);
109 status_t
_Play(const picture_player_callbacks
& callbacks
, void* userData
,
110 const void* data
, size_t length
, uint16 parentOp
);
117 } // namespace BPrivate
119 #endif // _PICTURE_PLAYER_H