OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
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 SkLuaCanvas_DEFINED | 8 #ifndef SkLuaCanvas_DEFINED |
9 #define SkLuaCanvas_DEFINED | 9 #define SkLuaCanvas_DEFINED |
10 | 10 |
11 #include "SkCanvas.h" | 11 #include "SkCanvas.h" |
12 #include "SkString.h" | 12 #include "SkString.h" |
13 | 13 |
14 struct lua_State; | 14 struct lua_State; |
15 | 15 |
16 class SkLuaCanvas : public SkCanvas { | 16 class SkLuaCanvas : public SkCanvas { |
17 public: | 17 public: |
18 void pushThis(); | 18 void pushThis(); |
19 | 19 |
20 SkLuaCanvas(int width, int height, lua_State*, const char function[]); | 20 SkLuaCanvas(int width, int height, lua_State*, const char function[]); |
21 virtual ~SkLuaCanvas(); | 21 virtual ~SkLuaCanvas(); |
22 | 22 |
| 23 virtual void drawPaint(const SkPaint& paint) SK_OVERRIDE; |
| 24 virtual void drawPoints(PointMode mode, size_t count, const SkPoint pts[], |
| 25 const SkPaint& paint) SK_OVERRIDE; |
| 26 virtual void drawOval(const SkRect&, const SkPaint& paint) SK_OVERRIDE; |
| 27 virtual void drawRect(const SkRect&, const SkPaint& paint) SK_OVERRIDE; |
| 28 virtual void drawRRect(const SkRRect&, const SkPaint& paint) SK_OVERRIDE; |
| 29 virtual void drawPath(const SkPath& path, const SkPaint& paint) SK_OVERRIDE; |
| 30 virtual void drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top, |
| 31 const SkPaint* paint) SK_OVERRIDE; |
| 32 virtual void drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src, |
| 33 const SkRect& dst, const SkPaint* paint, |
| 34 DrawBitmapRectFlags flags) SK_OVERRIDE; |
| 35 virtual void drawSprite(const SkBitmap& bitmap, int left, int top, |
| 36 const SkPaint* paint) SK_OVERRIDE; |
| 37 virtual void drawVertices(VertexMode vmode, int vertexCount, |
| 38 const SkPoint vertices[], const SkPoint texs[], |
| 39 const SkColor colors[], SkXfermode* xmode, |
| 40 const uint16_t indices[], int indexCount, |
| 41 const SkPaint& paint) SK_OVERRIDE; |
| 42 |
23 protected: | 43 protected: |
24 virtual void willSave() SK_OVERRIDE; | 44 virtual void willSave() SK_OVERRIDE; |
25 virtual SaveLayerStrategy willSaveLayer(const SkRect*, const SkPaint*, SaveF
lags) SK_OVERRIDE; | 45 virtual SaveLayerStrategy willSaveLayer(const SkRect*, const SkPaint*, SaveF
lags) SK_OVERRIDE; |
26 virtual void willRestore() SK_OVERRIDE; | 46 virtual void willRestore() SK_OVERRIDE; |
27 | 47 |
28 virtual void didConcat(const SkMatrix&) SK_OVERRIDE; | 48 virtual void didConcat(const SkMatrix&) SK_OVERRIDE; |
29 virtual void didSetMatrix(const SkMatrix&) SK_OVERRIDE; | 49 virtual void didSetMatrix(const SkMatrix&) SK_OVERRIDE; |
30 | 50 |
31 virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK
_OVERRIDE; | 51 virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK
_OVERRIDE; |
32 virtual void onDrawText(const void* text, size_t byteLength, SkScalar x, SkS
calar y, | 52 virtual void onDrawText(const void* text, size_t byteLength, SkScalar x, SkS
calar y, |
33 const SkPaint&) SK_OVERRIDE; | 53 const SkPaint&) SK_OVERRIDE; |
34 virtual void onDrawPosText(const void* text, size_t byteLength, const SkPoin
t pos[], | 54 virtual void onDrawPosText(const void* text, size_t byteLength, const SkPoin
t pos[], |
35 const SkPaint&) SK_OVERRIDE; | 55 const SkPaint&) SK_OVERRIDE; |
36 virtual void onDrawPosTextH(const void* text, size_t byteLength, const SkSca
lar xpos[], | 56 virtual void onDrawPosTextH(const void* text, size_t byteLength, const SkSca
lar xpos[], |
37 SkScalar constY, const SkPaint&) SK_OVERRIDE; | 57 SkScalar constY, const SkPaint&) SK_OVERRIDE; |
38 virtual void onDrawTextOnPath(const void* text, size_t byteLength, const SkP
ath& path, | 58 virtual void onDrawTextOnPath(const void* text, size_t byteLength, const SkP
ath& path, |
39 const SkMatrix* matrix, const SkPaint&) SK_OVE
RRIDE; | 59 const SkMatrix* matrix, const SkPaint&) SK_OVE
RRIDE; |
40 virtual void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, | 60 virtual void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, |
41 const SkPaint& paint) SK_OVERRIDE; | 61 const SkPaint& paint) SK_OVERRIDE; |
42 | 62 |
43 void onDrawPaint(const SkPaint&) SK_OVERRIDE; | |
44 void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPain
t&) SK_OVERRIDE; | |
45 void onDrawRect(const SkRect&, const SkPaint&) SK_OVERRIDE; | |
46 void onDrawOval(const SkRect&, const SkPaint&) SK_OVERRIDE; | |
47 void onDrawRRect(const SkRRect&, const SkPaint&) SK_OVERRIDE; | |
48 void onDrawPath(const SkPath&, const SkPaint&) SK_OVERRIDE; | |
49 void onDrawBitmap(const SkBitmap&, SkScalar left, SkScalar top, const SkPain
t*) SK_OVERRIDE; | |
50 void onDrawBitmapRect(const SkBitmap&, const SkRect* src, const SkRect& dst,
const SkPaint*, | |
51 DrawBitmapRectFlags flags) SK_OVERRIDE; | |
52 void onDrawImage(const SkImage*, SkScalar left, SkScalar top, const SkPaint*
) SK_OVERRIDE; | |
53 void onDrawImageRect(const SkImage*, const SkRect* src, const SkRect& dst, | |
54 const SkPaint*) SK_OVERRIDE; | |
55 void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect&
dst, | |
56 const SkPaint*) SK_OVERRIDE; | |
57 void onDrawSprite(const SkBitmap&, int left, int top, const SkPaint*) SK_OVE
RRIDE; | |
58 void onDrawVertices(VertexMode vmode, int vertexCount, | |
59 const SkPoint vertices[], const SkPoint texs[], | |
60 const SkColor colors[], SkXfermode* xmode, | |
61 const uint16_t indices[], int indexCount, | |
62 const SkPaint&) SK_OVERRIDE; | |
63 | |
64 virtual void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERR
IDE; | 63 virtual void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERR
IDE; |
65 virtual void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVE
RRIDE; | 64 virtual void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVE
RRIDE; |
66 virtual void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERR
IDE; | 65 virtual void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERR
IDE; |
67 virtual void onClipRegion(const SkRegion&, SkRegion::Op) SK_OVERRIDE; | 66 virtual void onClipRegion(const SkRegion&, SkRegion::Op) SK_OVERRIDE; |
68 | 67 |
69 virtual void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*
) SK_OVERRIDE; | 68 virtual void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*
) SK_OVERRIDE; |
70 | 69 |
71 private: | 70 private: |
72 lua_State* fL; | 71 lua_State* fL; |
73 SkString fFunc; | 72 SkString fFunc; |
74 | 73 |
75 void sendverb(const char verb[]); | 74 void sendverb(const char verb[]); |
76 | 75 |
77 typedef SkCanvas INHERITED; | 76 typedef SkCanvas INHERITED; |
78 }; | 77 }; |
79 | 78 |
80 #endif | 79 #endif |
OLD | NEW |