Initial work on Cairo bindings
This commit is contained in:
6
.gitmodules
vendored
6
.gitmodules
vendored
@@ -34,3 +34,9 @@
|
||||
[submodule "project/lib/openal-android"]
|
||||
path = project/lib/openal-android
|
||||
url = https://github.com/native-toolkit/openal-android
|
||||
[submodule "project/lib/cairo"]
|
||||
path = project/lib/cairo
|
||||
url = https://github.com/native-toolkit/cairo
|
||||
[submodule "project/lib/pixman"]
|
||||
path = project/lib/pixman
|
||||
url = https://github.com/native-toolkit/pixman
|
||||
|
||||
76
lime/graphics/CairoRenderContext.hx
Normal file
76
lime/graphics/CairoRenderContext.hx
Normal file
@@ -0,0 +1,76 @@
|
||||
package lime.graphics; #if (cpp || neko || nodejs)
|
||||
|
||||
|
||||
import lime.system.System;
|
||||
|
||||
|
||||
class CairoRenderContext {
|
||||
|
||||
|
||||
public var version (get, null):Int;
|
||||
public var versionString (get, null):String;
|
||||
|
||||
|
||||
public function new () {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Get & Set Methods
|
||||
|
||||
|
||||
|
||||
|
||||
private function get_version ():Int {
|
||||
|
||||
return lime_cairo_version ();
|
||||
|
||||
}
|
||||
|
||||
|
||||
private function get_versionString ():String {
|
||||
|
||||
return lime_cairo_version_string ();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Native Methods
|
||||
|
||||
|
||||
|
||||
|
||||
private var lime_cairo_version = System.load ("lime", "lime_cairo_version", 0);
|
||||
private var lime_cairo_version_string = System.load ("lime", "lime_cairo_version_string", 0);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#else
|
||||
|
||||
|
||||
class CairoRenderContext {
|
||||
|
||||
|
||||
public function new () {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function version ():Int { return 0 };
|
||||
public function versionString ():String { return "" };
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#end
|
||||
@@ -13,6 +13,7 @@ enum RenderContext {
|
||||
CANVAS (context:CanvasRenderContext);
|
||||
DOM (element:DOMRenderContext);
|
||||
FLASH (stage:FlashRenderContext);
|
||||
CAIRO (context:CairoRenderContext);
|
||||
CONSOLE (context:ConsoleRenderContext);
|
||||
CUSTOM (data:Dynamic);
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
<set name="lime-legacy" value="1" if="legacy || lime_legacy" />
|
||||
<set name="ios" value="1" if="iphone" />
|
||||
|
||||
<set name="LIME_CAIRO" value="1" if="LIME_CAIRO" />
|
||||
<set name="LIME_CURL" value="1" unless="emscripten" />
|
||||
<set name="LIME_JPEG" value="1" />
|
||||
<set name="LIME_FREETYPE" value="1" />
|
||||
@@ -17,6 +18,7 @@
|
||||
<set name="LIME_OGG" value="1" />
|
||||
<set name="LIME_OPENAL" value="1" />
|
||||
<set name="LIME_OPENGL" value="1" />
|
||||
<set name="LIME_PIXMAN" value="1" if="LIME_CAIRO || LIME_PIXMAN" />
|
||||
<set name="LIME_PNG" value="1" />
|
||||
<set name="LIME_SDL" value="1" />
|
||||
<set name="LIME_VORBIS" value="1" />
|
||||
@@ -37,6 +39,15 @@
|
||||
|
||||
<file name="src/ExternalInterface.cpp" />
|
||||
|
||||
<section if="LIME_CAIRO">
|
||||
|
||||
<compilerflag value="-I${NATIVE_TOOLKIT_PATH}/cairo/include" />
|
||||
<compilerflag value="-DCAIRO_WIN32_STATIC_BUILD" if="windows" />
|
||||
|
||||
<file name="src/graphics/cairo/CairoBindings.cpp" />
|
||||
|
||||
</section>
|
||||
|
||||
<section if="LIME_CURL">
|
||||
|
||||
<compilerflag value="-I${NATIVE_TOOLKIT_PATH}/curl/include/" />
|
||||
@@ -183,6 +194,7 @@
|
||||
|
||||
</files>
|
||||
|
||||
<include name="lib/cairo/files.xml" if="LIME_CAIRO" />
|
||||
<include name="lib/curl/files.xml" />
|
||||
<include name="lib/freetype/files.xml" />
|
||||
<include name="lib/harfbuzz/files.xml" />
|
||||
@@ -191,6 +203,7 @@
|
||||
<include name="lib/ogg/files.xml" />
|
||||
<include name="lib/openal/files.xml" />
|
||||
<include name="lib/openal-android/files.xml" if="android" />
|
||||
<include name="lib/pixman/files.xml" if="LIME_PIXMAN" />
|
||||
<include name="lib/png/files.xml" />
|
||||
<include name="lib/sdl/files.xml" />
|
||||
<include name="lib/vorbis/files.xml" />
|
||||
@@ -204,6 +217,7 @@
|
||||
|
||||
<files id="lime" />
|
||||
|
||||
<files id="native-toolkit-cairo" if="LIME_CAIRO" />
|
||||
<files id="native-toolkit-curl" if="LIME_CURL" />
|
||||
<files id="native-toolkit-jpeg" if="LIME_JPEG" />
|
||||
<files id="native-toolkit-freetype" if="LIME_FREETYPE" />
|
||||
@@ -212,6 +226,7 @@
|
||||
<files id="native-toolkit-ogg" if="LIME_OGG" />
|
||||
<files id="native-toolkit-openal" if="LIME_OPENAL" unless="mac || iphone || android || emscripten" />
|
||||
<files id="native-toolkit-openal-android" if="LIME_OPENAL android" />
|
||||
<files id="native-toolkit-pixman" if="LIME_PIXMAN" />
|
||||
<files id="native-toolkit-png" if="LIME_PNG" />
|
||||
<files id="native-toolkit-sdl" if="LIME_SDL" unless="emscripten" />
|
||||
<files id="native-toolkit-vorbis" if="LIME_VORBIS" />
|
||||
|
||||
1
project/lib/cairo
Submodule
1
project/lib/cairo
Submodule
Submodule project/lib/cairo added at 83548b9227
1
project/lib/pixman
Submodule
1
project/lib/pixman
Submodule
Submodule project/lib/pixman added at 65dced727a
33
project/src/graphics/cairo/CairoBindings.cpp
Normal file
33
project/src/graphics/cairo/CairoBindings.cpp
Normal file
@@ -0,0 +1,33 @@
|
||||
#include <cairo.h>
|
||||
#include <hx/CFFI.h>
|
||||
|
||||
|
||||
namespace lime {
|
||||
|
||||
|
||||
value lime_cairo_version () {
|
||||
|
||||
return alloc_int (cairo_version ());
|
||||
|
||||
}
|
||||
|
||||
|
||||
value lime_cairo_version_string () {
|
||||
|
||||
return alloc_string (cairo_version_string ());
|
||||
|
||||
}
|
||||
|
||||
|
||||
DEFINE_PRIM (lime_cairo_version, 0);
|
||||
DEFINE_PRIM (lime_cairo_version_string, 0);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
extern "C" int lime_cairo_register_prims () {
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user