x = _gtk_css_position_value_get_x (pos, width - image_width) + origin->bounds.origin.x;
y = _gtk_css_position_value_get_y (pos, height - image_height) + origin->bounds.origin.y; if (hrepeat == GTK_CSS_REPEAT_STYLE_NO_REPEAT && vrepeat == GTK_CSS_REPEAT_STYLE_NO_REPEAT)
{ /* shortcut for normal case */ if (x != 0 || y != 0)
{
gtk_snapshot_save (snapshot);
gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (x, y));
gtk_css_image_snapshot (image, snapshot, image_width, image_height);
gtk_snapshot_restore (snapshot);
} else
{
gtk_css_image_snapshot (image, snapshot, image_width, image_height);
}
} else
{ float repeat_width, repeat_height;
graphene_rect_t fill_rect;
/* If ‘background-repeat’ is ‘round’ for one (or both) dimensions, *thereisasecondstep.TheUAmustscaletheimageinthat *dimension(orbothdimensions)sothatitfitsawholenumberof *timesinthebackgroundpositioningarea.Inthecaseofthewidth *(heightisanalogous): * *IfX≠0isthewidthoftheimageaftersteponeandWisthewidth *ofthebackgroundpositioningarea,thentheroundedwidth *X'=W/round(W/X)whereround()isafunctionthatreturnsthe *nearestnaturalnumber(integergreaterthanzero). * *If‘background-repeat’is‘round’foronedimensiononlyandif *‘background-size’is‘auto’fortheotherdimension,thenthereis *athirdstep:thatotherdimensionisscaledsothattheoriginal *aspectratioisrestored.
*/ if (hrepeat == GTK_CSS_REPEAT_STYLE_ROUND)
{ double n = round (width / image_width);
n = MAX (1, n);
if (vrepeat != GTK_CSS_REPEAT_STYLE_ROUND /* && vsize == auto (it is by default) */)
image_height *= width / (image_width * n);
image_width = width / n;
} if (vrepeat == GTK_CSS_REPEAT_STYLE_ROUND)
{ double n = round (height / image_height);
n = MAX (1, n);
if (hrepeat != GTK_CSS_REPEAT_STYLE_ROUND /* && hsize == auto (it is by default) */)
image_width *= height / (image_height * n);
image_height = height / n;
}
/* if hrepeat or vrepeat is 'space', we create a somewhat larger surface
* to store the extra space. */ if (hrepeat == GTK_CSS_REPEAT_STYLE_SPACE)
{ double n = floor (width / image_width);
repeat_width = n ? round (width / n) : 0;
} else
repeat_width = round (image_width);
if (vrepeat == GTK_CSS_REPEAT_STYLE_SPACE)
{ double n = floor (height / image_height);
repeat_height = n ? round (height / n) : 0;
} else
repeat_height = round (image_height);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.