2006-02-11 00:38:53 +03:00
|
|
|
/*
|
2007-03-02 02:17:40 +03:00
|
|
|
* Copyright 2001-2007, Haiku Inc.
|
2006-02-11 00:38:53 +03:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Marc Flerackers (mflerackers@androme.be)
|
2007-08-16 18:40:03 +04:00
|
|
|
* Stefano Ceccherini (stefano.ceccherini@gmail.com)
|
2007-03-02 02:17:40 +03:00
|
|
|
* Marcus Overhagen (marcus@overhagen.de)
|
2006-02-11 00:38:53 +03:00
|
|
|
*/
|
2007-10-16 00:13:55 +04:00
|
|
|
#ifndef _PICTURE_PLAYER_H
|
|
|
|
#define _PICTURE_PLAYER_H
|
2006-02-11 00:38:53 +03:00
|
|
|
|
2007-10-16 00:13:55 +04:00
|
|
|
/*! PicturePlayer is used to play picture data. */
|
2006-01-18 00:39:07 +03:00
|
|
|
|
|
|
|
|
|
|
|
#include <GraphicsDefs.h>
|
2015-09-05 15:43:19 +03:00
|
|
|
#include <InterfaceDefs.h>
|
2006-01-18 00:39:07 +03:00
|
|
|
#include <Point.h>
|
|
|
|
#include <Rect.h>
|
|
|
|
|
2015-09-05 15:43:19 +03:00
|
|
|
|
|
|
|
class BAffineTransform;
|
2007-10-16 00:13:55 +04:00
|
|
|
class BList;
|
2015-09-05 15:43:19 +03:00
|
|
|
class BPicture;
|
|
|
|
class BShape;
|
2007-10-16 00:13:55 +04:00
|
|
|
|
2006-01-18 00:39:07 +03:00
|
|
|
|
2007-08-16 18:40:03 +04:00
|
|
|
namespace BPrivate {
|
|
|
|
|
2015-09-05 15:43:19 +03:00
|
|
|
|
|
|
|
struct picture_player_callbacks {
|
|
|
|
void (*move_pen_by)(void* userData, const BPoint& where);
|
|
|
|
void (*stroke_line)(void* userData, const BPoint& start, const BPoint& end);
|
|
|
|
void (*draw_rect)(void* userData, const BRect& rect, bool fill);
|
|
|
|
void (*draw_round_rect)(void* userData, const BRect& rect,
|
|
|
|
const BPoint& radii, bool fill);
|
|
|
|
void (*draw_bezier)(void* userData, size_t numControlPoints,
|
|
|
|
const BPoint controlPoints[], bool fill);
|
|
|
|
void (*draw_arc)(void* userData, const BPoint& center, const BPoint& radii,
|
|
|
|
float startTheta, float arcTheta, bool fill);
|
|
|
|
void (*draw_ellipse)(void* userData, const BRect& rect, bool fill);
|
|
|
|
void (*draw_polygon)(void* userData, size_t numPoints,
|
|
|
|
const BPoint points[], bool isClosed, bool fill);
|
|
|
|
void (*draw_shape)(void* userData, const BShape& shape, bool fill);
|
|
|
|
void (*draw_string)(void* userData, const char* string, size_t length,
|
|
|
|
float spaceEscapement, float nonSpaceEscapement);
|
|
|
|
void (*draw_pixels)(void* userData, const BRect& source,
|
|
|
|
const BRect& destination, uint32 width, uint32 height,
|
|
|
|
size_t bytesPerRow, color_space pixelFormat, uint32 flags,
|
|
|
|
const void* data, size_t length);
|
|
|
|
void (*draw_picture)(void* userData, const BPoint& where, int32 token);
|
|
|
|
void (*set_clipping_rects)(void* userData, size_t numRects,
|
|
|
|
const BRect rects[]);
|
2015-09-05 21:59:06 +03:00
|
|
|
void (*clip_to_picture)(void* userData, int32 token,
|
2015-09-05 15:43:19 +03:00
|
|
|
const BPoint& where, bool clipToInverse);
|
|
|
|
void (*push_state)(void* userData);
|
|
|
|
void (*pop_state)(void* userData);
|
|
|
|
void (*enter_state_change)(void* userData);
|
|
|
|
void (*exit_state_change)(void* userData);
|
|
|
|
void (*enter_font_state)(void* userData);
|
|
|
|
void (*exit_font_state)(void* userData);
|
|
|
|
void (*set_origin)(void* userData, const BPoint& origin);
|
|
|
|
void (*set_pen_location)(void* userData, const BPoint& location);
|
|
|
|
void (*set_drawing_mode)(void* userData, drawing_mode mode);
|
|
|
|
void (*set_line_mode)(void* userData, cap_mode capMode, join_mode joinMode,
|
|
|
|
float miterLimit);
|
|
|
|
void (*set_pen_size)(void* userData, float size);
|
|
|
|
void (*set_fore_color)(void* userData, const rgb_color& color);
|
|
|
|
void (*set_back_color)(void* userData, const rgb_color& color);
|
|
|
|
void (*set_stipple_pattern)(void* userData, const pattern& patter);
|
|
|
|
void (*set_scale)(void* userData, float scale);
|
|
|
|
void (*set_font_family)(void* userData, const char* familyName,
|
|
|
|
size_t length);
|
|
|
|
void (*set_font_style)(void* userData, const char* styleName,
|
|
|
|
size_t length);
|
|
|
|
void (*set_font_spacing)(void* userData, uint8 spacing);
|
|
|
|
void (*set_font_size)(void* userData, float size);
|
|
|
|
void (*set_font_rotation)(void* userData, float rotation);
|
|
|
|
void (*set_font_encoding)(void* userData, uint8 encoding);
|
|
|
|
void (*set_font_flags)(void* userData, uint32 flags);
|
|
|
|
void (*set_font_shear)(void* userData, float shear);
|
|
|
|
void (*set_font_face)(void* userData, uint16 face);
|
|
|
|
void (*set_blending_mode)(void* userData, source_alpha alphaSourceMode,
|
|
|
|
alpha_function alphaFunctionMode);
|
|
|
|
void (*set_transform)(void* userData, const BAffineTransform& transform);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2006-02-11 00:38:53 +03:00
|
|
|
class PicturePlayer {
|
2006-01-18 00:39:07 +03:00
|
|
|
public:
|
2007-10-16 00:13:55 +04:00
|
|
|
PicturePlayer();
|
2015-09-05 15:43:19 +03:00
|
|
|
PicturePlayer(const void* data, size_t size, BList* pictures);
|
2007-10-16 00:13:55 +04:00
|
|
|
virtual ~PicturePlayer();
|
2006-01-18 00:39:07 +03:00
|
|
|
|
2015-09-05 15:43:19 +03:00
|
|
|
status_t Play(void** callbacks, int32 tableEntries,
|
|
|
|
void* userData);
|
|
|
|
status_t Play(const picture_player_callbacks& callbacks,
|
|
|
|
size_t callbacksSize, void* userData);
|
2006-01-18 00:39:07 +03:00
|
|
|
|
|
|
|
private:
|
2015-09-05 15:43:19 +03:00
|
|
|
status_t _Play(const picture_player_callbacks& callbacks, void* userData,
|
|
|
|
const void* data, size_t length, uint16 parentOp);
|
|
|
|
|
2007-10-16 00:13:55 +04:00
|
|
|
const void* fData;
|
|
|
|
size_t fSize;
|
|
|
|
BList* fPictures;
|
2006-01-18 00:39:07 +03:00
|
|
|
};
|
|
|
|
|
2007-10-16 00:13:55 +04:00
|
|
|
} // namespace BPrivate
|
2007-08-16 18:40:03 +04:00
|
|
|
|
2007-10-16 00:13:55 +04:00
|
|
|
#endif // _PICTURE_PLAYER_H
|