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 "SkImageInfo.h" | 11 #include "SkImageInfo.h" |
12 #include "SkImageEncoder.h" | 12 #include "SkImageEncoder.h" |
13 #include "SkRefCnt.h" | 13 #include "SkRefCnt.h" |
14 #include "SkScalar.h" | 14 #include "SkScalar.h" |
| 15 #include "SkShader.h" |
15 | 16 |
16 class SkData; | 17 class SkData; |
17 class SkCanvas; | 18 class SkCanvas; |
18 class SkPaint; | 19 class SkPaint; |
19 class SkShader; | |
20 class GrContext; | 20 class GrContext; |
21 class GrTexture; | 21 class GrTexture; |
22 | 22 |
23 // need for TileMode | |
24 #include "SkShader.h" | |
25 | |
26 /** | 23 /** |
27 * SkImage is an abstraction for drawing a rectagle of pixels, though the | 24 * SkImage is an abstraction for drawing a rectagle of pixels, though the |
28 * particular type of image could be actually storing its data on the GPU, or | 25 * particular type of image could be actually storing its data on the GPU, or |
29 * as drawing commands (picture or PDF or otherwise), ready to be played back | 26 * as drawing commands (picture or PDF or otherwise), ready to be played back |
30 * into another canvas. | 27 * into another canvas. |
31 * | 28 * |
32 * The content of SkImage is always immutable, though the actual storage may | 29 * The content of SkImage is always immutable, though the actual storage may |
33 * change, if for example that image can be re-created via encoded data or | 30 * change, if for example that image can be re-created via encoded data or |
34 * other means. | 31 * other means. |
35 */ | 32 */ |
(...skipping 18 matching lines...) Expand all Loading... |
54 int height() const { return fHeight; } | 51 int height() const { return fHeight; } |
55 uint32_t uniqueID() const { return fUniqueID; } | 52 uint32_t uniqueID() const { return fUniqueID; } |
56 | 53 |
57 /** | 54 /** |
58 * Return the GrTexture that stores the image pixels. Calling getTexture | 55 * Return the GrTexture that stores the image pixels. Calling getTexture |
59 * does not affect the reference count of the GrTexture object. | 56 * does not affect the reference count of the GrTexture object. |
60 * Will return NULL if the image does not use a texture. | 57 * Will return NULL if the image does not use a texture. |
61 */ | 58 */ |
62 GrTexture* getTexture(); | 59 GrTexture* getTexture(); |
63 | 60 |
64 SkShader* newShaderClamp() const; | 61 virtual SkShader* newShader(SkShader::TileMode, SkShader::TileMode) const; |
65 SkShader* newShader(SkShader::TileMode, SkShader::TileMode) const; | |
66 | 62 |
67 void draw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*); | 63 void draw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*); |
68 | 64 |
69 /** | 65 /** |
70 * Draw the image, cropped to the src rect, to the dst rect of a canvas. | 66 * Draw the image, cropped to the src rect, to the dst rect of a canvas. |
71 * If src is larger than the bounds of the image, the rest of the image is | 67 * If src is larger than the bounds of the image, the rest of the image is |
72 * filled with transparent black pixels. | 68 * filled with transparent black pixels. |
73 * | 69 * |
74 * See SkCanvas::drawBitmapRectToRect for similar behavior. | 70 * See SkCanvas::drawBitmapRectToRect for similar behavior. |
75 */ | 71 */ |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 * On failure, false will be returned, and bitmap will unmodified. | 129 * On failure, false will be returned, and bitmap will unmodified. |
134 */ | 130 */ |
135 // On ice for now: | 131 // On ice for now: |
136 // - should it respect the particular colortype/alphatype of the src | 132 // - should it respect the particular colortype/alphatype of the src |
137 // - should it have separate entrypoints for preallocated and not bitmaps? | 133 // - should it have separate entrypoints for preallocated and not bitmaps? |
138 // - isn't it enough to allow the caller to draw() the image into a canvas? | 134 // - isn't it enough to allow the caller to draw() the image into a canvas? |
139 bool readPixels(SkBitmap* bitmap, const SkIRect* subset = NULL) const; | 135 bool readPixels(SkBitmap* bitmap, const SkIRect* subset = NULL) const; |
140 }; | 136 }; |
141 | 137 |
142 #endif | 138 #endif |
OLD | NEW |