OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #ifndef SkCanvas_DEFINED | 10 #ifndef SkCanvas_DEFINED |
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
667 width/height will be the edge color replicated. | 667 width/height will be the edge color replicated. |
668 @param bitmap The bitmap to be drawn | 668 @param bitmap The bitmap to be drawn |
669 @param left The position of the left side of the bitmap being drawn | 669 @param left The position of the left side of the bitmap being drawn |
670 @param top The position of the top side of the bitmap being drawn | 670 @param top The position of the top side of the bitmap being drawn |
671 @param paint The paint used to draw the bitmap, or NULL | 671 @param paint The paint used to draw the bitmap, or NULL |
672 */ | 672 */ |
673 virtual void drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top, | 673 virtual void drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top, |
674 const SkPaint* paint = NULL); | 674 const SkPaint* paint = NULL); |
675 | 675 |
676 enum DrawBitmapRectFlags { | 676 enum DrawBitmapRectFlags { |
677 kNone_DrawBitmapRectflag = 0x0, | 677 kNone_DrawBitmapRectFlag = 0x0, |
678 /** | 678 /** |
679 * When filtering is enabled, allow the color samples outside of | 679 * When filtering is enabled, allow the color samples outside of |
680 * the src rect (but still in the src bitmap) to bleed into the | 680 * the src rect (but still in the src bitmap) to bleed into the |
681 * drawn portion | 681 * drawn portion |
682 */ | 682 */ |
683 kBleed_DrawBitmapRectFlag = 0x1, | 683 kBleed_DrawBitmapRectFlag = 0x1, |
684 }; | 684 }; |
685 | 685 |
686 /** Draw the specified bitmap, with the specified matrix applied (before the | 686 /** Draw the specified bitmap, with the specified matrix applied (before the |
687 canvas' matrix is applied). | 687 canvas' matrix is applied). |
688 @param bitmap The bitmap to be drawn | 688 @param bitmap The bitmap to be drawn |
689 @param src Optional: specify the subset of the bitmap to be drawn | 689 @param src Optional: specify the subset of the bitmap to be drawn |
690 @param dst The destination rectangle where the scaled/translated | 690 @param dst The destination rectangle where the scaled/translated |
691 image will be drawn | 691 image will be drawn |
692 @param paint The paint used to draw the bitmap, or NULL | 692 @param paint The paint used to draw the bitmap, or NULL |
693 */ | 693 */ |
694 virtual void drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src, | 694 virtual void drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src, |
695 const SkRect& dst, | 695 const SkRect& dst, |
696 const SkPaint* paint = NULL, | 696 const SkPaint* paint = NULL, |
697 DrawBitmapRectFlags flags = kNone_DrawBitm
apRectflag); | 697 DrawBitmapRectFlags flags = kNone_DrawBitm
apRectFlag); |
698 | 698 |
699 void drawBitmapRect(const SkBitmap& bitmap, const SkRect& dst, | 699 void drawBitmapRect(const SkBitmap& bitmap, const SkRect& dst, |
700 const SkPaint* paint = NULL) { | 700 const SkPaint* paint = NULL) { |
701 this->drawBitmapRectToRect(bitmap, NULL, dst, paint, kNone_DrawBitmapRec
tflag); | 701 this->drawBitmapRectToRect(bitmap, NULL, dst, paint, kNone_DrawBitmapRec
tFlag); |
702 } | 702 } |
703 | 703 |
704 void drawBitmapRect(const SkBitmap& bitmap, const SkIRect* isrc, | 704 void drawBitmapRect(const SkBitmap& bitmap, const SkIRect* isrc, |
705 const SkRect& dst, const SkPaint* paint = NULL, | 705 const SkRect& dst, const SkPaint* paint = NULL, |
706 DrawBitmapRectFlags flags = kNone_DrawBitmapRectflag) { | 706 DrawBitmapRectFlags flags = kNone_DrawBitmapRectFlag) { |
707 SkRect realSrcStorage; | 707 SkRect realSrcStorage; |
708 SkRect* realSrcPtr = NULL; | 708 SkRect* realSrcPtr = NULL; |
709 if (isrc) { | 709 if (isrc) { |
710 realSrcStorage.set(*isrc); | 710 realSrcStorage.set(*isrc); |
711 realSrcPtr = &realSrcStorage; | 711 realSrcPtr = &realSrcStorage; |
712 } | 712 } |
713 this->drawBitmapRectToRect(bitmap, realSrcPtr, dst, paint, flags); | 713 this->drawBitmapRectToRect(bitmap, realSrcPtr, dst, paint, flags); |
714 } | 714 } |
715 | 715 |
716 virtual void drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& m, | 716 virtual void drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& m, |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1189 if (NULL != fCanvas) { | 1189 if (NULL != fCanvas) { |
1190 fCanvas->endCommentGroup(); | 1190 fCanvas->endCommentGroup(); |
1191 } | 1191 } |
1192 } | 1192 } |
1193 | 1193 |
1194 private: | 1194 private: |
1195 SkCanvas* fCanvas; | 1195 SkCanvas* fCanvas; |
1196 }; | 1196 }; |
1197 | 1197 |
1198 #endif | 1198 #endif |
OLD | NEW |