Go to the documentation of this file.
29 #define G_LOG_DOMAIN "Widgets.Icon"
77 cairo_surface_reference ( b->
icon );
80 if ( b->
icon == NULL ) {
83 int iconh = cairo_image_surface_get_height ( b->
icon );
84 int iconw = cairo_image_surface_get_width ( b->
icon );
85 int icons = MAX ( iconh, iconw );
86 double scale = (double) b->
size / icons;
95 cairo_translate ( draw,
96 lpad + ( b->
widget.
w - iconw * scale - lpad -rpad )*b->
xalign,
97 tpad + ( b->
widget.
h- iconh * scale -tpad - bpad )*b->
yalign );
98 cairo_scale ( draw, scale, scale );
99 cairo_set_source_surface ( draw, b->
icon, 0, 0 );
100 cairo_paint ( draw );
101 cairo_restore ( draw );
109 cairo_surface_destroy ( b->
icon );
129 cairo_surface_destroy (
icon->
icon );
133 cairo_surface_reference ( surf );
141 icon *b = g_malloc0 (
sizeof (
icon ) );
double rofi_theme_get_double(const widget *widget, const char *property, double def)
int rofi_theme_get_integer(const widget *widget, const char *property, int def)
static void icon_free(widget *wid)
static void icon_resize(widget *widget, short w, short h)
void icon_set_surface(icon *icon, cairo_surface_t *surf)
icon * icon_create(widget *parent, const char *name)
cairo_surface_t * rofi_icon_fetcher_get(const uint32_t uid)
const char * rofi_theme_get_string(const widget *widget, const char *property, const char *def)
static int icon_get_desired_height(widget *widget)
uint32_t rofi_icon_fetcher_query(const char *name, const int size)
static int icon_get_desired_width(widget *widget)
static void icon_draw(widget *wid, cairo_t *draw)