mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-27 22:20:24 +00:00
gtk: Add gtk_snapshot_append_{in,out}set_shadow2
These are private snapshot functions that use the new constructors to create a box shadow nodes with a given color state.
This commit is contained in:
parent
ea28dc8cff
commit
abefa0ab00
@ -2880,6 +2880,37 @@ gtk_snapshot_append_inset_shadow (GtkSnapshot *snapshot,
|
|||||||
float dy,
|
float dy,
|
||||||
float spread,
|
float spread,
|
||||||
float blur_radius)
|
float blur_radius)
|
||||||
|
{
|
||||||
|
GdkColor color2;
|
||||||
|
|
||||||
|
gdk_color_init_from_rgba (&color2, color);
|
||||||
|
gtk_snapshot_append_inset_shadow2 (snapshot,
|
||||||
|
outline,
|
||||||
|
&color2,
|
||||||
|
dx, dy, spread, blur_radius);
|
||||||
|
gdk_color_finish (&color2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*< private >
|
||||||
|
* gtk_snapshot_append_inset_shadow2:
|
||||||
|
* @snapshot: a `GtkSnapshot`
|
||||||
|
* @outline: outline of the region surrounded by shadow
|
||||||
|
* @color: color of the shadow
|
||||||
|
* @dx: horizontal offset of shadow
|
||||||
|
* @dy: vertical offset of shadow
|
||||||
|
* @spread: how far the shadow spreads towards the inside
|
||||||
|
* @blur_radius: how much blur to apply to the shadow
|
||||||
|
*
|
||||||
|
* Appends an inset shadow into the box given by @outline.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
gtk_snapshot_append_inset_shadow2 (GtkSnapshot *snapshot,
|
||||||
|
const GskRoundedRect *outline,
|
||||||
|
const GdkColor *color,
|
||||||
|
float dx,
|
||||||
|
float dy,
|
||||||
|
float spread,
|
||||||
|
float blur_radius)
|
||||||
{
|
{
|
||||||
GskRenderNode *node;
|
GskRenderNode *node;
|
||||||
GskRoundedRect real_outline;
|
GskRoundedRect real_outline;
|
||||||
@ -2892,12 +2923,12 @@ gtk_snapshot_append_inset_shadow (GtkSnapshot *snapshot,
|
|||||||
gtk_snapshot_ensure_affine (snapshot, &scale_x, &scale_y, &x, &y);
|
gtk_snapshot_ensure_affine (snapshot, &scale_x, &scale_y, &x, &y);
|
||||||
gsk_rounded_rect_scale_affine (&real_outline, outline, scale_x, scale_y, x, y);
|
gsk_rounded_rect_scale_affine (&real_outline, outline, scale_x, scale_y, x, y);
|
||||||
|
|
||||||
node = gsk_inset_shadow_node_new (&real_outline,
|
node = gsk_inset_shadow_node_new2 (&real_outline,
|
||||||
color,
|
color,
|
||||||
scale_x * dx,
|
scale_x * dx,
|
||||||
scale_y * dy,
|
scale_y * dy,
|
||||||
spread,
|
spread,
|
||||||
blur_radius);
|
blur_radius);
|
||||||
|
|
||||||
gtk_snapshot_append_node_internal (snapshot, node);
|
gtk_snapshot_append_node_internal (snapshot, node);
|
||||||
}
|
}
|
||||||
@ -2922,6 +2953,37 @@ gtk_snapshot_append_outset_shadow (GtkSnapshot *snapshot,
|
|||||||
float dy,
|
float dy,
|
||||||
float spread,
|
float spread,
|
||||||
float blur_radius)
|
float blur_radius)
|
||||||
|
{
|
||||||
|
GdkColor color2;
|
||||||
|
|
||||||
|
gdk_color_init_from_rgba (&color2, color);
|
||||||
|
gtk_snapshot_append_outset_shadow2 (snapshot,
|
||||||
|
outline,
|
||||||
|
&color2,
|
||||||
|
dx, dy, spread, blur_radius);
|
||||||
|
gdk_color_finish (&color2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*< private >
|
||||||
|
* gtk_snapshot_append_outset_shadow2:
|
||||||
|
* @snapshot: a `GtkSnapshot`
|
||||||
|
* @outline: outline of the region surrounded by shadow
|
||||||
|
* @color: color of the shadow
|
||||||
|
* @dx: horizontal offset of shadow
|
||||||
|
* @dy: vertical offset of shadow
|
||||||
|
* @spread: how far the shadow spreads towards the outside
|
||||||
|
* @blur_radius: how much blur to apply to the shadow
|
||||||
|
*
|
||||||
|
* Appends an outset shadow node around the box given by @outline.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
gtk_snapshot_append_outset_shadow2 (GtkSnapshot *snapshot,
|
||||||
|
const GskRoundedRect *outline,
|
||||||
|
const GdkColor *color,
|
||||||
|
float dx,
|
||||||
|
float dy,
|
||||||
|
float spread,
|
||||||
|
float blur_radius)
|
||||||
{
|
{
|
||||||
GskRenderNode *node;
|
GskRenderNode *node;
|
||||||
GskRoundedRect real_outline;
|
GskRoundedRect real_outline;
|
||||||
@ -2934,13 +2996,12 @@ gtk_snapshot_append_outset_shadow (GtkSnapshot *snapshot,
|
|||||||
gtk_snapshot_ensure_affine (snapshot, &scale_x, &scale_y, &x, &y);
|
gtk_snapshot_ensure_affine (snapshot, &scale_x, &scale_y, &x, &y);
|
||||||
gsk_rounded_rect_scale_affine (&real_outline, outline, scale_x, scale_y, x, y);
|
gsk_rounded_rect_scale_affine (&real_outline, outline, scale_x, scale_y, x, y);
|
||||||
|
|
||||||
node = gsk_outset_shadow_node_new (&real_outline,
|
node = gsk_outset_shadow_node_new2 (&real_outline,
|
||||||
color,
|
color,
|
||||||
scale_x * dx,
|
scale_x * dx,
|
||||||
scale_y * dy,
|
scale_y * dy,
|
||||||
spread,
|
spread,
|
||||||
blur_radius);
|
blur_radius);
|
||||||
|
|
||||||
|
|
||||||
gtk_snapshot_append_node_internal (snapshot, node);
|
gtk_snapshot_append_node_internal (snapshot, node);
|
||||||
}
|
}
|
||||||
|
@ -45,5 +45,21 @@ void gtk_snapshot_append_border2 (GtkSnapshot
|
|||||||
const float border_width[4],
|
const float border_width[4],
|
||||||
const GdkColor border_color[4]);
|
const GdkColor border_color[4]);
|
||||||
|
|
||||||
|
void gtk_snapshot_append_inset_shadow2 (GtkSnapshot *snapshot,
|
||||||
|
const GskRoundedRect *outline,
|
||||||
|
const GdkColor *color,
|
||||||
|
float dx,
|
||||||
|
float dy,
|
||||||
|
float spread,
|
||||||
|
float blur_radius);
|
||||||
|
|
||||||
|
void gtk_snapshot_append_outset_shadow2 (GtkSnapshot *snapshot,
|
||||||
|
const GskRoundedRect *outline,
|
||||||
|
const GdkColor *color,
|
||||||
|
float dx,
|
||||||
|
float dy,
|
||||||
|
float spread,
|
||||||
|
float blur_radius);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user