blob: 3c21c9c0f4c93e3fc8e2908ef8032464a27f114d [file] [log] [blame]
commit-bot@chromium.orgc8d73282014-01-06 18:17:24 +00001/*
2 * Copyright 2014 Google Inc.
3 *
4 *
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
7 *
8 */
9
10#ifndef SkV8Example_Path_DEFINED
11#define SkV8Example_Path_DEFINED
12
13#include <v8.h>
14
15#include "SkPath.h"
16#include "SkTypes.h"
17
18class Global;
19
20class Path : SkNoncopyable {
21public:
22 Path() : fSkPath() {}
23 virtual ~Path() {}
24
25 const SkPath& getSkPath() { return fSkPath; }
26
27 // The JS Path constuctor implementation.
28 static void ConstructPath(const v8::FunctionCallbackInfo<v8::Value>& args);
29
30 // Add the Path JS constructor to the global context.
31 static void AddToGlobal(Global* global);
32
33 // Path JS methods.
34 static void ClosePath(const v8::FunctionCallbackInfo<v8::Value>& args);
35 static void MoveTo(const v8::FunctionCallbackInfo<v8::Value>& args);
36 static void LineTo(const v8::FunctionCallbackInfo<v8::Value>& args);
37 static void QuadraticCurveTo(
38 const v8::FunctionCallbackInfo<v8::Value>& args);
39 static void BezierCurveTo(const v8::FunctionCallbackInfo<v8::Value>& args);
40 static void Arc(const v8::FunctionCallbackInfo<v8::Value>& args);
41 static void Rect(const v8::FunctionCallbackInfo<v8::Value>& args);
commit-bot@chromium.orgcd110182014-01-10 21:33:01 +000042 static void Oval(const v8::FunctionCallbackInfo<v8::Value>& args);
commit-bot@chromium.orgc8d73282014-01-06 18:17:24 +000043private:
44 SkPath fSkPath;
45
46 static Path* Unwrap(const v8::FunctionCallbackInfo<v8::Value>& args);
47
48 static Global* gGlobal;
49};
50
51#endif