OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
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 SkCanvas_DEFINED | 8 #ifndef SkCanvas_DEFINED |
9 #define SkCanvas_DEFINED | 9 #define SkCanvas_DEFINED |
10 | 10 |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 * returned address (and associated information). | 227 * returned address (and associated information). |
228 * | 228 * |
229 * On failure, returns NULL and the info and rowBytes parameters are | 229 * On failure, returns NULL and the info and rowBytes parameters are |
230 * ignored. | 230 * ignored. |
231 */ | 231 */ |
232 const void* peekPixels(SkImageInfo* info, size_t* rowBytes); | 232 const void* peekPixels(SkImageInfo* info, size_t* rowBytes); |
233 | 233 |
234 /** | 234 /** |
235 * Copy the pixels from the base-layer into the specified buffer (pixels +
rowBytes), | 235 * Copy the pixels from the base-layer into the specified buffer (pixels +
rowBytes), |
236 * converting them into the requested format (SkImageInfo). The base-layer
pixels are read | 236 * converting them into the requested format (SkImageInfo). The base-layer
pixels are read |
237 * starting at the specified (srcX,srcY) location in the coordinate system
of the base-layer. | 237 * starting at the specified (x,y) location in the coordinate system of the
base-layer. |
238 * | 238 * |
239 * The specified ImageInfo and (srcX,srcY) offset specifies a source rectan
gle | 239 * The specified ImageInfo and (x,y) offset specifies a source rectangle |
240 * | 240 * |
241 * srcR.setXYWH(srcX, srcY, dstInfo.width(), dstInfo.height()); | 241 * srcR(x, y, info.width(), info.height()); |
242 * | 242 * |
243 * srcR is intersected with the bounds of the base-layer. If this intersect
ion is not empty, | 243 * SrcR is intersected with the bounds of the base-layer. If this intersect
ion is not empty, |
244 * then we have two sets of pixels (of equal size). Replace the dst pixels
with the | 244 * then we have two sets of pixels (of equal size), the "src" specified by
base-layer at (x,y) |
245 * corresponding src pixels, performing any colortype/alphatype transformat
ions needed | 245 * and the "dst" by info+pixels+rowBytes. Replace the dst pixels with the c
orresponding src |
246 * (in the case where the src and dst have different colortypes or alphatyp
es). | 246 * pixels, performing any colortype/alphatype transformations needed (in th
e case where the |
| 247 * src and dst have different colortypes or alphatypes). |
247 * | 248 * |
248 * This call can fail, returning false, for several reasons: | 249 * This call can fail, returning false, for several reasons: |
249 * - If srcR does not intersect the base-layer bounds. | |
250 * - If the requested colortype/alphatype cannot be converted from the base
-layer's types. | 250 * - If the requested colortype/alphatype cannot be converted from the base
-layer's types. |
251 * - If this canvas is not backed by pixels (e.g. picture or PDF) | 251 * - If this canvas is not backed by pixels (e.g. picture or PDF) |
252 */ | 252 */ |
253 bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBy
tes, | 253 bool readPixels(const SkImageInfo&, void* pixels, size_t rowBytes, int x, in
t y); |
254 int srcX, int srcY); | |
255 | 254 |
256 /** | 255 /** |
257 * Helper for calling readPixels(info, ...). This call will check if bitmap
has been allocated. | 256 * Helper for calling readPixels(info, ...). This call will check if bitmap
has been allocated. |
258 * If not, it will attempt to call allocPixels(). If this fails, it will re
turn false. If not, | 257 * If not, it will attempt to call allocPixels(). If this fails, it will re
turn false. If not, |
259 * it calls through to readPixels(info, ...) and returns its result. | 258 * it calls through to readPixels(info, ...) and returns its result. |
260 */ | 259 */ |
261 bool readPixels(SkBitmap* bitmap, int srcX, int srcY); | 260 bool readPixels(SkBitmap* bitmap, int x, int y); |
262 | 261 |
263 /** | 262 /** |
264 * Helper for allocating pixels and then calling readPixels(info, ...). The
bitmap is resized | 263 * Helper for allocating pixels and then calling readPixels(info, ...). The
bitmap is resized |
265 * to the intersection of srcRect and the base-layer bounds. On success, pi
xels will be | 264 * to the intersection of srcRect and the base-layer bounds. On success, pi
xels will be |
266 * allocated in bitmap and true returned. On failure, false is returned and
bitmap will be | 265 * allocated in bitmap and true returned. On failure, false is returned and
bitmap will be |
267 * set to empty. | 266 * set to empty. |
268 */ | 267 */ |
269 bool readPixels(const SkIRect& srcRect, SkBitmap* bitmap); | 268 bool readPixels(const SkIRect& srcRect, SkBitmap* bitmap); |
270 | 269 |
271 /** | 270 /** |
(...skipping 1206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1478 | 1477 |
1479 class SkCanvasClipVisitor { | 1478 class SkCanvasClipVisitor { |
1480 public: | 1479 public: |
1481 virtual ~SkCanvasClipVisitor(); | 1480 virtual ~SkCanvasClipVisitor(); |
1482 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; | 1481 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; |
1483 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; | 1482 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; |
1484 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; | 1483 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; |
1485 }; | 1484 }; |
1486 | 1485 |
1487 #endif | 1486 #endif |
OLD | NEW |