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 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 Loading... |
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 (x,y) offset, relative to the top-left corner. |
| 597 * |
| 598 * The specified ImageInfo and (x,y) offset specifies a source rectangle |
| 599 * |
| 600 * srcR.setXYWH(x, y, info.width(), info.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), the "src" beginning at
(x,y) |
| 604 * and the "dst" by info+pixels+rowBytes. Replace the dst pixels with the c
orresponding src |
| 605 * pixels, performing any colortype/alphatype transformations needed (in th
e case where the |
| 606 * src and dst have different colortypes or alphatypes). |
| 607 * |
| 608 * This call can fail, returning false, for several reasons: |
| 609 * - If srcR does not intersect the bitmap bounds. |
| 610 * - If the requested colortype/alphatype cannot be converted from the src'
s types. |
| 611 * - If the src pixels are not available. |
| 612 */ |
| 613 bool readPixels(const SkImageInfo&, void* pixels, size_t rowBytes, int x, in
t y) 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 Loading... |
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 |
OLD | NEW |