Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(781)

Side by Side Diff: include/core/SkCanvas.h

Issue 377303002: add readPixels() to SkBitmap (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix spelling in comment Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/core/SkBitmap.h ('k') | src/core/SkBitmap.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 (x,y) location in the coordinate system of the base-layer. 237 * starting at the specified (srcX,srcY) location in the coordinate system of the base-layer.
238 * 238 *
239 * The specified ImageInfo and (x,y) offset specifies a source rectangle 239 * The specified ImageInfo and (srcX,srcY) offset specifies a source rectan gle
240 * 240 *
241 * srcR(x, y, info.width(), info.height()); 241 * srcR.setXYWH(srcX, srcY, dstInfo.width(), dstInfo.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), the "src" specified by base-layer at (x,y) 244 * then we have two sets of pixels (of equal size). Replace the dst pixels with the
245 * and the "dst" by info+pixels+rowBytes. Replace the dst pixels with the c orresponding src 245 * corresponding src pixels, performing any colortype/alphatype transformat ions needed
246 * pixels, performing any colortype/alphatype transformations needed (in th e case where the 246 * (in the case where the src and dst have different colortypes or alphatyp es).
247 * src and dst have different colortypes or alphatypes).
248 * 247 *
249 * This call can fail, returning false, for several reasons: 248 * 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&, void* pixels, size_t rowBytes, int x, in t y); 253 bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBy tes,
254 int srcX, int srcY);
254 255
255 /** 256 /**
256 * Helper for calling readPixels(info, ...). This call will check if bitmap has been allocated. 257 * Helper for calling readPixels(info, ...). This call will check if bitmap has been allocated.
257 * If not, it will attempt to call allocPixels(). If this fails, it will re turn false. If not, 258 * If not, it will attempt to call allocPixels(). If this fails, it will re turn false. If not,
258 * it calls through to readPixels(info, ...) and returns its result. 259 * it calls through to readPixels(info, ...) and returns its result.
259 */ 260 */
260 bool readPixels(SkBitmap* bitmap, int x, int y); 261 bool readPixels(SkBitmap* bitmap, int srcX, int srcY);
261 262
262 /** 263 /**
263 * Helper for allocating pixels and then calling readPixels(info, ...). The bitmap is resized 264 * Helper for allocating pixels and then calling readPixels(info, ...). The bitmap is resized
264 * to the intersection of srcRect and the base-layer bounds. On success, pi xels will be 265 * to the intersection of srcRect and the base-layer bounds. On success, pi xels will be
265 * allocated in bitmap and true returned. On failure, false is returned and bitmap will be 266 * allocated in bitmap and true returned. On failure, false is returned and bitmap will be
266 * set to empty. 267 * set to empty.
267 */ 268 */
268 bool readPixels(const SkIRect& srcRect, SkBitmap* bitmap); 269 bool readPixels(const SkIRect& srcRect, SkBitmap* bitmap);
269 270
270 /** 271 /**
(...skipping 1206 matching lines...) Expand 10 before | Expand all | Expand 10 after
1477 1478
1478 class SkCanvasClipVisitor { 1479 class SkCanvasClipVisitor {
1479 public: 1480 public:
1480 virtual ~SkCanvasClipVisitor(); 1481 virtual ~SkCanvasClipVisitor();
1481 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; 1482 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0;
1482 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; 1483 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0;
1483 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; 1484 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0;
1484 }; 1485 };
1485 1486
1486 #endif 1487 #endif
OLDNEW
« no previous file with comments | « include/core/SkBitmap.h ('k') | src/core/SkBitmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698