add border_scale option for images - image border will scale based on edje

scale factors. this is independant of scale: per part.



SVN revision: 46341
This commit is contained in:
Carsten Haitzler 2010-02-21 06:53:44 +00:00
parent a4b6192e7f
commit e89c590b0d
4 changed files with 47 additions and 0 deletions

View File

@ -162,6 +162,7 @@ static void st_collections_group_parts_part_description_image_normal(void);
static void st_collections_group_parts_part_description_image_tween(void);
static void st_collections_group_parts_part_description_image_border(void);
static void st_collections_group_parts_part_description_image_middle(void);
static void st_collections_group_parts_part_description_image_border_scale(void);
static void st_collections_group_parts_part_description_image_scale_hint(void);
static void st_collections_group_parts_part_description_fill_smooth(void);
static void st_collections_group_parts_part_description_fill_origin_relative(void);
@ -383,6 +384,7 @@ New_Statement_Handler statement_handlers[] =
{"collections.group.parts.part.description.image.images.image", st_images_image}, /* dup */
{"collections.group.parts.part.description.image.border", st_collections_group_parts_part_description_image_border},
{"collections.group.parts.part.description.image.middle", st_collections_group_parts_part_description_image_middle},
{"collections.group.parts.part.description.image.border_scale", st_collections_group_parts_part_description_image_border_scale},
{"collections.group.parts.part.description.image.scale_hint", st_collections_group_parts_part_description_image_scale_hint},
{"collections.group.parts.part.description.fill.smooth", st_collections_group_parts_part_description_fill_smooth},
{"collections.group.parts.part.description.fill.origin.relative", st_collections_group_parts_part_description_fill_origin_relative},
@ -4111,6 +4113,45 @@ st_collections_group_parts_part_description_image_middle(void)
NULL);
}
/**
@page edcref
@property
scale
@parameters
0, 1
@effect
If border is set, this value tells Edje if the border should be scaled
by the object/global edje scale factors
@endproperty
*/
static void
st_collections_group_parts_part_description_image_border_scale(void)
{
Edje_Part_Collection *pc;
Edje_Part *ep;
Edje_Part_Description *ed;
check_arg_count(1);
pc = eina_list_data_get(eina_list_last(edje_collections));
ep = eina_list_data_get(eina_list_last(pc->parts));
if (ep->type != EDJE_PART_TYPE_IMAGE)
{
ERR("%s: Error. parse error %s:%i. "
"image attributes in non-IMAGE part.",
progname, file_in, line - 1);
exit(-1);
}
ed = ep->default_desc;
if (ep->other_desc) ed = eina_list_data_get(eina_list_last(ep->other_desc));
ed->border.scale = parse_enum(0,
"1", 0,
"0", 1,
NULL);
}
/**
@page edcref
@property

View File

@ -1501,10 +1501,14 @@ _edje_image_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3, Edj
{
int image_id;
int image_count, image_num;
FLOAT_T sc;
sc = ed->scale;
if (sc == 0.0) sc = _edje_scale;
evas_object_image_fill_set(ep->object, p3->type.common.fill.x, p3->type.common.fill.y,
p3->type.common.fill.w, p3->type.common.fill.h);
evas_object_image_smooth_scale_set(ep->object, p3->smooth);
evas_object_image_border_scale_set(ep->object, TO_DOUBLE(sc));
evas_object_image_border_set(ep->object, p3->type.common.spec.image.l, p3->type.common.spec.image.r,
p3->type.common.spec.image.t, p3->type.common.spec.image.b);
if (chosen_desc->border.no_fill == 0)

View File

@ -284,6 +284,7 @@ _edje_edd_init(void)
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "border.t", border.t, EET_T_INT);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "border.b", border.b, EET_T_INT);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "border.no_fill", border.no_fill, EET_T_UCHAR);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "border.scale", border.scale, EET_T_UCHAR);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "fill.smooth", fill.smooth, EET_T_CHAR);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "fill.pos_rel_x", fill.pos_rel_x, EDJE_T_FLOAT);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "fill.pos_abs_x", fill.pos_abs_x, EET_T_INT);

View File

@ -609,6 +609,7 @@ struct _Edje_Part_Description
struct {
int l, r, t, b; /* border scaling on image fill */
unsigned char no_fill; /* do we fill the center of the image if bordered? 1 == NO!!!! */
unsigned char scale; /* scale image border by same as scale factor */
} border;
struct {