1e372c1baSStefano Ceccherini /* 20b0ecfabSMarcus Overhagen * Copyright 2001-2007, Haiku Inc. 3e372c1baSStefano Ceccherini * Distributed under the terms of the MIT License. 4e372c1baSStefano Ceccherini * 5e372c1baSStefano Ceccherini * Authors: 6e372c1baSStefano Ceccherini * Marc Flerackers (mflerackers@androme.be) 7422fadc8SStefano Ceccherini * Stefano Ceccherini (stefano.ceccherini@gmail.com) 80b0ecfabSMarcus Overhagen * Marcus Overhagen (marcus@overhagen.de) 9e372c1baSStefano Ceccherini */ 10f6e4cbb9SAxel Dörfler #ifndef _PICTURE_PLAYER_H 11f6e4cbb9SAxel Dörfler #define _PICTURE_PLAYER_H 12e372c1baSStefano Ceccherini 13f6e4cbb9SAxel Dörfler /*! PicturePlayer is used to play picture data. */ 14e372c1baSStefano Ceccherini 15e372c1baSStefano Ceccherini 16e372c1baSStefano Ceccherini #include <GraphicsDefs.h> 17eec73693SMichael Lotz #include <InterfaceDefs.h> 18e372c1baSStefano Ceccherini #include <Point.h> 19e372c1baSStefano Ceccherini #include <Rect.h> 20e372c1baSStefano Ceccherini 21eec73693SMichael Lotz 22eec73693SMichael Lotz class BAffineTransform; 23f6e4cbb9SAxel Dörfler class BList; 24eec73693SMichael Lotz class BPicture; 25eec73693SMichael Lotz class BShape; 26f6e4cbb9SAxel Dörfler 27e372c1baSStefano Ceccherini 28422fadc8SStefano Ceccherini namespace BPrivate { 29422fadc8SStefano Ceccherini 30eec73693SMichael Lotz 31eec73693SMichael Lotz struct picture_player_callbacks { 32eec73693SMichael Lotz void (*move_pen_by)(void* userData, const BPoint& where); 33eec73693SMichael Lotz void (*stroke_line)(void* userData, const BPoint& start, const BPoint& end); 34eec73693SMichael Lotz void (*draw_rect)(void* userData, const BRect& rect, bool fill); 35eec73693SMichael Lotz void (*draw_round_rect)(void* userData, const BRect& rect, 36eec73693SMichael Lotz const BPoint& radii, bool fill); 37eec73693SMichael Lotz void (*draw_bezier)(void* userData, size_t numControlPoints, 38eec73693SMichael Lotz const BPoint controlPoints[], bool fill); 39eec73693SMichael Lotz void (*draw_arc)(void* userData, const BPoint& center, const BPoint& radii, 40eec73693SMichael Lotz float startTheta, float arcTheta, bool fill); 41eec73693SMichael Lotz void (*draw_ellipse)(void* userData, const BRect& rect, bool fill); 42eec73693SMichael Lotz void (*draw_polygon)(void* userData, size_t numPoints, 43eec73693SMichael Lotz const BPoint points[], bool isClosed, bool fill); 44eec73693SMichael Lotz void (*draw_shape)(void* userData, const BShape& shape, bool fill); 45eec73693SMichael Lotz void (*draw_string)(void* userData, const char* string, size_t length, 46eec73693SMichael Lotz float spaceEscapement, float nonSpaceEscapement); 47eec73693SMichael Lotz void (*draw_pixels)(void* userData, const BRect& source, 48eec73693SMichael Lotz const BRect& destination, uint32 width, uint32 height, 49eec73693SMichael Lotz size_t bytesPerRow, color_space pixelFormat, uint32 flags, 50eec73693SMichael Lotz const void* data, size_t length); 51eec73693SMichael Lotz void (*draw_picture)(void* userData, const BPoint& where, int32 token); 52eec73693SMichael Lotz void (*set_clipping_rects)(void* userData, size_t numRects, 53eec73693SMichael Lotz const BRect rects[]); 54*ce27f961SStefano Ceccherini void (*clip_to_picture)(void* userData, int32 token, 55eec73693SMichael Lotz const BPoint& where, bool clipToInverse); 56eec73693SMichael Lotz void (*push_state)(void* userData); 57eec73693SMichael Lotz void (*pop_state)(void* userData); 58eec73693SMichael Lotz void (*enter_state_change)(void* userData); 59eec73693SMichael Lotz void (*exit_state_change)(void* userData); 60eec73693SMichael Lotz void (*enter_font_state)(void* userData); 61eec73693SMichael Lotz void (*exit_font_state)(void* userData); 62eec73693SMichael Lotz void (*set_origin)(void* userData, const BPoint& origin); 63eec73693SMichael Lotz void (*set_pen_location)(void* userData, const BPoint& location); 64eec73693SMichael Lotz void (*set_drawing_mode)(void* userData, drawing_mode mode); 65eec73693SMichael Lotz void (*set_line_mode)(void* userData, cap_mode capMode, join_mode joinMode, 66eec73693SMichael Lotz float miterLimit); 67eec73693SMichael Lotz void (*set_pen_size)(void* userData, float size); 68eec73693SMichael Lotz void (*set_fore_color)(void* userData, const rgb_color& color); 69eec73693SMichael Lotz void (*set_back_color)(void* userData, const rgb_color& color); 70eec73693SMichael Lotz void (*set_stipple_pattern)(void* userData, const pattern& patter); 71eec73693SMichael Lotz void (*set_scale)(void* userData, float scale); 72eec73693SMichael Lotz void (*set_font_family)(void* userData, const char* familyName, 73eec73693SMichael Lotz size_t length); 74eec73693SMichael Lotz void (*set_font_style)(void* userData, const char* styleName, 75eec73693SMichael Lotz size_t length); 76eec73693SMichael Lotz void (*set_font_spacing)(void* userData, uint8 spacing); 77eec73693SMichael Lotz void (*set_font_size)(void* userData, float size); 78eec73693SMichael Lotz void (*set_font_rotation)(void* userData, float rotation); 79eec73693SMichael Lotz void (*set_font_encoding)(void* userData, uint8 encoding); 80eec73693SMichael Lotz void (*set_font_flags)(void* userData, uint32 flags); 81eec73693SMichael Lotz void (*set_font_shear)(void* userData, float shear); 82eec73693SMichael Lotz void (*set_font_face)(void* userData, uint16 face); 83eec73693SMichael Lotz void (*set_blending_mode)(void* userData, source_alpha alphaSourceMode, 84eec73693SMichael Lotz alpha_function alphaFunctionMode); 85eec73693SMichael Lotz void (*set_transform)(void* userData, const BAffineTransform& transform); 86eec73693SMichael Lotz }; 87eec73693SMichael Lotz 88eec73693SMichael Lotz 89e372c1baSStefano Ceccherini class PicturePlayer { 90e372c1baSStefano Ceccherini public: 91e372c1baSStefano Ceccherini PicturePlayer(); 920b0ecfabSMarcus Overhagen PicturePlayer(const void* data, size_t size, BList* pictures); 93e372c1baSStefano Ceccherini virtual ~PicturePlayer(); 94e372c1baSStefano Ceccherini 95eec73693SMichael Lotz status_t Play(void** callbacks, int32 tableEntries, 96e372c1baSStefano Ceccherini void* userData); 97eec73693SMichael Lotz status_t Play(const picture_player_callbacks& callbacks, 98eec73693SMichael Lotz size_t callbacksSize, void* userData); 99e372c1baSStefano Ceccherini 100e372c1baSStefano Ceccherini private: 101eec73693SMichael Lotz status_t _Play(const picture_player_callbacks& callbacks, void* userData, 102eec73693SMichael Lotz const void* data, size_t length, uint16 parentOp); 103eec73693SMichael Lotz 1040b0ecfabSMarcus Overhagen const void* fData; 1050b0ecfabSMarcus Overhagen size_t fSize; 106e372c1baSStefano Ceccherini BList* fPictures; 107e372c1baSStefano Ceccherini }; 108e372c1baSStefano Ceccherini 109f6e4cbb9SAxel Dörfler } // namespace BPrivate 110422fadc8SStefano Ceccherini 111f6e4cbb9SAxel Dörfler #endif // _PICTURE_PLAYER_H 112