add border_scale_by that adds another scaling factor for border

scaling. use it as a way of super-sampling borders (eg use 0.5 to use
2x over-sampling, 0.25 for 4x oversapling etc.)



SVN revision: 63938
This commit is contained in:
Carsten Haitzler 2011-10-10 05:53:02 +00:00
parent 74c07498f9
commit f18d4de8d5
4 changed files with 50 additions and 1 deletions

View File

@ -191,6 +191,7 @@ 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_border_scale_by(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);
@ -450,6 +451,7 @@ New_Statement_Handler statement_handlers[] =
{"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.border_scale_by", st_collections_group_parts_part_description_image_border_scale_by},
{"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},
@ -4893,6 +4895,43 @@ st_collections_group_parts_part_description_image_middle(void)
NULL);
}
/**
@page edcref
@property
border_scale_by
@parameters
0.0 or bigger (0.0 or 1.0 to turn it off)
@effect
If border scaling is enabled then normally the OUTPUT border sizes
(e.g. if 3 pixels on the left edge are set as a border, then normally
at scale 1.0, those 3 columns will always be the exact 3 columns of
output, or at scale 2.0 they will be 6 columns, or 0.33 they will merge
into a single column). This property multiplies the input scale
factor by this multiplier, allowing the creation of "supersampled"
borders to make much higher resolution outputs possible by always using
the highest resolution artwork and then runtime scaling it down.
@endproperty
*/
static void
st_collections_group_parts_part_description_image_border_scale_by(void)
{
Edje_Part_Description_Image *ed;
check_arg_count(1);
if (current_part->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 = (Edje_Part_Description_Image*) current_desc;
ed->image.border.scale_by = FROM_DOUBLE(parse_float_range(0, 0.0, 999999999.0));
}
/**
@page edcref
@property

View File

@ -1876,7 +1876,15 @@ _edje_image_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3, Edj
p3->type.common.fill.w, p3->type.common.fill.h);
evas_object_image_smooth_scale_set(ep->object, p3->smooth);
if (chosen_desc->image.border.scale)
evas_object_image_border_scale_set(ep->object, TO_DOUBLE(sc));
{
if (chosen_desc->image.border.scale_by > FROM_DOUBLE(0.0))
{
FLOAT_T sc2 = MUL(sc, chosen_desc->image.border.scale_by);
evas_object_image_border_scale_set(ep->object, TO_DOUBLE(sc2));
}
else
evas_object_image_border_scale_set(ep->object, TO_DOUBLE(sc));
}
else
evas_object_image_border_scale_set(ep->object, 1.0);
evas_object_image_border_set(ep->object, p3->type.common.spec.image.l, p3->type.common.spec.image.r,

View File

@ -554,6 +554,7 @@ _edje_edd_init(void)
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.border.b", image.border.b, EET_T_INT);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.border.no_fill", image.border.no_fill, EET_T_UCHAR);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.border.scale", image.border.scale, EET_T_UCHAR);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.border.scale_by", image.border.scale_by, EDJE_T_FLOAT);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.fill.smooth", image.fill.smooth, EET_T_CHAR);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.fill.pos_rel_x", image.fill.pos_rel_x, EDJE_T_FLOAT);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.fill.pos_abs_x", image.fill.pos_abs_x, EET_T_INT);

View File

@ -847,6 +847,7 @@ struct _Edje_Part_Description_Spec_Border
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 */
FLOAT_T scale_by; /* when border scale above is enabled, border width OUTPUT is scaled by the object or global scale factor. this value adds another multiplier that the global scale is multiplued by first. if <= 0.0 it is not used, and if 1.0 it i s "ineffective" */
};
struct _Edje_Part_Description_Spec_Image