diff options
author | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-05-20 16:33:41 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-05-20 16:33:41 +0000 |
commit | 4b0757b7489ee5d6bd7149bbcdb0b2af6b7a21cb (patch) | |
tree | d408b82779c2362f9888888456e0441995648fce /include/core | |
parent | 845220b8179a73c8ec3e53b6dcc11ee3d30ad6a4 (diff) |
add encodeData() to SkImageEncoder, and add encoding to SkImage
BUG=
R=scroggo@google.com
Review URL: https://codereview.chromium.org/15002004
git-svn-id: http://skia.googlecode.com/svn/trunk@9193 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/core')
-rw-r--r-- | include/core/SkImage.h | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/include/core/SkImage.h b/include/core/SkImage.h index e6ac682876..9b7dfd13b7 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), |