BPicture: add gradient support

Fixes #9680.

Change-Id: I0013326559cc40ff26cf7b44794c0b32aea832ba
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2829
Reviewed-by: Stephan Aßmus <[email protected]>
This commit is contained in:
X512
2020-07-12 19:44:43 +00:00
committed by waddlesplash
parent 10b294d85b
commit 90ab1a44ad
7 changed files with 743 additions and 9 deletions
@@ -20,6 +20,7 @@
class Layer;
class BGradient;
class BPositionIO;
class BRegion;
@@ -91,6 +92,24 @@ public:
status_t WriteDrawShape(const int32& opCount,
const void* opList, const int32& ptCount,
const void* ptList, const bool& fill);
status_t WriteDrawRectGradient(const BRect& rect, const BGradient& gradient,
const bool& fill);
status_t WriteDrawRoundRectGradient(const BRect& rect,
const BPoint& radius, const BGradient& gradient, const bool& fill);
status_t WriteDrawBezierGradient(const BPoint points[4], const BGradient& gradient,
const bool& fill);
status_t WriteDrawArcGradient(const BPoint& center,
const BPoint& radius,
const float& startTheta,
const float& arcTheta, const BGradient& gradient, const bool& fill);
status_t WriteDrawEllipseGradient(const BRect& rect, const BGradient& gradient,
const bool& fill);
status_t WriteDrawPolygonGradient(const int32& numPoints,
BPoint* points, const bool& isClosed, const BGradient& gradient,
const bool& fill);
status_t WriteDrawShapeGradient(const int32& opCount,
const void* opList, const int32& ptCount,
const void* ptList, const BGradient& gradient, const bool& fill);
status_t WriteDrawBitmap(const BRect& srcRect,
const BRect& dstRect, const int32& width,
const int32& height,
@@ -21,6 +21,7 @@
class BAffineTransform;
class BGradient;
class BList;
class BPicture;
class BShape;
@@ -94,6 +95,13 @@ struct picture_player_callbacks {
int32 ptCount, const BPoint ptList[], bool inverse);
void (*draw_string_locations)(void* userData, const char* string,
size_t length, const BPoint locations[], size_t locationCount);
void (*draw_rect_gradient)(void* userData, const BRect& rect, BGradient& gradient, bool fill);
void (*draw_round_rect_gradient)(void* userData, const BRect& rect, const BPoint& radii, BGradient& gradient, bool fill);
void (*draw_bezier_gradient)(void* userData, size_t numControlPoints, const BPoint controlPoints[], BGradient& gradient, bool fill);
void (*draw_arc_gradient)(void* userData, const BPoint& center, const BPoint& radii, float startTheta, float arcTheta, BGradient& gradient, bool fill);
void (*draw_ellipse_gradient)(void* userData, const BRect& rect, BGradient& gradient, bool fill);
void (*draw_polygon_gradient)(void* userData, size_t numPoints, const BPoint points[], bool isClosed, BGradient& gradient, bool fill);
void (*draw_shape_gradient)(void* userData, const BShape& shape, BGradient& gradient, bool fill);
};
+15 -1
View File
@@ -23,6 +23,20 @@ enum {
B_PIC_STROKE_ELLIPSE = 0x0115,
B_PIC_FILL_ELLIPSE = 0x0116,
B_PIC_DRAW_STRING_LOCATIONS = 0x0117,
B_PIC_STROKE_RECT_GRADIENT = 0x0118,
B_PIC_FILL_RECT_GRADIENT = 0x0119,
B_PIC_STROKE_ROUND_RECT_GRADIENT = 0x011A,
B_PIC_FILL_ROUND_RECT_GRADIENT = 0x011B,
B_PIC_STROKE_BEZIER_GRADIENT = 0x011C,
B_PIC_FILL_BEZIER_GRADIENT = 0x011D,
B_PIC_STROKE_POLYGON_GRADIENT = 0x011E,
B_PIC_FILL_POLYGON_GRADIENT = 0x011F,
B_PIC_STROKE_SHAPE_GRADIENT = 0x0120,
B_PIC_FILL_SHAPE_GRADIENT = 0x0121,
B_PIC_STROKE_ARC_GRADIENT = 0x0122,
B_PIC_FILL_ARC_GRADIENT = 0x0123,
B_PIC_STROKE_ELLIPSE_GRADIENT = 0x0124,
B_PIC_FILL_ELLIPSE_GRADIENT = 0x0125,
B_PIC_ENTER_STATE_CHANGE = 0x0200,
B_PIC_SET_CLIPPING_RECTS = 0x0201,
@@ -62,7 +76,7 @@ enum {
};
const static uint32 kOpsTableSize = 51;
const static uint32 kOpsTableSize = 70;
#endif