mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-18 13:54:36 -05:00
[Theme] Add angle support to linear-gradient.
This commit is contained in:
parent
5c5428bd11
commit
828aaa231a
5 changed files with 24 additions and 0 deletions
|
@ -370,6 +370,9 @@ Format: linear\-gradient(stop color,stop1, color, stop2 color, ...);
|
|||
.IP \(bu 2
|
||||
Format: linear\-gradient(to direction, stop color,stop1, color, stop2 color, ...);
|
||||
where direction is: top,left,right,bottom.
|
||||
.IP \(bu 2
|
||||
Format: linear\-gradient(angle, stop color,stop1, color, stop2 color, ...);
|
||||
Angle in deg,rad,grad (as used in color).
|
||||
|
||||
.PP
|
||||
Where the path is a string, and stop color is of type color.
|
||||
|
|
|
@ -258,6 +258,8 @@ dynamic: false;
|
|||
* Format: linear-gradient(stop color,stop1, color, stop2 color, ...);
|
||||
* Format: linear-gradient(to direction, stop color,stop1, color, stop2 color, ...);
|
||||
where direction is: top,left,right,bottom.
|
||||
* Format: linear-gradient(angle, stop color,stop1, color, stop2 color, ...);
|
||||
Angle in deg,rad,grad (as used in color).
|
||||
|
||||
Where the path is a string, and stop color is of type color.
|
||||
|
||||
|
|
|
@ -185,6 +185,7 @@ typedef enum
|
|||
ROFI_DIRECTION_RIGHT,
|
||||
ROFI_DIRECTION_TOP,
|
||||
ROFI_DIRECTION_BOTTOM,
|
||||
ROFI_DIRECTION_ANGLE,
|
||||
} RofiDirection;
|
||||
|
||||
|
||||
|
@ -194,6 +195,7 @@ typedef struct
|
|||
char *url;
|
||||
|
||||
RofiDirection dir;
|
||||
double angle;
|
||||
/** colors */
|
||||
GList *colors;
|
||||
|
||||
|
|
|
@ -556,6 +556,14 @@ t_property_element
|
|||
$$->value.image.dir = $4;
|
||||
$$->value.image.colors = $6;
|
||||
}
|
||||
| T_LINEAR_GRADIENT T_PARENT_LEFT t_property_color_value_angle T_COMMA t_color_list T_PARENT_RIGHT {
|
||||
$$ = rofi_theme_property_create ( P_IMAGE );
|
||||
$$->value.image.type = ROFI_IMAGE_LINEAR_GRADIENT;
|
||||
$$->value.image.dir = ROFI_DIRECTION_ANGLE;
|
||||
$$->value.image.angle = $3;
|
||||
$$->value.image.colors = $5;
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
t_property_direction
|
||||
|
|
|
@ -1015,6 +1015,15 @@ gboolean rofi_theme_get_image ( const widget *widget, const char *property, cair
|
|||
case ROFI_DIRECTION_TOP:
|
||||
pat = cairo_pattern_create_linear (0.0,widget->h, 0.0, 0.0);
|
||||
break;
|
||||
case ROFI_DIRECTION_ANGLE:
|
||||
{
|
||||
double offsety1 = sin(G_PI*2*p->value.image.angle)*(widget->h/2.0);
|
||||
double offsetx1 = cos(G_PI*2*p->value.image.angle)*(widget->w/2.0);
|
||||
pat = cairo_pattern_create_linear (
|
||||
widget->w/2.0 - offsetx1, widget->h/2.0 - offsety1,
|
||||
widget->w/2.0 + offsetx1, widget->h/2.0 + offsety1 );
|
||||
break;
|
||||
}
|
||||
};
|
||||
guint length = g_list_length ( p->value.image.colors );
|
||||
if ( length > 1 ){
|
||||
|
|
Loading…
Reference in a new issue