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 |
11 #include "SkTypes.h" | 11 #include "SkTypes.h" |
| 12 #include "SkBlendMode.h" |
12 #include "SkBitmap.h" | 13 #include "SkBitmap.h" |
13 #include "SkClipOp.h" | 14 #include "SkClipOp.h" |
14 #include "SkDeque.h" | 15 #include "SkDeque.h" |
15 #include "SkImage.h" | 16 #include "SkImage.h" |
16 #include "SkPaint.h" | 17 #include "SkPaint.h" |
17 #include "SkRefCnt.h" | 18 #include "SkRefCnt.h" |
18 #include "SkRegion.h" | 19 #include "SkRegion.h" |
19 #include "SkSurfaceProps.h" | 20 #include "SkSurfaceProps.h" |
20 #include "SkXfermode.h" | 21 #include "SkXfermode.h" |
21 #include "SkLights.h" | 22 #include "SkLights.h" |
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 | 589 |
589 | 590 |
590 /** Fill the entire canvas' bitmap (restricted to the current clip) with the | 591 /** Fill the entire canvas' bitmap (restricted to the current clip) with the |
591 specified ARGB color, using the specified mode. | 592 specified ARGB color, using the specified mode. |
592 @param a the alpha component (0..255) of the color to fill the canvas | 593 @param a the alpha component (0..255) of the color to fill the canvas |
593 @param r the red component (0..255) of the color to fill the canvas | 594 @param r the red component (0..255) of the color to fill the canvas |
594 @param g the green component (0..255) of the color to fill the canvas | 595 @param g the green component (0..255) of the color to fill the canvas |
595 @param b the blue component (0..255) of the color to fill the canvas | 596 @param b the blue component (0..255) of the color to fill the canvas |
596 @param mode the mode to apply the color in (defaults to SrcOver) | 597 @param mode the mode to apply the color in (defaults to SrcOver) |
597 */ | 598 */ |
598 void drawARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b, | 599 void drawARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b, SkBlendMode mode = SkBlend
Mode::kSrcOver); |
599 SkXfermode::Mode mode = SkXfermode::kSrcOver_Mode); | 600 #ifdef SK_SUPPORT_LEGACY_XFERMODE_OBJECT |
| 601 void drawARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b, SkXfermode::Mode mode) { |
| 602 this->drawARGB(a, r, g, b, (SkBlendMode)mode); |
| 603 } |
| 604 #endif |
600 | 605 |
601 /** Fill the entire canvas' bitmap (restricted to the current clip) with the | 606 /** Fill the entire canvas' bitmap (restricted to the current clip) with the |
602 specified color and mode. | 607 specified color and mode. |
603 @param color the color to draw with | 608 @param color the color to draw with |
604 @param mode the mode to apply the color in (defaults to SrcOver) | 609 @param mode the mode to apply the color in (defaults to SrcOver) |
605 */ | 610 */ |
606 void drawColor(SkColor color, SkXfermode::Mode mode = SkXfermode::kSrcOver_M
ode); | 611 void drawColor(SkColor color, SkBlendMode mode = SkBlendMode::kSrcOver); |
| 612 #ifdef SK_SUPPORT_LEGACY_XFERMODE_OBJECT |
| 613 void drawColor(SkColor color, SkXfermode::Mode mode) { |
| 614 this->drawColor(color, (SkBlendMode)mode); |
| 615 } |
| 616 #endif |
607 | 617 |
608 /** | 618 /** |
609 * Helper method for drawing a color in SRC mode, completely replacing all
the pixels | 619 * Helper method for drawing a color in SRC mode, completely replacing all
the pixels |
610 * in the current clip with this color. | 620 * in the current clip with this color. |
611 */ | 621 */ |
612 void clear(SkColor color) { | 622 void clear(SkColor color) { |
613 this->drawColor(color, SkXfermode::kSrc_Mode); | 623 this->drawColor(color, SkBlendMode::kSrc); |
614 } | 624 } |
615 | 625 |
616 /** | 626 /** |
617 * This makes the contents of the canvas undefined. Subsequent calls that | 627 * This makes the contents of the canvas undefined. Subsequent calls that |
618 * require reading the canvas contents will produce undefined results. Examp
les | 628 * require reading the canvas contents will produce undefined results. Examp
les |
619 * include blending and readPixels. The actual implementation is backend- | 629 * include blending and readPixels. The actual implementation is backend- |
620 * dependent and one legal implementation is to do nothing. This method | 630 * dependent and one legal implementation is to do nothing. This method |
621 * ignores the current clip. | 631 * ignores the current clip. |
622 * | 632 * |
623 * This function should only be called if the caller intends to subsequently | 633 * This function should only be called if the caller intends to subsequently |
(...skipping 1131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1755 | 1765 |
1756 class SkCanvasClipVisitor { | 1766 class SkCanvasClipVisitor { |
1757 public: | 1767 public: |
1758 virtual ~SkCanvasClipVisitor(); | 1768 virtual ~SkCanvasClipVisitor(); |
1759 virtual void clipRect(const SkRect&, SkCanvas::ClipOp, bool antialias) = 0; | 1769 virtual void clipRect(const SkRect&, SkCanvas::ClipOp, bool antialias) = 0; |
1760 virtual void clipRRect(const SkRRect&, SkCanvas::ClipOp, bool antialias) = 0
; | 1770 virtual void clipRRect(const SkRRect&, SkCanvas::ClipOp, bool antialias) = 0
; |
1761 virtual void clipPath(const SkPath&, SkCanvas::ClipOp, bool antialias) = 0; | 1771 virtual void clipPath(const SkPath&, SkCanvas::ClipOp, bool antialias) = 0; |
1762 }; | 1772 }; |
1763 | 1773 |
1764 #endif | 1774 #endif |
OLD | NEW |