Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(258)

Unified Diff: include/core/SkImage.h

Issue 15002004: add encodeData() to SkImageEncoder, and add encoding to SkImage (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | include/images/SkImageEncoder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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),
« no previous file with comments | « no previous file | include/images/SkImageEncoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698