This commit is contained in:
Joshua Granick
2015-08-12 17:59:18 -07:00
parent a1862e43a5
commit df30bad61b
15 changed files with 8 additions and 713 deletions

View File

@@ -1,66 +0,0 @@
#ifndef LIME_CAIRO_CONTEXT_H
#define LIME_CAIRO_CONTEXT_H
#include <graphics/cairo/CairoPattern.h>
#include <graphics/cairo/CairoSurface.h>
typedef struct _cairo cairo_t;
namespace lime {
struct CairoContext {
CairoContext (cairo_t *ptr = NULL) {
m_ptr = ptr;
}
static CairoContext create (CairoSurface target);
void destroy ();
void clip ();
void closePath ();
void fill ();
void fillPreserve ();
void lineTo (double x, double y);
void moveTo (double x, double y);
void newPath ();
void mask (CairoPattern pattern);
void paint ();
void paintWithAlpha (double alpha);
void pushGroup ();
void pushGroupWithContent (int content);
CairoPattern popGroup ();
void popGroupToSource ();
void rectangle (double x, double y, double w, double h);
void resetClip ();
void restore ();
void save ();
void setLineCap (int cap);
void setLineJoin (int join);
void setLineWidth (double width);
void setMatrix (double xx, double yx, double xy, double yy, double x0, double y0);
void setMiterLimit (double miterLimit);
void setOperator (int op);
void setSource (CairoPattern pattern);
void setSourceRGBA (double r, double g, double b, double a);
void setSourceSurface (CairoSurface surface, double x, double y);
void stroke ();
void strokePreserve ();
void transform (double xx, double yx, double xy, double yy, double x0, double y0);
private:
cairo_t *m_ptr;
};
}
#endif

View File

@@ -1,40 +0,0 @@
#ifndef LIME_CAIRO_PATTERN_H
#define LIME_CAIRO_PATTERN_H
#include <graphics/cairo/CairoSurface.h>
typedef struct _cairo_pattern cairo_pattern_t;
namespace lime {
struct CairoPattern {
CairoPattern (cairo_pattern_t *ptr = NULL) {
m_ptr = ptr;
}
static CairoPattern createForSurface (CairoSurface target);
void destroy ();
inline cairo_pattern_t *ptr () { return m_ptr; }
void setExtend (int extend);
void setFilter (int filter);
void setMatrix (double xx, double yx, double xy, double yy, double x0, double y0);
private:
cairo_pattern_t *m_ptr;
};
}
#endif

View File

@@ -1,39 +0,0 @@
#ifndef LIME_CAIRO_SURFACE_H
#define LIME_CAIRO_SURFACE_H
typedef struct _cairo_surface cairo_surface_t;
namespace lime {
struct CairoSurface {
CairoSurface (cairo_surface_t *ptr = NULL) {
m_ptr = ptr;
}
static CairoSurface createForData (
uint8_t *data,
int format,
int width,
int height,
int stride
);
void destroy ();
inline cairo_surface_t *ptr () { return m_ptr; }
private:
cairo_surface_t *m_ptr;
};
}
#endif

View File

@@ -1,9 +0,0 @@
package lime;
@:buildXml("
<files id='haxe'>
<compilerflag value='-I${haxelib:lime}/include'/>
</files>
")
@:keep
class IncludePaths {}

View File

@@ -1,115 +0,0 @@
package lime.graphics.cairo;
import lime.IncludePaths;
import lime.graphics.cairo.Surface;
@:enum abstract Content(Int) {
// must match cairo_content_t in cairo.h
var Color = 0x1000;
var Alpha = 0x2000;
var ColorAndAlpha = 0x3000;
}
@:enum abstract Operator(Int) {
// must match cairo_operator_t in cairo.h
var Clear = 0;
var Source = 1;
var Over = 2;
var In = 3;
var Out = 4;
var Atop = 5;
var Dest = 6;
var DestOver = 7;
var DestIn = 8;
var DestOut = 9;
var DestAtop = 10;
var Xor = 11;
var Add = 12;
var Saturate = 13;
var Multiply = 14;
var Screen = 15;
var Overlay = 16;
var Darken = 17;
var Lighten = 18;
var ColorDodge = 19;
var ColorBurn = 20;
var HardLight = 21;
var SoftLight = 22;
var Difference = 23;
var Exclusion = 24;
var HSLHue = 25;
var HSLSaturation = 26;
var HSLColor = 27;
var HSLLuminosity = 28;
}
@:enum abstract LineCap(Int) {
// must match cairo_line_cap_t in cairo.h
var Butt = 0;
var Round = 1;
var Square = 2;
}
@:enum abstract LineJoin(Int) {
// must match cairo_line_join_t in cairo.h
var Miter = 0;
var Round = 1;
var Bevel = 2;
}
@:include("graphics/cairo/CairoContext.h")
@:native("cpp::Struct<lime::CairoContext>")
extern class Context {
@:native("lime::CairoContext::create")
public static function create (surface:Surface):Context;
public function destroy ():Void;
public function clip ():Void;
public function closePath ():Void;
public function fill ():Void;
public function fillPreserve ():Void;
public function lineTo (x:Float, y:Float):Void;
public function moveTo (x:Float, y:Float):Void;
public function mask (pattern:Pattern):Void;
public function newPath ():Void;
public function paint ():Void;
public function paintWithAlpha (alpha:Float):Void;
public function pushGroup ():Void;
public function pushGroupWithContent (content:Content):Void;
public function popGroup ():Pattern;
public function popGroupToSource ():Void;
public function rectangle (x:Float, y:Float, w:Float, h:Float):Void;
public function resetClip ():Void;
public function restore ():Void;
public function save ():Void;
public function setLineCap (cap:LineCap):Void;
public function setLineJoin (cap:LineJoin):Void;
public function setLineWidth (width:Float):Void;
public function setMatrix (xx:Float, yx:Float, xy:Float, yy:Float, x0:Float, y0:Float):Void;
public function setMiterLimit (miterLimit:Float):Void;
public function setOperator (op:Operator):Void;
public function setSource (pattern:Pattern):Void;
public function setSourceRGBA (r:Float, g:Float, b:Float, a:Float):Void;
public function setSourceSurface (surface:Surface, x:Float, y:Float):Void;
public function stroke ():Void;
public function strokePreserve ():Void;
public function transform (xx:Float, yx:Float, xy:Float, yy:Float, x0:Float, y0:Float):Void;
}

View File

@@ -1,15 +0,0 @@
package lime.graphics.cairo;
@:enum abstract Format(Int) {
// must match cairo_format_t in cairo.h
var ARGB32 = 0;
var RGB24 = 1;
var A8 = 2;
var A1 = 3;
var RGB16_565 = 4;
var RGB30 = 5;
}

View File

@@ -1,45 +0,0 @@
package lime.graphics.cairo;
import lime.IncludePaths;
import lime.graphics.cairo.Surface;
@:enum abstract Extend(Int) {
// must match cairo_extend_t in cairo.h
var None = 0;
var Repeat = 1;
var Reflect = 2;
var Pad = 3;
}
@:enum abstract Filter(Int) {
// must match cairo_filter_t in cairo.h
var Fast = 0;
var Good = 1;
var Best = 2;
var Nearest = 3;
var Bilinear = 4;
var Gaussian = 5;
}
@:include("graphics/cairo/CairoPattern.h")
@:native("cpp::Struct<lime::CairoPattern>")
extern class Pattern {
@:native("lime::CairoPattern::createForSurface")
public static function createForSurface (surface:Surface):Pattern;
public function destroy ():Void;
public function setExtend (extend:Extend):Void;
public function setFilter (filter:Filter):Void;
public function setMatrix (xx:Float, yx:Float, xy:Float, yy:Float, x0:Float, y0:Float):Void;
}

View File

@@ -1,23 +0,0 @@
package lime.graphics.cairo;
import lime.IncludePaths;
import lime.graphics.cairo.Format;
@:include("graphics/cairo/CairoSurface.h")
@:native("cpp::Struct<lime::CairoSurface>")
extern class Surface {
@:native("lime::CairoSurface::createForData")
public static function createForData (
data:cpp.Pointer<cpp.UInt8>,
format:Format,
width:Int,
height:Int,
stride:Int
):Surface;
public function destroy ():Void;
}

View File

@@ -14,12 +14,6 @@ class DeploymentHelper {
ZipHelper.compress (PathHelper.combine (targetDirectory, "bin"), targetPath);
var cwd = Sys.getCwd();
if (targetPath.indexOf(cwd) == -1)
{
targetPath = PathHelper.combine(cwd, targetPath);
}
if (targetFlags.exists ("gdrive")) {
var parent = targetFlags.get ("parent");

View File

@@ -20,12 +20,6 @@ class ZipHelper {
}
var cwd = Sys.getCwd();
if (targetPath.indexOf(cwd) == -1)
{
targetPath = PathHelper.combine(cwd, targetPath);
}
PathHelper.mkdir (Path.directory (targetPath));
if (PlatformHelper.hostPlatform == WINDOWS || !FileSystem.isDirectory (path)) {
@@ -105,17 +99,10 @@ class ZipHelper {
private static function readFile (basePath:String, path:String, files:List<Entry>):Void {
var cwd = Sys.getCwd();
if (Path.extension (path) != "zip" && Path.extension (path) != "crx" && Path.extension (path) != "wgt") {
var fullPath = PathHelper.combine (basePath, path);
if (fullPath.indexOf(cwd) == -1)
{
fullPath = PathHelper.combine(cwd, fullPath);
}
var name = path;
//var date = FileSystem.stat (directory + "/" + file).ctime;
var date = Date.now ();

View File

@@ -137,6 +137,7 @@ class WindowsPlatform extends PlatformTarget {
haxeArgs.push ("-D");
haxeArgs.push ("no_console");
flags.push ("-Dno_console");
}
if (!project.targetFlags.exists ("static")) {

View File

@@ -742,18 +742,14 @@ namespace lime {
value lime_lzma_decode (value buffer) {
#ifdef LIME_LZMA
Bytes data = Bytes (buffer);
Bytes result;
LZMA::Decode (&data, &result);
return result.Value ();
#else
return alloc_null ();
#endif
}
@@ -762,18 +758,14 @@ namespace lime {
value lime_lzma_encode (value buffer) {
#ifdef LIME_LZMA
Bytes data = Bytes (buffer);
Bytes result;
LZMA::Encode (&data, &result);
return result.Value ();
#else
return alloc_null ();
#endif
}
@@ -1308,17 +1300,8 @@ namespace lime {
}
#ifdef LIME_CAIRO
extern "C" int lime_cairo_register_prims ();
#endif
// prevents elimination of translation units during static linking
extern "C" int lime_register_prims () {
return 0
#ifdef LIME_CAIRO
+ lime_cairo_register_prims ()
#endif
;
}

View File

@@ -1,318 +0,0 @@
#include <cairo.h>
#include <graphics/cairo/CairoContext.h>
#include <graphics/cairo/CairoPattern.h>
#include <graphics/cairo/CairoSurface.h>
namespace lime {
CairoContext CairoContext::create (CairoSurface target) {
cairo_t *c = cairo_create (target.ptr ());
return CairoContext (c);
}
void CairoContext::destroy () {
cairo_destroy (m_ptr);
}
void CairoContext::clip () {
cairo_clip (m_ptr);
}
void CairoContext::closePath () {
cairo_close_path (m_ptr);
}
void CairoContext::fill () {
cairo_fill (m_ptr);
}
void CairoContext::fillPreserve () {
cairo_fill_preserve (m_ptr);
}
void CairoContext::lineTo (double x, double y) {
cairo_line_to (m_ptr, x, y);
}
void CairoContext::moveTo (double x, double y) {
cairo_move_to (m_ptr, x, y);
}
void CairoContext::mask (CairoPattern pattern) {
cairo_mask (m_ptr, pattern.ptr ());
}
void CairoContext::newPath () {
cairo_new_path (m_ptr);
}
void CairoContext::paint () {
cairo_paint (m_ptr);
}
void CairoContext::paintWithAlpha (double alpha) {
cairo_paint_with_alpha (m_ptr, alpha);
}
void CairoContext::pushGroup () {
cairo_push_group (m_ptr);
}
void CairoContext::pushGroupWithContent (int content) {
cairo_push_group_with_content (m_ptr, (cairo_content_t)content);
}
CairoPattern CairoContext::popGroup () {
return cairo_pop_group (m_ptr);
}
void CairoContext::popGroupToSource () {
cairo_pop_group_to_source (m_ptr);
}
void CairoContext::rectangle (double x, double y, double w, double h) {
cairo_rectangle (m_ptr, x, y, w, h);
}
void CairoContext::resetClip () {
cairo_reset_clip (m_ptr);
}
void CairoContext::restore () {
cairo_restore (m_ptr);
}
void CairoContext::save () {
cairo_save (m_ptr);
}
void CairoContext::setLineCap (int cap) {
cairo_set_line_cap (m_ptr, (cairo_line_cap_t)cap);
}
void CairoContext::setLineJoin (int join) {
cairo_set_line_join (m_ptr, (cairo_line_join_t)join);
}
void CairoContext::setLineWidth (double width) {
cairo_set_line_width (m_ptr, width);
}
void CairoContext::setMatrix (double xx, double yx, double xy, double yy, double x0, double y0) {
cairo_matrix_t m;
m.xx = xx;
m.yx = yx;
m.xy = xy;
m.yy = yy;
m.x0 = x0;
m.y0 = y0;
cairo_set_matrix (m_ptr, &m);
}
void CairoContext::setMiterLimit (double miterLimit) {
cairo_set_miter_limit (m_ptr, miterLimit);
}
void CairoContext::setOperator (int op) {
cairo_set_operator (m_ptr, (cairo_operator_t)op);
}
void CairoContext::setSource (CairoPattern pattern) {
cairo_set_source (m_ptr, pattern.ptr ());
}
void CairoContext::setSourceRGBA (double r, double g, double b, double a) {
cairo_set_source_rgba (m_ptr, r, g, b, a);
}
void CairoContext::setSourceSurface (CairoSurface surface, double x, double y) {
cairo_set_source_surface (m_ptr, surface.ptr (), x, y);
}
void CairoContext::stroke () {
cairo_stroke (m_ptr);
}
void CairoContext::strokePreserve () {
cairo_stroke_preserve (m_ptr);
}
void CairoContext::transform (double xx, double yx, double xy, double yy, double x0, double y0) {
cairo_matrix_t m;
m.xx = xx;
m.yx = yx;
m.xy = xy;
m.yy = yy;
m.x0 = x0;
m.y0 = y0;
cairo_transform (m_ptr, &m);
}
CairoPattern CairoPattern::createForSurface (CairoSurface surface) {
cairo_pattern_t *p = cairo_pattern_create_for_surface (surface.ptr ());
return CairoPattern (p);
}
void CairoPattern::destroy () {
cairo_pattern_destroy (m_ptr);
}
void CairoPattern::setExtend (int extend) {
cairo_pattern_set_extend (m_ptr, (cairo_extend_t)extend);
}
void CairoPattern::setFilter (int filter) {
cairo_pattern_set_filter (m_ptr, (cairo_filter_t)filter);
}
void CairoPattern::setMatrix (double xx, double yx, double xy, double yy, double x0, double y0) {
cairo_matrix_t m;
m.xx = xx;
m.yx = yx;
m.xy = xy;
m.yy = yy;
m.x0 = x0;
m.y0 = y0;
cairo_pattern_set_matrix (m_ptr, &m);
}
CairoSurface CairoSurface::createForData (
uint8_t *data,
int format,
int width,
int height,
int stride
) {
cairo_surface_t *s = cairo_image_surface_create_for_data (
data, (cairo_format_t)format, width, height, stride
);
return CairoSurface (s);
}
void CairoSurface::destroy () {
cairo_surface_destroy (m_ptr);
}
}