add cedric bail's fill.type patch.

you can now include "type: TILE;" in the fill block to tile an image part at the size of its image data


SVN revision: 30624
This commit is contained in:
rephorm 2007-07-06 22:36:40 +00:00 committed by rephorm
parent 28294cb592
commit 982ad090be
4 changed files with 57 additions and 5 deletions

View File

@ -83,6 +83,7 @@ static void st_collections_group_parts_part_description_fill_size_relative(void)
static void st_collections_group_parts_part_description_fill_size_offset(void);
static void st_collections_group_parts_part_description_fill_angle(void);
static void st_collections_group_parts_part_description_fill_spread(void);
static void st_collections_group_parts_part_description_fill_type(void);
static void st_collections_group_parts_part_description_color_class(void);
static void st_collections_group_parts_part_description_color(void);
static void st_collections_group_parts_part_description_color2(void);
@ -229,6 +230,7 @@ New_Statement_Handler statement_handlers[] =
{"collections.group.parts.part.description.fill.size.offset", st_collections_group_parts_part_description_fill_size_offset},
{"collections.group.parts.part.description.fill.angle", st_collections_group_parts_part_description_fill_angle},
{"collections.group.parts.part.description.fill.spread", st_collections_group_parts_part_description_fill_spread},
{"collections.group.parts.part.description.fill.type", st_collections_group_parts_part_description_fill_type},
{"collections.group.parts.part.description.color_class", st_collections_group_parts_part_description_color_class},
{"collections.group.parts.part.description.color", st_collections_group_parts_part_description_color},
{"collections.group.parts.part.description.color2", st_collections_group_parts_part_description_color2},
@ -1151,6 +1153,7 @@ ob_collections_group_parts_part_description(void)
ed->fill.abs_y = 0;
ed->fill.angle = 0;
ed->fill.spread = 0;
ed->fill.type = EDJE_FILL_TYPE_SCALE;
ed->color_class = NULL;
ed->color.r = 255;
ed->color.g = 255;
@ -1801,7 +1804,7 @@ st_collections_group_parts_part_description_fill_smooth(void)
if (ep->type != EDJE_PART_TYPE_IMAGE)
{
fprintf(stderr, "%s: Error. parse error %s:%i. "
"fill attributes in non-IMAGE part.\n",
"fill.type attribute in non-IMAGE part.\n",
progname, file_in, line - 1);
exit(-1);
}
@ -2658,6 +2661,34 @@ st_collections_group_programs_program_in(void)
ep->in.range = parse_float_range(1, 0.0, 999999999.0);
}
static void
st_collections_group_parts_part_description_fill_type(void)
{
Edje_Part_Collection *pc;
Edje_Part *ep;
Edje_Part_Description *ed;
check_arg_count(1);
pc = evas_list_data(evas_list_last(edje_collections));
ep = evas_list_data(evas_list_last(pc->parts));
ed = ep->default_desc;
if (ep->other_desc) ed = evas_list_data(evas_list_last(ep->other_desc));
if (ep->type != EDJE_PART_TYPE_IMAGE)
{
fprintf(stderr, "%s: Error. parse error %s:%i. "
"fill attributes in non-IMAGE part.\n",
progname, file_in, line - 1);
exit(-1);
}
ed->fill.type = parse_enum(0,
"SCALE", EDJE_FILL_TYPE_SCALE,
"TILE", EDJE_FILL_TYPE_TILE,
NULL);
}
static void
st_collections_group_programs_program_action(void)
{

View File

@ -974,13 +974,26 @@ _edje_part_recalc_single(Edje *ed,
params->smooth = desc->fill.smooth;
if (flags & FLAG_X)
{
params->fill.x = desc->fill.pos_abs_x + (params->w * desc->fill.pos_rel_x);
params->fill.w = desc->fill.abs_x + (params->w * desc->fill.rel_x);
int fw;
if (desc->fill.type == EDJE_FILL_TYPE_TILE)
evas_object_image_size_get(ep->object, &fw, NULL);
else
fw = params->w;
params->fill.x = desc->fill.pos_abs_x + (fw * desc->fill.pos_rel_x);
params->fill.w = desc->fill.abs_x + (fw * desc->fill.rel_x);
}
if (flags & FLAG_Y)
{
params->fill.y = desc->fill.pos_abs_y + (params->h * desc->fill.pos_rel_y);
params->fill.h = desc->fill.abs_y + (params->h * desc->fill.rel_y);
int fh;
if (desc->fill.type == EDJE_FILL_TYPE_TILE)
evas_object_image_size_get(ep->object, NULL, &fh);
else
fh = params->h;
params->fill.y = desc->fill.pos_abs_y + (fh * desc->fill.pos_rel_y);
params->fill.h = desc->fill.abs_y + (fh * desc->fill.rel_y);
}
params->fill.angle = desc->fill.angle;
params->fill.spread = desc->fill.spread;

View File

@ -293,6 +293,7 @@ _edje_edd_setup(void)
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "fill.abs_y", fill.abs_y, EET_T_INT);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "fill.angle", fill.angle, EET_T_INT);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "fill.spread", fill.spread, EET_T_INT);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "fill.type", fill.type, EET_T_CHAR);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "color_class", color_class, EET_T_STRING);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "color.r", color.r, EET_T_UCHAR);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "color.g", color.g, EET_T_UCHAR);

View File

@ -504,6 +504,7 @@ struct _Edje_Part_Description
int angle; /* angle of fill -- currently only used by grads */
int spread; /* spread of fill -- currently only used by grads */
char smooth; /* fill with smooth scaling or not */
unsigned char type; /* fill coordinate from container (SCALE) or from source image (TILE) */
} fill;
char *color_class; /* how to modify the color */
@ -884,6 +885,12 @@ struct _Edje_Message
unsigned char *msg;
};
typedef enum _Edje_Fill
{
EDJE_FILL_TYPE_SCALE = 0,
EDJE_FILL_TYPE_TILE
} Edje_Fill;
EAPI extern Eet_Data_Descriptor *_edje_edd_edje_file;
EAPI extern Eet_Data_Descriptor *_edje_edd_edje_style;
EAPI extern Eet_Data_Descriptor *_edje_edd_edje_style_tag;