anonymous / clip.c
Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Example of different image object behavior in evas 1.0.1 vs. 1.0.0.

View clip.c
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
#include <Evas.h>
#include <Evas_Engine_FB.h>
 
#define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 240
#define ICON_FILENAME "gear.png"
 
int main(int argc, char **argv)
{
evas_init();
 
int renderMethod = evas_render_method_lookup("fb");
if (! renderMethod)
{
printf("Failed to lookup render method\n");
return -1;
}
 
Evas *evas = evas_new();
if (! evas)
{
printf("Failed to create evas\n");
return -2;
}
 
evas_output_method_set(evas, renderMethod);
Evas_Engine_Info_FB *engineInfo = (Evas_Engine_Info_FB *) evas_engine_info_get(evas);
engineInfo->info.device_number = 0;
evas_engine_info_set(evas, (Evas_Engine_Info *) engineInfo);
 
evas_output_size_set(evas, SCREEN_WIDTH, SCREEN_HEIGHT);
evas_output_viewport_set(evas, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
 
// White background.
Evas_Object *bg = evas_object_rectangle_add(evas);
evas_object_move(bg, 0, 0);
evas_object_resize(bg, SCREEN_WIDTH, SCREEN_HEIGHT);
evas_object_color_set(bg, 255, 255, 255, 255);
evas_object_show(bg);
 
// Icon
Evas_Object *icon = evas_object_image_add(evas);
evas_object_image_file_set(icon, ICON_FILENAME, NULL);
int iconWidth, iconHeight;
evas_object_image_size_get(icon, &iconWidth, &iconHeight);
evas_object_image_fill_set(icon, 0, 0, iconWidth, iconHeight);
evas_object_move(icon, (SCREEN_WIDTH - iconWidth) / 2, (SCREEN_HEIGHT - iconHeight) / 2);
// evas 1.0.0 displays only the right half of the image.
// evas 1.0.1 displays the entire image.
// Which is the correct behavior when the tile/fill size is larger than the image object's width?
evas_object_resize(icon, iconWidth / 2, iconHeight);
 
evas_object_show(icon);
evas_render(evas);
 
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.