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

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

Issue 390693002: Add SkBitmap::readPixels() and reimplement copyTo and SkCanvas::readPixels (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 | « no previous file | include/core/SkCanvas.h » ('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 SkBitmap_DEFINED 8 #ifndef SkBitmap_DEFINED
9 #define SkBitmap_DEFINED 9 #define SkBitmap_DEFINED
10 10
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 * will be used. 584 * will be used.
585 * @return true if the copy was made. 585 * @return true if the copy was made.
586 */ 586 */
587 bool copyTo(SkBitmap* dst, SkColorType ct, Allocator* = NULL) const; 587 bool copyTo(SkBitmap* dst, SkColorType ct, Allocator* = NULL) const;
588 588
589 bool copyTo(SkBitmap* dst, Allocator* allocator = NULL) const { 589 bool copyTo(SkBitmap* dst, Allocator* allocator = NULL) const {
590 return this->copyTo(dst, this->colorType(), allocator); 590 return this->copyTo(dst, this->colorType(), allocator);
591 } 591 }
592 592
593 /** 593 /**
594 * Copy the bitmap's pixels into the specified buffer (pixels + rowBytes),
595 * converting them into the requested format (SkImageInfo). The src pixels are read
596 * starting at the specified (srcX,srcY) offset, relative to the top-left c orner.
597 *
598 * The specified ImageInfo and (srcX,srcY) offset specifies a source rectan gle
599 *
600 * srcR.setXYWH(srcX, srcY, dstInfo.width(), dstInfo.height());
601 *
602 * srcR is intersected with the bounds of the bitmap. If this intersection is not empty,
603 * then we have two sets of pixels (of equal size). Replace the dst pixels with the
604 * corresponding src pixels, performing any colortype/alphatype transformat ions needed
605 * (in the case where the src and dst have different colortypes or alphatyp es).
606 *
607 * This call can fail, returning false, for several reasons:
608 * - If srcR does not intersect the bitmap bounds.
609 * - If the requested colortype/alphatype cannot be converted from the src' s types.
610 * - If the src pixels are not available.
611 */
612 bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBy tes,
613 int srcX, int srcY) const;
614
615 /**
594 * Returns true if this bitmap's pixels can be converted into the requested 616 * Returns true if this bitmap's pixels can be converted into the requested
595 * colorType, such that copyTo() could succeed. 617 * colorType, such that copyTo() could succeed.
596 */ 618 */
597 bool canCopyTo(SkColorType colorType) const; 619 bool canCopyTo(SkColorType colorType) const;
598 620
599 /** Makes a deep copy of this bitmap, keeping the copied pixels 621 /** Makes a deep copy of this bitmap, keeping the copied pixels
600 * in the same domain as the source: If the src pixels are allocated for 622 * in the same domain as the source: If the src pixels are allocated for
601 * the cpu, then so will the dst. If the src pixels are allocated on the 623 * the cpu, then so will the dst. If the src pixels are allocated on the
602 * gpu (typically as a texture), the it will do the same for the dst. 624 * gpu (typically as a texture), the it will do the same for the dst.
603 * If the request cannot be fulfilled, returns false and dst is unmodified. 625 * If the request cannot be fulfilled, returns false and dst is unmodified.
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
848 #ifdef SK_SUPPORT_LEGACY_BITMAP_CONFIG 870 #ifdef SK_SUPPORT_LEGACY_BITMAP_CONFIG
849 /////////////////////////////////////////////////////////////////////////////// 871 ///////////////////////////////////////////////////////////////////////////////
850 // 872 //
851 // Helpers until we can fully deprecate SkBitmap::Config 873 // Helpers until we can fully deprecate SkBitmap::Config
852 // 874 //
853 SK_API SkBitmap::Config SkColorTypeToBitmapConfig(SkColorType); 875 SK_API SkBitmap::Config SkColorTypeToBitmapConfig(SkColorType);
854 SK_API SkColorType SkBitmapConfigToColorType(SkBitmap::Config); 876 SK_API SkColorType SkBitmapConfigToColorType(SkBitmap::Config);
855 #endif 877 #endif
856 878
857 #endif 879 #endif
OLDNEW
« no previous file with comments | « no previous file | include/core/SkCanvas.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698