From 0510ea90bd8b25cff1e21eea48ec5efd13238993 Mon Sep 17 00:00:00 2001 From: Cedric BAIL Date: Fri, 3 Apr 2015 16:14:58 +0200 Subject: [PATCH] ector: add initial interface for Surface and Renderer. --- AUTHORS | 8 +++ src/Makefile_Ector.am | 14 ++++ src/lib/ector/Ector.h | 53 +++++++++++++++ src/lib/ector/ector_renderer.eo | 114 ++++++++++++++++++++++++++++++++ src/lib/ector/ector_renderer.h | 6 ++ src/lib/ector/ector_surface.eo | 40 +++++++++++ src/lib/ector/ector_surface.h | 6 ++ 7 files changed, 241 insertions(+) create mode 100644 src/lib/ector/ector_renderer.eo create mode 100644 src/lib/ector/ector_renderer.h create mode 100644 src/lib/ector/ector_surface.eo create mode 100644 src/lib/ector/ector_surface.h diff --git a/AUTHORS b/AUTHORS index 8db85383b2..b283554660 100644 --- a/AUTHORS +++ b/AUTHORS @@ -77,6 +77,14 @@ Eo -- Tom Hacohen +Cedric Bail + +Ector +----- + +Cedric Bail +Jorge Luis Zapata Muga +Jose O Gonzalez Evas ---- diff --git a/src/Makefile_Ector.am b/src/Makefile_Ector.am index 25893793f1..00f89a4acd 100644 --- a/src/Makefile_Ector.am +++ b/src/Makefile_Ector.am @@ -1,5 +1,19 @@ ### Library +ector_eolian_files = \ + lib/ector/ector_surface.eo \ + lib/ector/ector_renderer.eo + +ector_eolian_c = $(ector_eolian_files:%.eo=%.eo.c) +ector_eolian_h = $(ector_eolian_files:%.eo=%.eo.h) + +BUILT_SOURCES += \ + $(ector_eolian_c) \ + $(ector_eolian_h) + +CLEANFILES += \ + $(ector_eolian_c) \ + $(ector_eolian_h) lib_LTLIBRARIES += lib/ector/libector.la diff --git a/src/lib/ector/Ector.h b/src/lib/ector/Ector.h index 833f113959..a47d2f109f 100644 --- a/src/lib/ector/Ector.h +++ b/src/lib/ector/Ector.h @@ -3,6 +3,7 @@ #include #include +#include #ifdef EAPI # undef EAPI @@ -103,6 +104,55 @@ typedef Eo Ector_Surface; */ typedef Eo Ector_Renderer; +/** + * @typedef Ector_Colorspace + * The definiton of colorspace. + */ +typedef Evas_Colorspace Ector_Colorspace; + +/** + * Raster operations at pixel level + */ +typedef enum _Ector_Rop +{ + ECTOR_ROP_BLEND, /**< D = S + D(1 - Sa) */ + ECTOR_ROP_COPY, /**< D = S */ + ECTOR_ROP_LAST +} Ector_Rop; + +/** + * Quality values + */ +typedef enum _Ector_Quality +{ + ECTOR_QUALITY_BEST, /**< Best quality */ + ECTOR_QUALITY_GOOD, /**< Good quality */ + ECTOR_QUALITY_FAST, /**< Lower quality, fastest */ + ECTOR_QUALITY_LAST +} Ector_Quality; + +/** + * Priorities + */ +typedef enum _Ector_Priority +{ + ECTOR_PRIORITY_NONE = 0, + ECTOR_PRIORITY_MARGINAL = 64, + ECTOR_PRIORITY_SECONDARY = 128, + ECTOR_PRIORITY_PRIMARY = 256, +} Ector_Priority; + +/** + * What kind of update is being pushed + */ +typedef enum _Ector_Update_Type +{ + ECTOR_UPDATE_BACKGROUND = 1, /* All the previous state in that area is reset to the new updated profile */ + ECTOR_UPDATE_EMPTY = 2, /* Pushing empty area (no visible pixels at all, no need to read this surface to render it) */ + ECTOR_UPDATE_ALPHA = 4, /* Pushing some transparent pixels (this impact the under layer and will require to read back the surface where this surface is blitted) */ + ECTOR_UPDATE_OPAQUE = 8 /* Pushing some opaque pixels (this means that their is no need to read the under layer when blitting this surface) */ +} Ector_Update_Type; + #ifdef EFL_BETA_API_SUPPORT /** @@ -121,6 +171,9 @@ EAPI int ector_init(void); */ EAPI int ector_shutdown(void); +#include "ector_surface.h" +#include "ector_renderer.h" + #endif /** diff --git a/src/lib/ector/ector_renderer.eo b/src/lib/ector/ector_renderer.eo new file mode 100644 index 0000000000..9073bcb3f8 --- /dev/null +++ b/src/lib/ector/ector_renderer.eo @@ -0,0 +1,114 @@ +abstract Ector.Renderer (Eo.Base) +{ + eo_prefix: ector_renderer; + legacy_prefix: null; + properties { + transformation { + set { + } + get { + } + values { + Eina_Matrix3 m; + } + } + origin { + set { + } + get { + } + values { + double x; + double y; + } + } + visibility { + set { + /*@ Makes the given Ector renderer visible or invisible. */ + } + get { + /*@ Retrieves whether or not the given Ector renderer is visible. */ + } + values { + bool v; /*@ @c EINA_TRUE if to make the object visible, @c EINA_FALSE otherwise */ + } + } + color { + set { + /*@ + Sets the general/main color of the given Ector renderer to the given + one. + + @note These color values are expected to be premultiplied by @p a. + + @ingroup Ector_Renderer_Group_Basic */ + } + get { + /*@ + Retrieves the general/main color of the given Ector renderer. + + Retrieves the “main” color's RGB component (and alpha channel) + values, which range from 0 to 255. For the alpha channel, + which defines the object's transparency level, 0 means totally + transparent, while 255 means opaque. These color values are + premultiplied by the alpha value. + + @note Use @c NULL pointers on the components you're not interested + in: they'll be ignored by the function. + + @ingroup Ector_Renderer_Group_Basic */ + } + values { + int r; /*@ The red component of the given color. */ + int g; /*@ The green component of the given color. */ + int b; /*@ The blue component of the given color. */ + int a; /*@ The alpha component of the given color. */ + } + } + mask { + set { + } + get { + } + values { + Ector_Renderer *r; + } + } + quality { + set { + } + get { + } + values { + Ector_Quality q; + } + } + } + methods { + bounds_get { + return: bool @warn_unused; + params { + @out Eina_Rectangle *r; + } + } + draw { + return: bool @warn_unused; + params { + @in Ector_Surface *s; + @in Ector_Rop op; + @in array *clips; /*@ array of Eina_Rectangle clip */ + @in int x; + @in int y; + } + } + prepare { + return: bool @warn_unused; + params { + @in Ector_Surface *s; + } + } + done { + return: bool @warn_unused; + } + } +} diff --git a/src/lib/ector/ector_renderer.h b/src/lib/ector/ector_renderer.h new file mode 100644 index 0000000000..effb3f59ea --- /dev/null +++ b/src/lib/ector/ector_renderer.h @@ -0,0 +1,6 @@ +#ifndef ECTOR_RENDERER_H +#define ECTOR_RENDERER_H + +#include "ector_renderer.eo.h" + +#endif diff --git a/src/lib/ector/ector_surface.eo b/src/lib/ector/ector_surface.eo new file mode 100644 index 0000000000..36dd9981a2 --- /dev/null +++ b/src/lib/ector/ector_surface.eo @@ -0,0 +1,40 @@ +abstract Ector.Surface (Eo.Base) +{ + eo_prefix: ector_surface; + properties { + size { + set { + /*@ Changes the size of the given Evas object. */ + } + get { + /*@ Retrieves the (rectangular) size of the given Evas object. */ + } + values { + int w; /*@ in */ + int h; /*@ in */ + } + } + } + methods { + renderer_factory_new { + return: Ector_Renderer *; + params { + @in const(Eo_Class) * type @nonull; + } + } + update_push { + return: bool; + params { + @in const(Eina_Rectangle) * r @nonull; + @in Ector_Update_Type type; + } + } + update_reset { + return: bool; + } + } + implements { + @virtual .size.set; + @virtual .size.get; + } +} diff --git a/src/lib/ector/ector_surface.h b/src/lib/ector/ector_surface.h new file mode 100644 index 0000000000..a1096bd714 --- /dev/null +++ b/src/lib/ector/ector_surface.h @@ -0,0 +1,6 @@ +#ifndef ECTOR_SURFACE_H +#define ECTOR_SURFACE_H + +#include "ector_surface.eo.h" + +#endif