reed@google.com | dff7e11 | 2013-05-15 19:34:20 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2013 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | #ifndef SkLuaCanvas_DEFINED |
| 9 | #define SkLuaCanvas_DEFINED |
| 10 | |
| 11 | #include "SkCanvas.h" |
| 12 | #include "SkString.h" |
| 13 | |
| 14 | struct lua_State; |
| 15 | |
| 16 | class SkLuaCanvas : public SkCanvas { |
| 17 | public: |
mike@reedtribe.org | f02fe3d | 2013-05-21 12:20:39 +0000 | [diff] [blame] | 18 | void pushThis(); |
| 19 | |
reed@google.com | dff7e11 | 2013-05-15 19:34:20 +0000 | [diff] [blame] | 20 | SkLuaCanvas(int width, int height, lua_State*, const char function[]); |
| 21 | virtual ~SkLuaCanvas(); |
| 22 | |
reed@google.com | dff7e11 | 2013-05-15 19:34:20 +0000 | [diff] [blame] | 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; |
bsalomon@google.com | 7ce564c | 2013-10-22 16:54:15 +0000 | [diff] [blame] | 27 | virtual void drawRect(const SkRect&, const SkPaint& paint) SK_OVERRIDE; |
reed@google.com | dff7e11 | 2013-05-15 19:34:20 +0000 | [diff] [blame] | 28 | virtual void drawRRect(const SkRRect&, const SkPaint& paint) SK_OVERRIDE; |
bsalomon@google.com | 7ce564c | 2013-10-22 16:54:15 +0000 | [diff] [blame] | 29 | virtual void drawPath(const SkPath& path, const SkPaint& paint) SK_OVERRIDE; |
reed@google.com | dff7e11 | 2013-05-15 19:34:20 +0000 | [diff] [blame] | 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, |
commit-bot@chromium.org | eed779d | 2013-08-16 10:24:37 +0000 | [diff] [blame] | 33 | const SkRect& dst, const SkPaint* paint, |
| 34 | DrawBitmapRectFlags flags) SK_OVERRIDE; |
reed@google.com | dff7e11 | 2013-05-15 19:34:20 +0000 | [diff] [blame] | 35 | virtual void drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& m, |
| 36 | const SkPaint* paint) SK_OVERRIDE; |
| 37 | virtual void drawSprite(const SkBitmap& bitmap, int left, int top, |
| 38 | const SkPaint* paint) SK_OVERRIDE; |
reed@google.com | dff7e11 | 2013-05-15 19:34:20 +0000 | [diff] [blame] | 39 | virtual void drawVertices(VertexMode vmode, int vertexCount, |
| 40 | const SkPoint vertices[], const SkPoint texs[], |
| 41 | const SkColor colors[], SkXfermode* xmode, |
| 42 | const uint16_t indices[], int indexCount, |
| 43 | const SkPaint& paint) SK_OVERRIDE; |
| 44 | virtual void drawData(const void* data, size_t length) SK_OVERRIDE; |
| 45 | |
commit-bot@chromium.org | ab58273 | 2014-02-21 12:20:45 +0000 | [diff] [blame] | 46 | protected: |
Florin Malita | 5f6102d | 2014-06-30 10:13:28 -0400 | [diff] [blame] | 47 | virtual void willSave() SK_OVERRIDE; |
commit-bot@chromium.org | e54a23f | 2014-03-12 20:21:48 +0000 | [diff] [blame] | 48 | virtual SaveLayerStrategy willSaveLayer(const SkRect*, const SkPaint*, SaveFlags) SK_OVERRIDE; |
| 49 | virtual void willRestore() SK_OVERRIDE; |
| 50 | |
commit-bot@chromium.org | 44c48d0 | 2014-03-13 20:03:58 +0000 | [diff] [blame] | 51 | virtual void didConcat(const SkMatrix&) SK_OVERRIDE; |
| 52 | virtual void didSetMatrix(const SkMatrix&) SK_OVERRIDE; |
| 53 | |
commit-bot@chromium.org | ab58273 | 2014-02-21 12:20:45 +0000 | [diff] [blame] | 54 | virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK_OVERRIDE; |
reed@google.com | e0d9ce8 | 2014-04-23 04:00:17 +0000 | [diff] [blame] | 55 | virtual void onDrawText(const void* text, size_t byteLength, SkScalar x, SkScalar y, |
| 56 | const SkPaint&) SK_OVERRIDE; |
| 57 | virtual void onDrawPosText(const void* text, size_t byteLength, const SkPoint pos[], |
| 58 | const SkPaint&) SK_OVERRIDE; |
| 59 | virtual void onDrawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[], |
| 60 | SkScalar constY, const SkPaint&) SK_OVERRIDE; |
| 61 | virtual void onDrawTextOnPath(const void* text, size_t byteLength, const SkPath& path, |
| 62 | const SkMatrix* matrix, const SkPaint&) SK_OVERRIDE; |
commit-bot@chromium.org | ab58273 | 2014-02-21 12:20:45 +0000 | [diff] [blame] | 63 | |
robertphillips@google.com | 8f90a89 | 2014-02-28 18:19:39 +0000 | [diff] [blame] | 64 | virtual void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE; |
| 65 | virtual void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE; |
| 66 | virtual void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE; |
| 67 | virtual void onClipRegion(const SkRegion&, SkRegion::Op) SK_OVERRIDE; |
| 68 | |
reed | d5fa1a4 | 2014-08-09 11:08:05 -0700 | [diff] [blame] | 69 | virtual void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) SK_OVERRIDE; |
robertphillips | 9b14f26 | 2014-06-04 05:40:44 -0700 | [diff] [blame] | 70 | |
reed@google.com | dff7e11 | 2013-05-15 19:34:20 +0000 | [diff] [blame] | 71 | private: |
| 72 | lua_State* fL; |
| 73 | SkString fFunc; |
skia.committer@gmail.com | 539f364 | 2013-05-16 07:01:00 +0000 | [diff] [blame] | 74 | |
reed@google.com | dff7e11 | 2013-05-15 19:34:20 +0000 | [diff] [blame] | 75 | void sendverb(const char verb[]); |
| 76 | |
| 77 | typedef SkCanvas INHERITED; |
| 78 | }; |
| 79 | |
| 80 | #endif |