ector: add linear and radial gradial renderer to Ector.

This commit is contained in:
Cedric BAIL 2015-04-03 16:15:39 +02:00
parent 4036a22b10
commit 6f3fd4ac81
6 changed files with 158 additions and 2 deletions

View File

@ -4,7 +4,9 @@ ector_eolian_files = \
lib/ector/ector_surface.eo \
lib/ector/ector_renderer_base.eo \
lib/ector/ector_renderer_shape.eo \
lib/ector/ector_renderer_gradient.eo
lib/ector/ector_renderer_gradient.eo \
lib/ector/ector_renderer_gradient_radial.eo \
lib/ector/ector_renderer_gradient_linear.eo
ector_eolian_c = $(ector_eolian_files:%.eo=%.eo.c)
ector_eolian_h = $(ector_eolian_files:%.eo=%.eo.h)
@ -27,7 +29,9 @@ lib_ector_libector_la_SOURCES = \
lib/ector/ector_main.c \
lib/ector/ector_renderer_shape.c \
lib/ector/ector_renderer_base.c \
lib/ector/ector_renderer_gradient.c
lib/ector/ector_renderer_gradient.c \
lib/ector/ector_renderer_gradient_radial.c \
lib/ector/ector_renderer_gradient_linear.c
lib_ector_libector_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
@ECTOR_CFLAGS@ \

View File

@ -3,5 +3,8 @@
#include "ector_renderer_base.eo.h"
#include "ector_renderer_shape.eo.h"
#include "ector_renderer_gradient.eo.h"
#include "ector_renderer_gradient_linear.eo.h"
#include "ector_renderer_gradient_radial.eo.h"
#endif

View File

@ -0,0 +1,54 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <Eina.h>
#include <Ector.h>
#include "ector_private.h"
typedef struct _Ector_Renderer_Gradient_Linear_Data Ector_Renderer_Gradient_Linear_Data;
struct _Ector_Renderer_Gradient_Linear_Data
{
struct {
double x, y;
} start, end;
};
void
_ector_renderer_gradient_linear_efl_graphics_gradient_linear_start_set(Eo *obj EINA_UNUSED,
Ector_Renderer_Gradient_Linear_Data *pd,
double x, double y)
{
pd->start.x = x;
pd->start.y = y;
}
void
_ector_renderer_gradient_linear_efl_graphics_gradient_linear_start_get(Eo *obj EINA_UNUSED,
Ector_Renderer_Gradient_Linear_Data *pd,
double *x, double *y)
{
if (x) *x = pd->start.x;
if (y) *y = pd->start.y;
}
void
_ector_renderer_gradient_linear_efl_graphics_gradient_linear_end_set(Eo *obj EINA_UNUSED,
Ector_Renderer_Gradient_Linear_Data *pd,
double x, double y)
{
pd->end.x = x;
pd->end.y = y;
}
void
_ector_renderer_gradient_linear_efl_graphics_gradient_linear_end_get(Eo *obj EINA_UNUSED,
Ector_Renderer_Gradient_Linear_Data *pd,
double *x, double *y)
{
if (x) *x = pd->end.x;
if (y) *y = pd->end.y;
}
#include "ector_renderer_gradient_linear.eo.c"

View File

@ -0,0 +1,11 @@
abstract Ector.Renderer.Gradient_Linear (Ector.Renderer.Gradient, Efl.Graphics.Gradient_Linear)
{
eo_prefix: ector_renderer_gradient_linear;
legacy_prefix: null;
implements {
Efl.Graphics.Gradient_Linear.start.set;
Efl.Graphics.Gradient_Linear.start.get;
Efl.Graphics.Gradient_Linear.end.set;
Efl.Graphics.Gradient_Linear.end.get;
}
}

View File

@ -0,0 +1,71 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <Eina.h>
#include <Ector.h>
#include "ector_private.h"
typedef struct _Ector_Renderer_Gradient_Radial_Data Ector_Renderer_Gradient_Radial_Data;
struct _Ector_Renderer_Gradient_Radial_Data
{
struct {
double x, y;
} radial, focal;
double radius;
};
void
_ector_renderer_gradient_radial_efl_graphics_gradient_radial_center_set(Eo *obj EINA_UNUSED,
Ector_Renderer_Gradient_Radial_Data *pd,
double x, double y)
{
pd->radial.x = x;
pd->radial.y = y;
}
void
_ector_renderer_gradient_radial_efl_graphics_gradient_radial_center_get(Eo *obj EINA_UNUSED,
Ector_Renderer_Gradient_Radial_Data *pd,
double *x, double *y)
{
if (x) *x = pd->radial.x;
if (y) *y = pd->radial.y;
}
void
_ector_renderer_gradient_radial_efl_graphics_gradient_radial_radius_set(Eo *obj EINA_UNUSED,
Ector_Renderer_Gradient_Radial_Data *pd,
double r)
{
pd->radius = r;
}
double
_ector_renderer_gradient_radial_efl_graphics_gradient_radial_radius_get(Eo *obj EINA_UNUSED,
Ector_Renderer_Gradient_Radial_Data *pd)
{
return pd->radius;
}
void
_ector_renderer_gradient_radial_efl_graphics_gradient_radial_focal_set(Eo *obj EINA_UNUSED,
Ector_Renderer_Gradient_Radial_Data *pd,
double x, double y)
{
pd->focal.x = x;
pd->focal.y = y;
}
void
_ector_renderer_gradient_radial_efl_graphics_gradient_radial_focal_get(Eo *obj EINA_UNUSED,
Ector_Renderer_Gradient_Radial_Data *pd,
double *x, double *y)
{
if (x) *x = pd->focal.x;
if (y) *y = pd->focal.y;
}
#include "ector_renderer_gradient_radial.eo.c"

View File

@ -0,0 +1,13 @@
abstract Ector.Renderer.Gradient_Radial (Ector.Renderer.Gradient, Efl.Graphics.Gradient_Radial)
{
eo_prefix: ector_renderer_gradient_radial;
legacy_prefix: null;
implements {
Efl.Graphics.Gradient_Radial.center.set;
Efl.Graphics.Gradient_Radial.center.get;
Efl.Graphics.Gradient_Radial.radius.set;
Efl.Graphics.Gradient_Radial.radius.get;
Efl.Graphics.Gradient_Radial.focal.set;
Efl.Graphics.Gradient_Radial.focal.get;
}
}