Dunst
Lightweight notification daemon
Loading...
Searching...
No Matches
icon.h File Reference

Notification images loading. More...

#include <cairo.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include "notification.h"
+ Include dependency graph for icon.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

cairo_surface_t * gdk_pixbuf_to_cairo_surface (GdkPixbuf *pixbuf)
 
GdkPixbuf * get_pixbuf_from_file (const char *filename, char **id, int min_size, int max_size, double scale)
 Retrieve an icon by its full filepath, scaled according to settings.
 
int get_icon_width (cairo_surface_t *icon, double scale)
 Get the unscaled icon width.
 
int get_icon_height (cairo_surface_t *icon, double scale)
 Get the unscaled icon height, see get_icon_width.
 
char * get_path_from_icon_name (const char *iconname, int size)
 Retrieve a path from an icon name.
 
GdkPixbuf * icon_get_for_data (GVariant *data, char **id, double dpi_scale, int min_size, int max_size)
 Convert a GVariant like described in GdkPixbuf, scaled according to settings.
 

Detailed Description

Notification images loading.

License
BSD-3-Clause

Definition in file icon.h.

Function Documentation

◆ gdk_pixbuf_to_cairo_surface()

cairo_surface_t * gdk_pixbuf_to_cairo_surface ( GdkPixbuf * pixbuf)

Definition at line 99 of file icon.c.

◆ get_icon_height()

int get_icon_height ( cairo_surface_t * icon,
double scale )

Get the unscaled icon height, see get_icon_width.

Definition at line 95 of file icon.c.

◆ get_icon_width()

int get_icon_width ( cairo_surface_t * icon,
double scale )

Get the unscaled icon width.

If scale is 2 for example, the icon will render in twice the size, but get_icon_width still returns the same size as when scale is 1.

Definition at line 91 of file icon.c.

◆ get_path_from_icon_name()

char * get_path_from_icon_name ( const char * iconname,
int size )

Retrieve a path from an icon name.

Parameters
iconnameA string describing a file:// URL, an arbitary filename or an icon name, which then gets searched for in the settings.icon_path
sizeSize of the icon to look for. This is only used when recursive icon lookup is enabled.
Returns
a newly allocated string with the icon path
Return values
NULLfile does not exist, not readable, etc..

Definition at line 249 of file icon.c.

◆ get_pixbuf_from_file()

GdkPixbuf * get_pixbuf_from_file ( const char * filename,
char ** id,
int min_size,
int max_size,
double scale )

Retrieve an icon by its full filepath, scaled according to settings.

Parameters
filenameA string representing a readable file path
id(necessary) A unique identifier of the returned pixbuf. Only filled, if the return value is non-NULL.
min_sizeAn iteger representing the desired minimum unscaled icon size.
max_sizeAn iteger representing the desired maximum unscaled icon size.
scaleAn integer representing the output dpi scaling.
Returns
an instance of GdkPixbuf
Return values
NULLfile does not exist, not readable, etc..

Definition at line 213 of file icon.c.

◆ icon_get_for_data()

GdkPixbuf * icon_get_for_data ( GVariant * data,
char ** id,
double dpi_scale,
int min_size,
int max_size )

Convert a GVariant like described in GdkPixbuf, scaled according to settings.

The returned id will be a unique identifier. To check if two given GdkPixbufs are equal, it's sufficient to just compare the id strings.

Parameters
dataA GVariant in the format "(iiibii@ay)" filled with values like described in the notification spec.
id(necessary) A unique identifier of the returned pixbuf. Only filled, if the return value is non-NULL.
dpi_scaleAn integer representing the output dpi scaling.
min_sizeAn integer representing the desired minimum unscaled icon size.
max_sizeAn integer representing the desired maximum unscaled icon size.
Returns
an instance of GdkPixbuf derived from the GVariant
Return values
NULLGVariant parameter nulled, invalid or in wrong format

Definition at line 313 of file icon.c.