Index: include/core/SkCanvas.h |
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h |
index 7bdb6d219ca4bb5f89d1b57bfcc6127810fdd052..7bff02a6a938ca0a644770f06f989822e8ce0791 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); |