Index: include/core/SkImage.h |
diff --git a/include/core/SkImage.h b/include/core/SkImage.h |
index e6ac68287672d1582ffde1adc1fc74fc8c8176dc..9b7dfd13b72241fe0abfeb1959c6e461f14c883f 100644 |
--- a/include/core/SkImage.h |
+++ b/include/core/SkImage.h |
@@ -21,8 +21,6 @@ class GrTexture; |
// need for TileMode |
#include "SkShader.h" |
-////// EXPERIMENTAL |
- |
/** |
* SkImage is an abstraction for drawing a rectagle of pixels, though the |
* particular type of image could be actually storing its data on the GPU, or |
@@ -84,6 +82,24 @@ public: |
void draw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*); |
+ enum EncodeType { |
+ kBMP_EncodeType, |
+ kGIF_EncodeType, |
+ kICO_EncodeType, |
+ kJPEG_EncodeType, |
+ kPNG_EncodeType, |
+ kWBMP_EncodeType, |
+ kWEBP_EncodeType, |
+ }; |
+ /** |
+ * Encode the image's pixels and return the result as a new SkData, which |
+ * the caller must manage (i.e. call unref() when they are done). |
+ * |
+ * If the image type cannot be encoded, or the requested encoder type is |
+ * not supported, this will return NULL. |
+ */ |
+ SkData* encode(EncodeType t = kPNG_EncodeType, int quality = 80) const; |
+ |
protected: |
SkImage(int width, int height) : |
fWidth(width), |