diff options
Diffstat (limited to 'include/core/SkCanvas.h')
-rw-r--r-- | include/core/SkCanvas.h | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h index 7bdb6d219c..7bff02a6a9 100644 --- a/include/core/SkCanvas.h +++ b/include/core/SkCanvas.h @@ -792,6 +792,23 @@ public: void drawImageRect(const SkImage* image, const SkRect* src, const SkRect& dst, const SkPaint* paint = NULL); + /** + * Draw the image stretched differentially to fit into dst. + * center is a rect within the image, and logically divides the image + * into 9 sections (3x3). For example, if the middle pixel of a [5x5] + * image is the "center", then the center-rect should be [2, 2, 3, 3]. + * + * If the dst is >= the image size, then... + * - The 4 corners are not stretched at all. + * - The sides are stretched in only one axis. + * - The center is stretched in both axes. + * Else, for each axis where dst < image, + * - The corners shrink proportionally + * - The sides (along the shrink axis) and center are not drawn + */ + void drawImageNine(const SkImage*, const SkIRect& center, const SkRect& dst, + const SkPaint* paint = NULL); + /** Draw the specified bitmap, with its top/left corner at (x,y), using the specified paint, transformed by the current matrix. Note: if the paint contains a maskfilter that generates a mask which extends beyond the @@ -1230,6 +1247,9 @@ protected: virtual void onDrawPath(const SkPath&, const SkPaint&); virtual void onDrawImage(const SkImage*, SkScalar dx, SkScalar dy, const SkPaint*); virtual void onDrawImageRect(const SkImage*, const SkRect*, const SkRect&, const SkPaint*); + virtual void onDrawImageNine(const SkImage*, const SkIRect& center, const SkRect& dst, + const SkPaint*); + virtual void onDrawBitmap(const SkBitmap&, SkScalar dx, SkScalar dy, const SkPaint*); virtual void onDrawBitmapRect(const SkBitmap&, const SkRect*, const SkRect&, const SkPaint*, DrawBitmapRectFlags); @@ -1347,8 +1367,6 @@ private: void internalDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, const SkRect& dst, const SkPaint* paint, DrawBitmapRectFlags flags); - void internalDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, - const SkRect& dst, const SkPaint* paint); void internalDrawPaint(const SkPaint& paint); void internalSaveLayer(const SkRect* bounds, const SkPaint*, SaveFlags, SaveLayerStrategy); void internalDrawDevice(SkBaseDevice*, int x, int y, const SkPaint*, bool isBitmapDevice); |