Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add renderer backends #3

Merged
merged 2 commits into from
May 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,22 @@ let package = Package(
name: "lodepng",
dependencies: [],
path: "framework/lodepng"),
.target(
name: "CPPAGGRenderer",
dependencies: ["AGG","lodepng"],
path: "framework/CPPAGGRenderer"),
.target(
name: "CAGGRenderer",
dependencies: ["CPPAGGRenderer"],
path: "framework/CAGGRenderer"),
.target(
name: "Util",
dependencies: [],
path: "framework/Util"),
.target(
name: "Renderer",
dependencies: ["Util","CAGGRenderer"],
path: "framework/Renderer"),
.target(
name: "LinePlot",
dependencies: [],
Expand Down
47 changes: 47 additions & 0 deletions framework/CAGGRenderer/CAGGRenderer.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#include "include/CAGGRenderer.h"
#include "CPPAGGRenderer.h"
#include <iostream>

const void * initializePlot(float w, float h){
return CPPAGGRenderer::initializePlot(w, h);
}

void draw_rect(const float *x, const float *y, float thickness, float r, float g, float b, float a, const void *object){
CPPAGGRenderer::draw_rect(x, y, thickness, r, g, b, a, object);
}

void draw_solid_rect(const float *x, const float *y, float r, float g, float b, float a, const void *object){
CPPAGGRenderer::draw_solid_rect(x, y, r, g, b, a, object);
}

void draw_line(const float *x, const float *y, float thickness, float r, float g, float b, float a, const void *object){
CPPAGGRenderer::draw_line(x, y, thickness, r, g, b, a, object);
}

void draw_transformed_line(const float *x, const float *y, float thickness, float r, float g, float b, float a, const void *object){
CPPAGGRenderer::draw_transformed_line(x, y, thickness, r, g, b, a, object);
}

void draw_plot_lines(const float *x, const float *y, int size, float thickness, float r, float g, float b, float a, const void *object){
CPPAGGRenderer::draw_plot_lines(x, y, size, thickness, r, g, b, a, object);
}

void draw_text(const char *s, float x, float y, float size, float thickness, const void *object){
CPPAGGRenderer::draw_text(s, x, y, size, thickness, object);
}

void draw_transformed_text(const char *s, float x, float y, float size, float thickness, const void *object){
CPPAGGRenderer::draw_transformed_text(s, x, y, size, thickness, object);
}

void draw_rotated_text(const char *s, float x, float y, float size, float thickness, float angle, const void *object){
CPPAGGRenderer::draw_rotated_text(s, x, y, size, thickness, angle, object);
}

float get_text_width(const char *s, float size, const void *object){
return CPPAGGRenderer::get_text_width(s, size, object);
}

void save_image(const char *s, const void *object){
CPPAGGRenderer::save_image(s, object);
}
29 changes: 29 additions & 0 deletions framework/CAGGRenderer/include/CAGGRenderer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#ifdef __cplusplus
extern "C" {
#endif

const void * initializePlot(float w, float h);

void draw_rect(const float *x, const float *y, float thickness, float r, float g, float b, float a, const void *object);

void draw_solid_rect(const float *x, const float *y, float r, float g, float b, float a, const void *object);

void draw_line(const float *x, const float *y, float thickness, float r, float g, float b, float a, const void *object);

void draw_transformed_line(const float *x, const float *y, float thickness, float r, float g, float b, float a, const void *object);

void draw_plot_lines(const float *x, const float *y, int size, float thickness, float r, float g, float b, float a, const void *object);

void draw_text(const char *s, float x, float y, float size, float thickness, const void *object);

void draw_transformed_text(const char *s, float x, float y, float size, float thickness, const void *object);

void draw_rotated_text(const char *s, float x, float y, float size, float thickness, float angle, const void *object);

float get_text_width(const char *s, float size, const void *object);

void save_image(const char *s, const void *object);

#ifdef __cplusplus
}
#endif
Loading