The canvas receiving this image object will have a white background, a red border image to delimit this image's boundaries and the image itself. After we create the special image, we set its "fill" property, place and resize it as we want. We have also to resize its underlying Ecore_Evas
too, to the same dimensions:
img, ((2 * WIDTH) / 3) - 6, ((2 * HEIGHT) / 3) - 6);
EAPI void ecore_evas_resize(Ecore_Evas *ee, int w, int h)
Resizes an Ecore_Evas.
Definition: ecore_evas.c:1324
EAPI Evas * ecore_evas_object_evas_get(Evas_Object *obj)
Retrieve the canvas bound to the internal Ecore_Evas handle of an image object created via ecore_evas...
Definition: ecore_evas.c:1120
EAPI Evas_Object * ecore_evas_object_image_new(Ecore_Evas *ee_target)
Creates an Evas image object with image data bound to an own, internal Ecore_Evas canvas wrapper
Definition: ecore_evas_buffer.c:941
EAPI Ecore_Evas * ecore_evas_object_ecore_evas_get(Evas_Object *obj)
Retrieve the internal Ecore_Evas handle of an image object created via ecore_evas_object_image_new().
Definition: ecore_evas.c:1131
#define EINA_TRUE
boolean value TRUE (numerical value 1)
Definition: eina_types.h:539
EVAS_API void evas_object_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
Move the given Evas object to the given location inside its canvas' viewport.
Definition: evas_object_main.c:1171
EVAS_API void evas_object_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
Changes the size of the given Evas object.
Definition: evas_object_main.c:1236
EVAS_API void evas_object_image_size_set(Evas_Object *eo_obj, int w, int h)
Sets the size of the given image object.
Definition: evas_image_legacy.c:847
EVAS_API void evas_object_image_filled_set(Evas_Object *eo_obj, Eina_Bool value)
Set whether the image object's fill property should track the object's size.
Definition: evas_image_legacy.c:81
Now, we re-create the scene we cited, using the sub-canvas of our image to parent the objects in question. Because image objects are created with the alpha channel enabled, by default, we'll be seeing our white rectangle beneath the scene:
And that's all. The contents of our image could be updated as one wished, and they would always be mirrored in the image's area.
Check that destination file for the result. The full example follows.
#ifdef HAVE_CONFIG_H
#include "config.h"
#else
#define EINA_UNUSED
#define PACKAGE_EXAMPLES_DIR "."
#endif
#include <Ecore.h>
#include <stdio.h>
#define WIDTH (320)
#define HEIGHT (240)
static Ecore_Evas *ee;
static const char *border_img_path = PACKAGE_EXAMPLES_DIR "/red.png";
static void
{
}
int
main(void)
{
Evas *canvas, *sub_canvas;
Ecore_Evas *sub_ee;
if (!ee) goto error;
img, ((2 * WIDTH) / 3) - 6, ((2 * HEIGHT) / 3) - 6);
return 0;
error:
fprintf(stderr, "error: Requires at least one Evas engine built"
" and linked to ecore-evas for this example to run"
" properly.\n");
return -1;
}
EAPI int ecore_evas_init(void)
Inits the Ecore_Evas system.
Definition: ecore_evas.c:602
EAPI void ecore_evas_title_set(Ecore_Evas *ee, const char *t)
Sets the title of an Ecore_Evas' window.
Definition: ecore_evas.c:1527
EAPI void ecore_evas_callback_delete_request_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
Sets a callback for Ecore_Evas delete request events.
Definition: ecore_evas.c:1176
EAPI void ecore_evas_show(Ecore_Evas *ee)
Shows an Ecore_Evas' window.
Definition: ecore_evas.c:1480
EAPI void ecore_evas_size_min_set(Ecore_Evas *ee, int w, int h)
Sets the minimum size of a given Ecore_Evas window.
Definition: ecore_evas.c:1560
EAPI Evas * ecore_evas_get(const Ecore_Evas *ee)
Gets an Ecore_Evas's Evas.
Definition: ecore_evas.c:1300
EAPI Ecore_Evas * ecore_evas_new(const char *engine_name, int x, int y, int w, int h, const char *extra_options)
Creates a new Ecore_Evas based on engine name and common parameters.
Definition: ecore_evas.c:1039
EAPI int ecore_evas_shutdown(void)
Shuts down the Ecore_Evas system.
Definition: ecore_evas.c:666
EAPI void ecore_evas_size_max_set(Ecore_Evas *ee, int w, int h)
Sets the maximum size of a given Ecore_Evas window.
Definition: ecore_evas.c:1596
EAPI void ecore_evas_free(Ecore_Evas *ee)
Frees an Ecore_Evas.
Definition: ecore_evas.c:1083
void ecore_main_loop_quit(void)
Quits the main loop once all the events currently on the queue have been processed.
Definition: ecore_main.c:1321
#define EINA_UNUSED
Used to indicate that a function parameter is purposely unused.
Definition: eina_types.h:339
Eo Evas
An opaque handle to an Evas canvas.
Definition: Evas_Common.h:163
Efl_Canvas_Object Evas_Object
An Evas Object handle.
Definition: Evas_Common.h:185
EVAS_API void evas_object_image_border_set(Evas_Object *obj, int l, int r, int t, int b)
Dimensions of this image's border, a region that does not scale with the center area.
Definition: evas_image_legacy.c:117
EVAS_API void evas_object_image_border_center_fill_set(Evas_Object *obj, Evas_Border_Fill_Mode fill)
Specifies how the center part of the object (not the borders) should be drawn when EFL is rendering i...
Definition: evas_image_legacy.c:145
EVAS_API void evas_object_image_file_set(Evas_Object *obj, const char *file, const char *key)
Set the source file from where an image object must fetch the real image data (it may be an Eet file,...
Definition: evas_image_legacy.c:194
EVAS_API Evas_Object * evas_object_image_filled_add(Evas *eo_e)
Creates a new image object that automatically scales its bound image to the object's area,...
Definition: evas_image_legacy.c:35
@ EVAS_BORDER_FILL_NONE
Image's center region is not to be rendered.
Definition: Evas_Legacy.h:5721