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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 * Will return NULL if the image does not use a texture. | 77 * Will return NULL if the image does not use a texture. |
78 */ | 78 */ |
79 GrTexture* getTexture(); | 79 GrTexture* getTexture(); |
80 | 80 |
81 SkShader* newShaderClamp() const; | 81 SkShader* newShaderClamp() const; |
82 SkShader* newShader(SkShader::TileMode, SkShader::TileMode) const; | 82 SkShader* newShader(SkShader::TileMode, SkShader::TileMode) const; |
83 | 83 |
84 void draw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*); | 84 void draw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*); |
85 | 85 |
86 /** | 86 /** |
| 87 * Draw the image, cropped to the src rect, to the dst rect of a canvas. |
| 88 * If src is larger than the bounds of the image, the rest of the image is |
| 89 * filled with transparent black pixels. |
| 90 * |
| 91 * See SkCanvas::drawBitmapRectToRect for similar behavior. |
| 92 */ |
| 93 void draw(SkCanvas*, const SkRect* src, const SkRect& dst, const SkPaint*); |
| 94 |
| 95 /** |
87 * Encode the image's pixels and return the result as a new SkData, which | 96 * Encode the image's pixels and return the result as a new SkData, which |
88 * the caller must manage (i.e. call unref() when they are done). | 97 * the caller must manage (i.e. call unref() when they are done). |
89 * | 98 * |
90 * If the image type cannot be encoded, or the requested encoder type is | 99 * If the image type cannot be encoded, or the requested encoder type is |
91 * not supported, this will return NULL. | 100 * not supported, this will return NULL. |
92 */ | 101 */ |
93 SkData* encode(SkImageEncoder::Type t = SkImageEncoder::kPNG_Type, | 102 SkData* encode(SkImageEncoder::Type t = SkImageEncoder::kPNG_Type, |
94 int quality = 80) const; | 103 int quality = 80) const; |
95 | 104 |
96 protected: | 105 protected: |
(...skipping 10 matching lines...) Expand all Loading... |
107 const int fWidth; | 116 const int fWidth; |
108 const int fHeight; | 117 const int fHeight; |
109 const uint32_t fUniqueID; | 118 const uint32_t fUniqueID; |
110 | 119 |
111 static uint32_t NextUniqueID(); | 120 static uint32_t NextUniqueID(); |
112 | 121 |
113 typedef SkRefCnt INHERITED; | 122 typedef SkRefCnt INHERITED; |
114 }; | 123 }; |
115 | 124 |
116 #endif | 125 #endif |
OLD | NEW |