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 |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 class SkBaseDevice; | 22 class SkBaseDevice; |
23 class SkCanvasClipVisitor; | 23 class SkCanvasClipVisitor; |
24 class SkDraw; | 24 class SkDraw; |
25 class SkDrawable; | 25 class SkDrawable; |
26 class SkDrawFilter; | 26 class SkDrawFilter; |
27 class SkImage; | 27 class SkImage; |
28 class SkMetaData; | 28 class SkMetaData; |
29 class SkPicture; | 29 class SkPicture; |
30 class SkRRect; | 30 class SkRRect; |
| 31 struct SkRSXform; |
31 class SkSurface; | 32 class SkSurface; |
32 class SkSurface_Base; | 33 class SkSurface_Base; |
33 class SkTextBlob; | 34 class SkTextBlob; |
34 class GrContext; | 35 class GrContext; |
35 class GrRenderTarget; | 36 class GrRenderTarget; |
36 | 37 |
37 class SkCanvasState; | 38 class SkCanvasState; |
38 | 39 |
39 /** \class SkCanvas | 40 /** \class SkCanvas |
40 | 41 |
(...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1017 @param texCoords specifies the texture coordinates that will be bilerp acro
ss the patch, | 1018 @param texCoords specifies the texture coordinates that will be bilerp acro
ss the patch, |
1018 their order is the same as the colors. | 1019 their order is the same as the colors. |
1019 @param xmode specifies how are the colors and the textures combined if both
of them are | 1020 @param xmode specifies how are the colors and the textures combined if both
of them are |
1020 present. | 1021 present. |
1021 @param paint Specifies the shader/texture if present. | 1022 @param paint Specifies the shader/texture if present. |
1022 */ | 1023 */ |
1023 void drawPatch(const SkPoint cubics[12], const SkColor colors[4], | 1024 void drawPatch(const SkPoint cubics[12], const SkColor colors[4], |
1024 const SkPoint texCoords[4], SkXfermode* xmode, const SkPaint&
paint); | 1025 const SkPoint texCoords[4], SkXfermode* xmode, const SkPaint&
paint); |
1025 | 1026 |
1026 /** | 1027 /** |
| 1028 * Draw a set of sprites from the atlas. Each is specified by a tex rectang
le in the |
| 1029 * coordinate space of the atlas, and a corresponding xform which transform
s the tex rectangle |
| 1030 * into a quad. |
| 1031 * |
| 1032 * xform maps [0, 0, tex.width, tex.height] -> quad |
| 1033 * |
| 1034 * The color array is optional. When specified, each color modulates the pi
xels in its |
| 1035 * corresponding quad (via SkXfermode::kModulate_Mode). As a simple example
, passing white |
| 1036 * but with a non-opaque alpha will result in fading the quad. |
| 1037 * |
| 1038 * The cullRect is optional. When specified, it must be a conservative boun
ds of all of the |
| 1039 * resulting transformed quads, allowing the canvas to skip drawing if the
cullRect does not |
| 1040 * intersect the current clip. |
| 1041 * |
| 1042 * The paint is optional. If specified, its antialiasing, alpha, color-filt
er, image-filter |
| 1043 * and xfermode are used to affect each of the quads. |
| 1044 */ |
| 1045 void drawAtlas(const SkImage* atlas, const SkRSXform[], const SkRect tex[],
const SkColor[], |
| 1046 int count, const SkRect* cullRect, const SkPaint* paint); |
| 1047 |
| 1048 /** |
1027 * Draw the contents of this drawable into the canvas. If the canvas is asy
nc | 1049 * Draw the contents of this drawable into the canvas. If the canvas is asy
nc |
1028 * (e.g. it is recording into a picture) then the drawable will be referenc
ed instead, | 1050 * (e.g. it is recording into a picture) then the drawable will be referenc
ed instead, |
1029 * to have its draw() method called when the picture is finalized. | 1051 * to have its draw() method called when the picture is finalized. |
1030 * | 1052 * |
1031 * If the intent is to force the contents of the drawable into this canvas
immediately, | 1053 * If the intent is to force the contents of the drawable into this canvas
immediately, |
1032 * then drawable->draw(canvas) may be called. | 1054 * then drawable->draw(canvas) may be called. |
1033 */ | 1055 */ |
1034 void drawDrawable(SkDrawable* drawable); | 1056 void drawDrawable(SkDrawable* drawable); |
1035 | 1057 |
1036 /** Add comments. beginCommentGroup/endCommentGroup open/close a new group. | 1058 /** Add comments. beginCommentGroup/endCommentGroup open/close a new group. |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1204 virtual void onDrawDrawable(SkDrawable*); | 1226 virtual void onDrawDrawable(SkDrawable*); |
1205 | 1227 |
1206 virtual void onDrawPaint(const SkPaint&); | 1228 virtual void onDrawPaint(const SkPaint&); |
1207 virtual void onDrawRect(const SkRect&, const SkPaint&); | 1229 virtual void onDrawRect(const SkRect&, const SkPaint&); |
1208 virtual void onDrawOval(const SkRect&, const SkPaint&); | 1230 virtual void onDrawOval(const SkRect&, const SkPaint&); |
1209 virtual void onDrawRRect(const SkRRect&, const SkPaint&); | 1231 virtual void onDrawRRect(const SkRRect&, const SkPaint&); |
1210 virtual void onDrawPoints(PointMode, size_t count, const SkPoint pts[], cons
t SkPaint&); | 1232 virtual void onDrawPoints(PointMode, size_t count, const SkPoint pts[], cons
t SkPaint&); |
1211 virtual void onDrawVertices(VertexMode, int vertexCount, const SkPoint verti
ces[], | 1233 virtual void onDrawVertices(VertexMode, int vertexCount, const SkPoint verti
ces[], |
1212 const SkPoint texs[], const SkColor colors[], Sk
Xfermode*, | 1234 const SkPoint texs[], const SkColor colors[], Sk
Xfermode*, |
1213 const uint16_t indices[], int indexCount, const
SkPaint&); | 1235 const uint16_t indices[], int indexCount, const
SkPaint&); |
| 1236 virtual void onDrawAtlas(const SkImage*, const SkRSXform[], const SkRect[],
const SkColor[], |
| 1237 int count, const SkRect* cull, const SkPaint*); |
1214 virtual void onDrawPath(const SkPath&, const SkPaint&); | 1238 virtual void onDrawPath(const SkPath&, const SkPaint&); |
1215 virtual void onDrawImage(const SkImage*, SkScalar dx, SkScalar dy, const SkP
aint*); | 1239 virtual void onDrawImage(const SkImage*, SkScalar dx, SkScalar dy, const SkP
aint*); |
1216 virtual void onDrawImageRect(const SkImage*, const SkRect*, const SkRect&, c
onst SkPaint*); | 1240 virtual void onDrawImageRect(const SkImage*, const SkRect*, const SkRect&, c
onst SkPaint*); |
1217 virtual void onDrawBitmap(const SkBitmap&, SkScalar dx, SkScalar dy, const S
kPaint*); | 1241 virtual void onDrawBitmap(const SkBitmap&, SkScalar dx, SkScalar dy, const S
kPaint*); |
1218 virtual void onDrawBitmapRect(const SkBitmap&, const SkRect*, const SkRect&,
const SkPaint*, | 1242 virtual void onDrawBitmapRect(const SkBitmap&, const SkRect*, const SkRect&,
const SkPaint*, |
1219 DrawBitmapRectFlags); | 1243 DrawBitmapRectFlags); |
1220 virtual void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const
SkRect& dst, | 1244 virtual void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const
SkRect& dst, |
1221 const SkPaint*); | 1245 const SkPaint*); |
1222 virtual void onDrawSprite(const SkBitmap&, int left, int top, const SkPaint*
); | 1246 virtual void onDrawSprite(const SkBitmap&, int left, int top, const SkPaint*
); |
1223 | 1247 |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1503 | 1527 |
1504 class SkCanvasClipVisitor { | 1528 class SkCanvasClipVisitor { |
1505 public: | 1529 public: |
1506 virtual ~SkCanvasClipVisitor(); | 1530 virtual ~SkCanvasClipVisitor(); |
1507 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; | 1531 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; |
1508 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; | 1532 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; |
1509 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; | 1533 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; |
1510 }; | 1534 }; |
1511 | 1535 |
1512 #endif | 1536 #endif |
OLD | NEW |