app_server/Interface Kit: add new clipping API
* Add new clipping API for rectangles (ClipToRect, ClipToInverseRect) and shapes (ClipToShape, ClipToInverseShape) * Works with affine transforms and automatically switches from fast region-based clipping to alpha-mask based clipping as necessary. * Always self-intersecting, i.e. no state push required to further narrow down the clipping region. All of the 4 new methods can be mixed in any order.
This commit is contained in:
@@ -223,6 +223,11 @@ public:
|
||||
void ClipToInversePicture(BPicture* picture,
|
||||
BPoint where = B_ORIGIN, bool sync = true);
|
||||
|
||||
void ClipToRect(BRect rect);
|
||||
void ClipToInverseRect(BRect rect);
|
||||
void ClipToShape(BShape* shape);
|
||||
void ClipToInverseShape(BShape* shape);
|
||||
|
||||
virtual void SetDrawingMode(drawing_mode mode);
|
||||
drawing_mode DrawingMode() const;
|
||||
|
||||
@@ -651,6 +656,9 @@ private:
|
||||
void _ClipToPicture(BPicture* picture, BPoint where,
|
||||
bool invert, bool sync);
|
||||
|
||||
void _ClipToRect(BRect rect, bool inverse);
|
||||
void _ClipToShape(BShape* shape, bool inverse);
|
||||
|
||||
bool _CheckOwnerLockAndSwitchCurrent() const;
|
||||
bool _CheckOwnerLock() const;
|
||||
void _CheckLockAndSwitchCurrent() const;
|
||||
|
||||
@@ -347,6 +347,10 @@ enum {
|
||||
AS_VIEW_SET_FILL_RULE,
|
||||
AS_VIEW_GET_FILL_RULE,
|
||||
|
||||
// New clipping: cumulative, transformed
|
||||
AS_VIEW_CLIP_TO_RECT,
|
||||
AS_VIEW_CLIP_TO_SHAPE,
|
||||
|
||||
AS_LAST_CODE
|
||||
};
|
||||
|
||||
|
||||
@@ -96,6 +96,11 @@ public:
|
||||
const int32& token);
|
||||
|
||||
status_t WriteBlendLayer(Layer* layer);
|
||||
status_t WriteClipToRect(const BRect& rect,
|
||||
bool inverse);
|
||||
status_t WriteClipToShape(int32 opCount,
|
||||
const void* opList, int32 ptCount,
|
||||
const void* ptList, bool inverse);
|
||||
|
||||
protected:
|
||||
// throw a status_t on error
|
||||
|
||||
@@ -85,6 +85,9 @@ struct picture_player_callbacks {
|
||||
alpha_function alphaFunctionMode);
|
||||
void (*set_transform)(void* userData, const BAffineTransform& transform);
|
||||
void (*blend_layer)(void* userData, Layer* layer);
|
||||
void (*clip_to_rect)(void* userData, const BRect& rect, bool inverse);
|
||||
void (*clip_to_shape)(void* userData, int32 opCount, const uint32 opList[],
|
||||
int32 ptCount, const BPoint ptList[], bool inverse);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -29,6 +29,8 @@ enum {
|
||||
B_PIC_PUSH_STATE = 0x0203,
|
||||
B_PIC_POP_STATE = 0x0204,
|
||||
B_PIC_CLEAR_CLIPPING_RECTS = 0x0205,
|
||||
B_PIC_CLIP_TO_RECT = 0x0206,
|
||||
B_PIC_CLIP_TO_SHAPE = 0x0207,
|
||||
|
||||
B_PIC_SET_ORIGIN = 0x0300,
|
||||
B_PIC_SET_PEN_LOCATION = 0x0301,
|
||||
|
||||
Reference in New Issue
Block a user