efl: add Efl.Gfx.View and use it in Evas.Image.

This commit is contained in:
Cedric BAIL 2015-04-03 16:23:26 +02:00
parent 5f2527f791
commit a395f5ded5
8 changed files with 77 additions and 25 deletions

View File

@ -8,6 +8,7 @@ efl_eolian_files = \
lib/efl/interfaces/efl_gfx_base.eo \
lib/efl/interfaces/efl_gfx_stack.eo \
lib/efl/interfaces/efl_gfx_fill.eo \
lib/efl/interfaces/efl_gfx_view.eo \
lib/efl/interfaces/efl_gfx_shape.eo \
lib/efl/interfaces/efl_gfx_gradient.eo \
lib/efl/interfaces/efl_gfx_gradient_linear.eo \

View File

@ -12,6 +12,7 @@ generated_efl_cxx_bindings = \
lib/efl/interfaces/efl_gfx_base.eo.hh \
lib/efl/interfaces/efl_gfx_stack.eo.hh \
lib/efl/interfaces/efl_gfx_fill.eo.hh \
lib/efl/interfaces/efl_gfx_view.eo.hh \
lib/efl/interfaces/efl_gfx_shape.eo.hh \
lib/efl/interfaces/efl_gfx_gradient.eo.hh \
lib/efl/interfaces/efl_gfx_gradient_linear.eo.hh \

View File

@ -140,6 +140,7 @@ typedef enum _Efl_Gfx_Fill_Spread
#include "interfaces/efl_gfx_base.eo.h"
#include "interfaces/efl_gfx_stack.eo.h"
#include "interfaces/efl_gfx_fill.eo.h"
#include "interfaces/efl_gfx_view.eo.h"
#include "interfaces/efl_gfx_shape.eo.h"
#include "interfaces/efl_gfx_gradient.eo.h"
#include "interfaces/efl_gfx_gradient_linear.eo.h"

View File

@ -0,0 +1,27 @@
interface Efl.Gfx.View {
legacy_prefix: null;
properties {
size {
set {
/*@
Sets the size of the given image object.
This function will scale down or crop the image so that it is
treated as if it were at the given size. If the size given is
smaller than the image, it will be cropped. If the size given is
larger, then the image will be treated as if it were in the upper
left hand corner of a larger image that is otherwise transparent. */
}
get {
/*@
Retrieves the size of the given image object.
See @ref evas_object_image_size_set() for more details. */
}
values {
int w; /*@ The new width of the image. */
int h; /*@ The new height of the image. */
}
}
}
}

View File

@ -14,6 +14,8 @@
#include "interfaces/efl_gfx_base.eo.c"
#include "interfaces/efl_gfx_stack.eo.c"
#include "interfaces/efl_gfx_fill.eo.c"
#include "interfaces/efl_gfx_view.eo.c"
#include "interfaces/efl_gfx_shape.eo.c"
#include "interfaces/efl_gfx_gradient.eo.c"
#include "interfaces/efl_gfx_gradient_linear.eo.c"

View File

@ -2066,6 +2066,32 @@ image) to start drawing from.
*/
EAPI void evas_object_image_fill_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
/**
*
* Sets the size of the given image object.
*
* This function will scale down or crop the image so that it is
* treated as if it were at the given size. If the size given is
* smaller than the image, it will be cropped. If the size given is
* larger, then the image will be treated as if it were in the upper
* left hand corner of a larger image that is otherwise transparent.
*
* @param[in] w The new width of the image.
* @param[in] h The new height of the image.
*/
EAPI void evas_object_image_size_set(Evas_Object *obj, int w, int h);
/**
*
* Retrieves the size of the given image object.
*
* See @ref evas_object_image_size_set() for more details.
*
* @param[out] w The new width of the image.
* @param[out] h The new height of the image.
*/
EAPI void evas_object_image_size_get(const Evas_Object *obj, int *w, int *h);
#include "canvas/evas_image.eo.legacy.h"
/**

View File

@ -1,4 +1,4 @@
class Evas.Image (Evas.Object, Efl.File, Efl.Image, Efl.Gfx.Fill)
class Evas.Image (Evas.Object, Efl.File, Efl.Image, Efl.Gfx.Fill, Efl.Gfx.View)
{
legacy_prefix: evas_object_image;
eo_prefix: evas_obj_image;
@ -393,28 +393,6 @@ class Evas.Image (Evas.Object, Efl.File, Efl.Image, Efl.Gfx.Fill)
#Evas_Border_Fill_Mode). */
}
}
size {
set {
/*@
Sets the size of the given image object.
This function will scale down or crop the image so that it is
treated as if it were at the given size. If the size given is
smaller than the image, it will be cropped. If the size given is
larger, then the image will be treated as if it were in the upper
left hand corner of a larger image that is otherwise transparent. */
}
get {
/*@
Retrieves the size of the given image object.
See @ref evas_object_image_size_set() for more details. */
}
values {
int w; /*@ The new width of the image. */
int h; /*@ The new height of the image. */
}
}
source_visible {
set {
/*@
@ -1010,5 +988,7 @@ class Evas.Image (Evas.Object, Efl.File, Efl.Image, Efl.Gfx.Fill)
Efl.Gfx.Fill.fill_spread.get;
Efl.Gfx.Fill.fill.set;
Efl.Gfx.Fill.fill.get;
Efl.Gfx.View.size.set;
Efl.Gfx.View.size.get;
}
}

View File

@ -1073,8 +1073,14 @@ _evas_image_efl_gfx_fill_fill_spread_get(Eo *eo_obj EINA_UNUSED,
return (Evas_Fill_Spread)o->cur->spread;;
}
EAPI void
evas_object_image_size_set(Evas_Image *obj, int w, int h)
{
eo_do((Evas_Image *)obj, efl_gfx_view_size_set(w, h));
}
EOLIAN static void
_evas_image_size_set(Eo *eo_obj, Evas_Image_Data *o, int w, int h)
_evas_image_efl_gfx_view_size_set(Eo *eo_obj, Evas_Image_Data *o, int w, int h)
{
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
@ -1137,8 +1143,16 @@ _evas_image_size_set(Eo *eo_obj, Evas_Image_Data *o, int w, int h)
evas_object_change(eo_obj, obj);
}
EAPI void
evas_object_image_size_get(const Evas_Image *obj, int *w, int *h)
{
eo_do((Evas_Image *)obj, efl_gfx_view_size_get(w, h));
}
EOLIAN static void
_evas_image_size_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o, int *w, int *h)
_evas_image_efl_gfx_view_size_get(Eo *eo_obj EINA_UNUSED,
Evas_Image_Data *o,
int *w, int *h)
{
if (w) *w = o->cur->image.w;
if (h) *h = o->cur->image.h;