blob: 232ba9b8ee4a5fb860dc8b4b705d4905b61741a0 [file] [log] [blame]
reed@google.com74ce6f02013-05-22 15:13:18 +00001/*
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 SkLua_DEFINED
9#define SkLua_DEFINED
10
11#include "SkColor.h"
12#include "SkScalar.h"
13
14struct lua_State;
15
16class SkCanvas;
17class SkMatrix;
18class SkPaint;
19class SkPath;
20struct SkRect;
21class SkRRect;
22class SkString;
23
24#define SkScalarToLua(x) SkScalarToDouble(x)
25#define SkLuaToScalar(x) SkDoubleToScalar(x)
26
27class SkLua {
28public:
29 static void Load(lua_State*);
30
31 SkLua(lua_State*);
32 ~SkLua();
33
34 lua_State* getL() const { return fL; }
35
36 void pushBool(bool, const char tableKey[] = NULL);
37 void pushString(const char[], const char tableKey[] = NULL);
38 void pushString(const SkString&, const char tableKey[] = NULL);
39 void pushColor(SkColor, const char tableKey[] = NULL);
40 void pushScalar(SkScalar, const char tableKey[] = NULL);
41 void pushRect(const SkRect&, const char tableKey[] = NULL);
42 void pushRRect(const SkRRect&, const char tableKey[] = NULL);
43 void pushMatrix(const SkMatrix&, const char tableKey[] = NULL);
44 void pushPaint(const SkPaint&, const char tableKey[] = NULL);
45 void pushPath(const SkPath&, const char tableKey[] = NULL);
46 void pushCanvas(SkCanvas*, const char tableKey[] = NULL);
47
48private:
49 lua_State* fL;
50};
51
52#endif