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 |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 * unref on the data when they are done. | 265 * unref on the data when they are done. |
266 * | 266 * |
267 * If the image does not already has its contents in encoded form, return N
ULL. | 267 * If the image does not already has its contents in encoded form, return N
ULL. |
268 * | 268 * |
269 * Note: to force the image to return its contents as encoded data, try cal
ling encode(...). | 269 * Note: to force the image to return its contents as encoded data, try cal
ling encode(...). |
270 */ | 270 */ |
271 SkData* refEncoded() const; | 271 SkData* refEncoded() const; |
272 | 272 |
273 const char* toString(SkString*) const; | 273 const char* toString(SkString*) const; |
274 | 274 |
275 #ifdef SK_SUPPORT_LEGACY_NEWIMAGE | |
276 /** | |
277 * Return an image that is a rescale of this image (using newWidth, newHeig
ht). | |
278 * | |
279 * If subset is NULL, then the entire original image is used as the src for
the scaling. | |
280 * If subset is not NULL, then it specifies subset of src-pixels used for s
caling. If | |
281 * subset extends beyond the bounds of the original image, then NULL is ret
urned. | |
282 * | |
283 * Notes: | |
284 * - newWidth and newHeight must be > 0 or NULL will be returned. | |
285 * | |
286 * - it is legal for the returned image to be the same instance as the src
image | |
287 * (if the new dimensions == the src dimensions and subset is NULL or ==
src dimensions). | |
288 * | |
289 * - it is legal for the "scaled" image to have changed its SkAlphaType fro
m unpremul | |
290 * to premul (as required by the impl). The image should draw (nearly) id
entically, | |
291 * since during drawing we will "apply the alpha" to the pixels. Future o
ptimizations | |
292 * may take away this caveat, preserving unpremul. | |
293 */ | |
294 SkImage* newImage(int newWidth, int newHeight, const SkIRect* subset) const; | |
295 #endif | |
296 | |
297 /** | 275 /** |
298 * Return a new image that is a subset of this image. The underlying implem
entation may | 276 * Return a new image that is a subset of this image. The underlying implem
entation may |
299 * share the pixels, or it may make a copy. | 277 * share the pixels, or it may make a copy. |
300 * | 278 * |
301 * If subset does not intersect the bounds of this image, or the copy/share
cannot be made, | 279 * If subset does not intersect the bounds of this image, or the copy/share
cannot be made, |
302 * NULL will be returned. | 280 * NULL will be returned. |
303 */ | 281 */ |
304 SkImage* newSubset(const SkIRect& subset) const; | 282 SkImage* newSubset(const SkIRect& subset) const; |
305 | 283 |
306 // Helper functions to convert to SkBitmap | 284 // Helper functions to convert to SkBitmap |
(...skipping 25 matching lines...) Expand all Loading... |
332 | 310 |
333 private: | 311 private: |
334 const int fWidth; | 312 const int fWidth; |
335 const int fHeight; | 313 const int fHeight; |
336 const uint32_t fUniqueID; | 314 const uint32_t fUniqueID; |
337 | 315 |
338 typedef SkRefCnt INHERITED; | 316 typedef SkRefCnt INHERITED; |
339 }; | 317 }; |
340 | 318 |
341 #endif | 319 #endif |
OLD | NEW |