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 | 15 |
16 class SkData; | 16 class SkData; |
17 class SkCanvas; | 17 class SkCanvas; |
18 class SkPaint; | 18 class SkPaint; |
19 class SkShader; | |
20 class GrContext; | 19 class GrContext; |
21 class GrTexture; | 20 class GrTexture; |
22 | 21 |
23 // need for TileMode | 22 // need for TileMode |
24 #include "SkShader.h" | 23 #include "SkShader.h" |
25 | 24 |
26 /** | 25 /** |
27 * SkImage is an abstraction for drawing a rectagle of pixels, though the | 26 * 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 | 27 * 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 | 28 * as drawing commands (picture or PDF or otherwise), ready to be played back |
(...skipping 24 matching lines...) Expand all Loading... |
54 int height() const { return fHeight; } | 53 int height() const { return fHeight; } |
55 uint32_t uniqueID() const { return fUniqueID; } | 54 uint32_t uniqueID() const { return fUniqueID; } |
56 | 55 |
57 /** | 56 /** |
58 * Return the GrTexture that stores the image pixels. Calling getTexture | 57 * Return the GrTexture that stores the image pixels. Calling getTexture |
59 * does not affect the reference count of the GrTexture object. | 58 * does not affect the reference count of the GrTexture object. |
60 * Will return NULL if the image does not use a texture. | 59 * Will return NULL if the image does not use a texture. |
61 */ | 60 */ |
62 GrTexture* getTexture(); | 61 GrTexture* getTexture(); |
63 | 62 |
64 SkShader* newShaderClamp() const; | 63 virtual SkShader* newShader(SkShader::TileMode, SkShader::TileMode) const =
0; |
65 SkShader* newShader(SkShader::TileMode, SkShader::TileMode) const; | |
66 | 64 |
67 void draw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*); | 65 void draw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*); |
68 | 66 |
69 /** | 67 /** |
70 * Draw the image, cropped to the src rect, to the dst rect of a canvas. | 68 * 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 | 69 * If src is larger than the bounds of the image, the rest of the image is |
72 * filled with transparent black pixels. | 70 * filled with transparent black pixels. |
73 * | 71 * |
74 * See SkCanvas::drawBitmapRectToRect for similar behavior. | 72 * See SkCanvas::drawBitmapRectToRect for similar behavior. |
75 */ | 73 */ |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 * On failure, false will be returned, and bitmap will unmodified. | 131 * On failure, false will be returned, and bitmap will unmodified. |
134 */ | 132 */ |
135 // On ice for now: | 133 // On ice for now: |
136 // - should it respect the particular colortype/alphatype of the src | 134 // - should it respect the particular colortype/alphatype of the src |
137 // - should it have separate entrypoints for preallocated and not bitmaps? | 135 // - 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? | 136 // - 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; | 137 bool readPixels(SkBitmap* bitmap, const SkIRect* subset = NULL) const; |
140 }; | 138 }; |
141 | 139 |
142 #endif | 140 #endif |
OLD | NEW |