| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef SkImage_DEFINED | 8 #ifndef SkImage_DEFINED |
| 9 #define SkImage_DEFINED | 9 #define SkImage_DEFINED |
| 10 | 10 |
| 11 #include "SkEncodedFormat.h" |
| 11 #include "SkFilterQuality.h" | 12 #include "SkFilterQuality.h" |
| 12 #include "SkImageInfo.h" | 13 #include "SkImageInfo.h" |
| 13 #include "SkImageEncoder.h" | 14 #include "SkImageEncoder.h" |
| 14 #include "SkRefCnt.h" | 15 #include "SkRefCnt.h" |
| 15 #include "SkScalar.h" | 16 #include "SkScalar.h" |
| 16 #include "SkShader.h" | 17 #include "SkShader.h" |
| 17 | 18 |
| 18 class SkData; | 19 class SkData; |
| 19 class SkCanvas; | 20 class SkCanvas; |
| 20 class SkImageGenerator; | 21 class SkImageGenerator; |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBy
tes, | 113 bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBy
tes, |
| 113 int srcX, int srcY) const; | 114 int srcX, int srcY) const; |
| 114 | 115 |
| 115 /** | 116 /** |
| 116 * Encode the image's pixels and return the result as a new SkData, which | 117 * Encode the image's pixels and return the result as a new SkData, which |
| 117 * the caller must manage (i.e. call unref() when they are done). | 118 * the caller must manage (i.e. call unref() when they are done). |
| 118 * | 119 * |
| 119 * If the image type cannot be encoded, or the requested encoder type is | 120 * If the image type cannot be encoded, or the requested encoder type is |
| 120 * not supported, this will return NULL. | 121 * not supported, this will return NULL. |
| 121 */ | 122 */ |
| 122 SkData* encode(SkImageEncoder::Type t = SkImageEncoder::kPNG_Type, | 123 SkData* encode(SkEncodedFormat f = kPNG_SkEncodedFormat, int quality = 80) c
onst; |
| 123 int quality = 80) const; | |
| 124 | 124 |
| 125 /** | 125 /** |
| 126 * Return a new surface that is compatible with this image's internal repre
sentation | 126 * Return a new surface that is compatible with this image's internal repre
sentation |
| 127 * (e.g. raster or gpu). | 127 * (e.g. raster or gpu). |
| 128 * | 128 * |
| 129 * If no surfaceprops are specified, the image will attempt to match the pr
ops of when it | 129 * If no surfaceprops are specified, the image will attempt to match the pr
ops of when it |
| 130 * was created (if it came from a surface). | 130 * was created (if it came from a surface). |
| 131 */ | 131 */ |
| 132 SkSurface* newSurface(const SkImageInfo&, const SkSurfaceProps* = NULL) cons
t; | 132 SkSurface* newSurface(const SkImageInfo&, const SkSurfaceProps* = NULL) cons
t; |
| 133 | 133 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 * Draw the image, cropped to the src rect, to the dst rect of a canvas. | 181 * Draw the image, cropped to the src rect, to the dst rect of a canvas. |
| 182 * If src is larger than the bounds of the image, the rest of the image is | 182 * If src is larger than the bounds of the image, the rest of the image is |
| 183 * filled with transparent black pixels. | 183 * filled with transparent black pixels. |
| 184 * | 184 * |
| 185 * See SkCanvas::drawBitmapRectToRect for similar behavior. | 185 * See SkCanvas::drawBitmapRectToRect for similar behavior. |
| 186 */ | 186 */ |
| 187 void drawRect(SkCanvas*, const SkRect* src, const SkRect& dst, const SkPaint
*) const; | 187 void drawRect(SkCanvas*, const SkRect* src, const SkRect& dst, const SkPaint
*) const; |
| 188 }; | 188 }; |
| 189 | 189 |
| 190 #endif | 190 #endif |
| OLD | NEW |