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 "SkBitmap.h" | 12 #include "SkBitmap.h" |
13 #include "SkDeque.h" | 13 #include "SkDeque.h" |
14 #include "SkPaint.h" | 14 #include "SkPaint.h" |
15 #include "SkRefCnt.h" | 15 #include "SkRefCnt.h" |
16 #include "SkRegion.h" | 16 #include "SkRegion.h" |
17 #include "SkSurfaceProps.h" | 17 #include "SkSurfaceProps.h" |
18 #include "SkXfermode.h" | 18 #include "SkXfermode.h" |
19 | 19 |
20 class GrContext; | 20 class GrContext; |
21 class GrRenderTarget; | 21 class GrRenderTarget; |
22 class SkBaseDevice; | 22 class SkBaseDevice; |
23 class SkCanvasClipVisitor; | 23 class SkCanvasClipVisitor; |
24 class SkClipStack; | 24 class SkClipStack; |
25 class SkDraw; | 25 class SkDraw; |
26 class SkDrawable; | 26 class SkDrawable; |
27 class SkDrawFilter; | 27 class SkDrawFilter; |
28 class SkImage; | 28 class SkImage; |
29 class SkImageFilter; | 29 class SkImageFilter; |
| 30 class SkLight; |
30 class SkMetaData; | 31 class SkMetaData; |
31 class SkPath; | 32 class SkPath; |
32 class SkPicture; | 33 class SkPicture; |
33 class SkPixmap; | 34 class SkPixmap; |
34 class SkRRect; | 35 class SkRRect; |
35 struct SkRSXform; | 36 struct SkRSXform; |
36 class SkSurface; | 37 class SkSurface; |
37 class SkSurface_Base; | 38 class SkSurface_Base; |
38 class SkTextBlob; | 39 class SkTextBlob; |
39 | 40 |
(...skipping 1041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1081 void drawAtlas(const SkImage* atlas, const SkRSXform xform[], const SkRect t
ex[], | 1082 void drawAtlas(const SkImage* atlas, const SkRSXform xform[], const SkRect t
ex[], |
1082 const SkColor colors[], int count, SkXfermode::Mode, const Sk
Rect* cullRect, | 1083 const SkColor colors[], int count, SkXfermode::Mode, const Sk
Rect* cullRect, |
1083 const SkPaint* paint); | 1084 const SkPaint* paint); |
1084 | 1085 |
1085 void drawAtlas(const SkImage* atlas, const SkRSXform xform[], const SkRect t
ex[], int count, | 1086 void drawAtlas(const SkImage* atlas, const SkRSXform xform[], const SkRect t
ex[], int count, |
1086 const SkRect* cullRect, const SkPaint* paint) { | 1087 const SkRect* cullRect, const SkPaint* paint) { |
1087 this->drawAtlas(atlas, xform, tex, NULL, count, SkXfermode::kDst_Mode, c
ullRect, paint); | 1088 this->drawAtlas(atlas, xform, tex, NULL, count, SkXfermode::kDst_Mode, c
ullRect, paint); |
1088 } | 1089 } |
1089 | 1090 |
1090 /** | 1091 /** |
| 1092 * Like drawAtlas, drawLitAtlas draws a set of sprites from the atlas. Each |
| 1093 * sprite must have two sets of texture rectangles however. One for its |
| 1094 * diffuse channel and the second for its normal map both of which are in |
| 1095 * the atlas. The normal-mapped sprite is lit by the specified lights. |
| 1096 */ |
| 1097 void drawLitAtlas(const SkImage* atlas, const SkRSXform xforms[], |
| 1098 const SkRect diffTex[], const SkRect normTex[], |
| 1099 const SkColor colors[], int count, SkXfermode::Mode, |
| 1100 const SkRect* cullRect, const SkPaint* paint, |
| 1101 const SkLight lights[], int numLights); |
| 1102 |
| 1103 /** |
1091 * Draw the contents of this drawable into the canvas. If the canvas is asy
nc | 1104 * Draw the contents of this drawable into the canvas. If the canvas is asy
nc |
1092 * (e.g. it is recording into a picture) then the drawable will be referenc
ed instead, | 1105 * (e.g. it is recording into a picture) then the drawable will be referenc
ed instead, |
1093 * to have its draw() method called when the picture is finalized. | 1106 * to have its draw() method called when the picture is finalized. |
1094 * | 1107 * |
1095 * If the intent is to force the contents of the drawable into this canvas
immediately, | 1108 * If the intent is to force the contents of the drawable into this canvas
immediately, |
1096 * then drawable->draw(canvas) may be called. | 1109 * then drawable->draw(canvas) may be called. |
1097 */ | 1110 */ |
1098 void drawDrawable(SkDrawable* drawable, const SkMatrix* = NULL); | 1111 void drawDrawable(SkDrawable* drawable, const SkMatrix* = NULL); |
1099 void drawDrawable(SkDrawable*, SkScalar x, SkScalar y); | 1112 void drawDrawable(SkDrawable*, SkScalar x, SkScalar y); |
1100 | 1113 |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1266 virtual void onDrawRect(const SkRect&, const SkPaint&); | 1279 virtual void onDrawRect(const SkRect&, const SkPaint&); |
1267 virtual void onDrawOval(const SkRect&, const SkPaint&); | 1280 virtual void onDrawOval(const SkRect&, const SkPaint&); |
1268 virtual void onDrawRRect(const SkRRect&, const SkPaint&); | 1281 virtual void onDrawRRect(const SkRRect&, const SkPaint&); |
1269 virtual void onDrawPoints(PointMode, size_t count, const SkPoint pts[], cons
t SkPaint&); | 1282 virtual void onDrawPoints(PointMode, size_t count, const SkPoint pts[], cons
t SkPaint&); |
1270 virtual void onDrawVertices(VertexMode, int vertexCount, const SkPoint verti
ces[], | 1283 virtual void onDrawVertices(VertexMode, int vertexCount, const SkPoint verti
ces[], |
1271 const SkPoint texs[], const SkColor colors[], Sk
Xfermode*, | 1284 const SkPoint texs[], const SkColor colors[], Sk
Xfermode*, |
1272 const uint16_t indices[], int indexCount, const
SkPaint&); | 1285 const uint16_t indices[], int indexCount, const
SkPaint&); |
1273 | 1286 |
1274 virtual void onDrawAtlas(const SkImage*, const SkRSXform[], const SkRect[],
const SkColor[], | 1287 virtual void onDrawAtlas(const SkImage*, const SkRSXform[], const SkRect[],
const SkColor[], |
1275 int count, SkXfermode::Mode, const SkRect* cull, co
nst SkPaint*); | 1288 int count, SkXfermode::Mode, const SkRect* cull, co
nst SkPaint*); |
| 1289 virtual void onDrawLitAtlas(const SkImage*, const SkRSXform[], |
| 1290 const SkRect diffTex[], const SkRect normTex[],
const SkColor[], |
| 1291 int count, SkXfermode::Mode, const SkRect* cull,
const SkPaint*, |
| 1292 const SkLight lights[], int numLights); |
1276 virtual void onDrawPath(const SkPath&, const SkPaint&); | 1293 virtual void onDrawPath(const SkPath&, const SkPaint&); |
1277 virtual void onDrawImage(const SkImage*, SkScalar dx, SkScalar dy, const SkP
aint*); | 1294 virtual void onDrawImage(const SkImage*, SkScalar dx, SkScalar dy, const SkP
aint*); |
1278 virtual void onDrawImageRect(const SkImage*, const SkRect*, const SkRect&, c
onst SkPaint*, | 1295 virtual void onDrawImageRect(const SkImage*, const SkRect*, const SkRect&, c
onst SkPaint*, |
1279 SrcRectConstraint); | 1296 SrcRectConstraint); |
1280 virtual void onDrawImageNine(const SkImage*, const SkIRect& center, const Sk
Rect& dst, | 1297 virtual void onDrawImageNine(const SkImage*, const SkIRect& center, const Sk
Rect& dst, |
1281 const SkPaint*); | 1298 const SkPaint*); |
1282 | 1299 |
1283 virtual void onDrawBitmap(const SkBitmap&, SkScalar dx, SkScalar dy, const S
kPaint*); | 1300 virtual void onDrawBitmap(const SkBitmap&, SkScalar dx, SkScalar dy, const S
kPaint*); |
1284 virtual void onDrawBitmapRect(const SkBitmap&, const SkRect*, const SkRect&,
const SkPaint*, | 1301 virtual void onDrawBitmapRect(const SkBitmap&, const SkRect*, const SkRect&,
const SkPaint*, |
1285 SrcRectConstraint); | 1302 SrcRectConstraint); |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1565 | 1582 |
1566 class SkCanvasClipVisitor { | 1583 class SkCanvasClipVisitor { |
1567 public: | 1584 public: |
1568 virtual ~SkCanvasClipVisitor(); | 1585 virtual ~SkCanvasClipVisitor(); |
1569 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; | 1586 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; |
1570 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; | 1587 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; |
1571 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; | 1588 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; |
1572 }; | 1589 }; |
1573 | 1590 |
1574 #endif | 1591 #endif |
OLD | NEW |