Imlib2 1.11.1
Functions
Imlib2.h File Reference

Go to the source code of this file.

Functions

EAPI int imlib_version (void)
 
EAPI Imlib_Context imlib_context_new (void)
 
EAPI void imlib_context_free (Imlib_Context context)
 
EAPI void imlib_context_push (Imlib_Context context)
 
EAPI void imlib_context_pop (void)
 
EAPI Imlib_Context imlib_context_get (void)
 
EAPI void imlib_context_set_display (Display *display)
 
EAPI Display * imlib_context_get_display (void)
 
EAPI void imlib_context_disconnect_display (void)
 
EAPI void imlib_context_set_visual (Visual *visual)
 
EAPI Visual * imlib_context_get_visual (void)
 
EAPI void imlib_context_set_colormap (Colormap colormap)
 
EAPI Colormap imlib_context_get_colormap (void)
 
EAPI void imlib_context_set_drawable (Drawable drawable)
 
EAPI Drawable imlib_context_get_drawable (void)
 
EAPI void imlib_context_set_mask (Pixmap mask)
 
EAPI Pixmap imlib_context_get_mask (void)
 
EAPI void imlib_context_set_dither_mask (char dither_mask)
 
EAPI char imlib_context_get_dither_mask (void)
 
EAPI void imlib_context_set_mask_alpha_threshold (int mask_alpha_threshold)
 
EAPI int imlib_context_get_mask_alpha_threshold (void)
 
EAPI void imlib_context_set_anti_alias (char anti_alias)
 
EAPI char imlib_context_get_anti_alias (void)
 
EAPI void imlib_context_set_dither (char dither)
 
EAPI char imlib_context_get_dither (void)
 
EAPI void imlib_context_set_blend (char blend)
 
EAPI char imlib_context_get_blend (void)
 
EAPI void imlib_context_set_color_modifier (Imlib_Color_Modifier color_modifier)
 
EAPI Imlib_Color_Modifier imlib_context_get_color_modifier (void)
 
EAPI void imlib_context_set_operation (Imlib_Operation operation)
 
EAPI Imlib_Operation imlib_context_get_operation (void)
 
EAPI void imlib_context_set_font (Imlib_Font font)
 
EAPI Imlib_Font imlib_context_get_font (void)
 
EAPI void imlib_context_set_direction (Imlib_Text_Direction direction)
 
EAPI Imlib_Text_Direction imlib_context_get_direction (void)
 
EAPI void imlib_context_set_angle (double angle)
 
EAPI double imlib_context_get_angle (void)
 
EAPI void imlib_context_set_color (int red, int green, int blue, int alpha)
 
EAPI void imlib_context_get_color (int *red, int *green, int *blue, int *alpha)
 
EAPI void imlib_context_set_color_hsva (float hue, float saturation, float value, int alpha)
 
EAPI void imlib_context_get_color_hsva (float *hue, float *saturation, float *value, int *alpha)
 
EAPI void imlib_context_set_color_hlsa (float hue, float lightness, float saturation, int alpha)
 
EAPI void imlib_context_get_color_hlsa (float *hue, float *lightness, float *saturation, int *alpha)
 
EAPI void imlib_context_set_color_cmya (int cyan, int magenta, int yellow, int alpha)
 
EAPI void imlib_context_get_color_cmya (int *cyan, int *magenta, int *yellow, int *alpha)
 
EAPI Imlib_Color * imlib_context_get_imlib_color (void)
 
EAPI void imlib_context_set_color_range (Imlib_Color_Range color_range)
 
EAPI Imlib_Color_Range imlib_context_get_color_range (void)
 
EAPI void imlib_context_set_image_data_memory_function (Imlib_Image_Data_Memory_Function memory_function)
 
EAPI Imlib_Image_Data_Memory_Function imlib_context_get_image_data_memory_function (void)
 
EAPI void imlib_context_set_progress_function (Imlib_Progress_Function progress_function)
 
EAPI Imlib_Progress_Function imlib_context_get_progress_function (void)
 
EAPI void imlib_context_set_progress_granularity (char progress_granularity)
 
EAPI char imlib_context_get_progress_granularity (void)
 
EAPI void imlib_context_set_image (Imlib_Image image)
 
EAPI Imlib_Image imlib_context_get_image (void)
 
EAPI void imlib_context_set_cliprect (int x, int y, int w, int h)
 
EAPI void imlib_context_get_cliprect (int *x, int *y, int *w, int *h)
 
EAPI int imlib_get_cache_used (void)
 
EAPI int imlib_get_cache_size (void)
 
EAPI void imlib_set_cache_size (int bytes)
 
EAPI int imlib_get_color_usage (void)
 
EAPI void imlib_set_color_usage (int max)
 
EAPI int imlib_get_visual_depth (Display *display, Visual *visual)
 
EAPI Visual * imlib_get_best_visual (Display *display, int screen, int *depth_return)
 
EAPI void imlib_flush_loaders (void)
 
EAPI int imlib_get_error (void)
 
EAPI Imlib_Image imlib_load_image (const char *file)
 
EAPI Imlib_Image imlib_load_image_immediately (const char *file)
 
EAPI Imlib_Image imlib_load_image_without_cache (const char *file)
 
EAPI Imlib_Image imlib_load_image_immediately_without_cache (const char *file)
 
EAPI Imlib_Image imlib_load_image_with_errno_return (const char *file, int *error_return)
 
EAPI Imlib_Image imlib_load_image_fd (int fd, const char *file)
 
EAPI Imlib_Image imlib_load_image_mem (const char *file, const void *data, size_t size)
 
EAPI void imlib_free_image (void)
 
EAPI void imlib_free_image_and_decache (void)
 
EAPI int imlib_image_get_width (void)
 
EAPI int imlib_image_get_height (void)
 
EAPI const char * imlib_image_get_filename (void)
 
EAPI uint32_t * imlib_image_get_data (void)
 
EAPI uint32_t * imlib_image_get_data_for_reading_only (void)
 
EAPI void imlib_image_put_back_data (uint32_t *data)
 
EAPI char imlib_image_has_alpha (void)
 
EAPI void imlib_image_set_changes_on_disk (void)
 
EAPI void imlib_image_get_border (Imlib_Border *border)
 
EAPI void imlib_image_set_border (Imlib_Border *border)
 
EAPI void imlib_image_set_format (const char *format)
 
EAPI void imlib_image_set_irrelevant_format (char irrelevant)
 
EAPI char * imlib_image_format (void)
 
EAPI void imlib_image_set_has_alpha (char has_alpha)
 
EAPI void imlib_image_query_pixel (int x, int y, Imlib_Color *color_return)
 
EAPI void imlib_image_query_pixel_hsva (int x, int y, float *hue, float *saturation, float *value, int *alpha)
 
EAPI void imlib_image_query_pixel_hlsa (int x, int y, float *hue, float *lightness, float *saturation, int *alpha)
 
EAPI void imlib_image_query_pixel_cmya (int x, int y, int *cyan, int *magenta, int *yellow, int *alpha)
 
EAPI void imlib_render_pixmaps_for_whole_image (Pixmap *pixmap_return, Pixmap *mask_return)
 
EAPI void imlib_render_pixmaps_for_whole_image_at_size (Pixmap *pixmap_return, Pixmap *mask_return, int width, int height)
 
EAPI void imlib_free_pixmap_and_mask (Pixmap pixmap)
 
EAPI void imlib_render_image_on_drawable (int x, int y)
 
EAPI void imlib_render_image_on_drawable_at_size (int x, int y, int width, int height)
 
EAPI void imlib_render_image_part_on_drawable_at_size (int src_x, int src_y, int src_width, int src_height, int dst_x, int dst_y, int dst_width, int dst_height)
 
EAPI uint32_t imlib_render_get_pixel_color (void)
 
EAPI void imlib_blend_image_onto_image (Imlib_Image src_image, char merge_alpha, int src_x, int src_y, int src_width, int src_height, int dst_x, int dst_y, int dst_width, int dst_height)
 
EAPI Imlib_Image imlib_create_image (int width, int height)
 
EAPI Imlib_Image imlib_clone_image (void)
 
EAPI Imlib_Image imlib_create_cropped_image (int x, int y, int width, int height)
 
EAPI Imlib_Image imlib_create_cropped_scaled_image (int src_x, int src_y, int src_width, int src_height, int dst_width, int dst_height)
 
EAPI Imlib_Image imlib_create_image_using_data (int width, int height, uint32_t *data)
 
EAPI Imlib_Image imlib_create_image_using_data_and_memory_function (int width, int height, uint32_t *data, Imlib_Image_Data_Memory_Function func)
 
EAPI Imlib_Image imlib_create_image_using_copied_data (int width, int height, uint32_t *data)
 
EAPI Imlib_Image imlib_create_image_from_drawable (Pixmap mask, int x, int y, int width, int height, char need_to_grab_x)
 
EAPI Imlib_Image imlib_create_image_from_ximage (XImage *image, XImage *mask, int x, int y, int width, int height, char need_to_grab_x)
 
EAPI Imlib_Image imlib_create_scaled_image_from_drawable (Pixmap mask, int src_x, int src_y, int src_width, int src_height, int dst_width, int dst_height, char need_to_grab_x, char get_mask_from_shape)
 
EAPI char imlib_copy_drawable_to_image (Pixmap mask, int src_x, int src_y, int src_width, int src_height, int dst_x, int dst_y, char need_to_grab_x)
 
EAPI int imlib_get_ximage_cache_count_used (void)
 
EAPI int imlib_get_ximage_cache_count_max (void)
 
EAPI void imlib_set_ximage_cache_count_max (int count)
 
EAPI int imlib_get_ximage_cache_size_used (void)
 
EAPI int imlib_get_ximage_cache_size_max (void)
 
EAPI void imlib_set_ximage_cache_size_max (int bytes)
 
EAPI Imlib_Updates imlib_updates_clone (Imlib_Updates updates)
 
EAPI Imlib_Updates imlib_update_append_rect (Imlib_Updates updates, int x, int y, int w, int h)
 
EAPI Imlib_Updates imlib_updates_merge (Imlib_Updates updates, int w, int h)
 
EAPI Imlib_Updates imlib_updates_merge_for_rendering (Imlib_Updates updates, int w, int h)
 
EAPI void imlib_updates_free (Imlib_Updates updates)
 
EAPI Imlib_Updates imlib_updates_get_next (Imlib_Updates updates)
 
EAPI void imlib_updates_get_coordinates (Imlib_Updates updates, int *x_return, int *y_return, int *width_return, int *height_return)
 
EAPI void imlib_updates_set_coordinates (Imlib_Updates updates, int x, int y, int width, int height)
 
EAPI Imlib_Updates imlib_updates_init (void)
 
EAPI Imlib_Updates imlib_updates_append_updates (Imlib_Updates updates, Imlib_Updates appended_updates)
 
EAPI void imlib_image_flip_horizontal (void)
 
EAPI void imlib_image_flip_vertical (void)
 
EAPI void imlib_image_flip_diagonal (void)
 
EAPI void imlib_image_orientate (int orientation)
 
EAPI void imlib_image_blur (int radius)
 
EAPI void imlib_image_sharpen (int radius)
 
EAPI void imlib_image_tile_horizontal (void)
 
EAPI void imlib_image_tile_vertical (void)
 
EAPI void imlib_image_tile (void)
 
EAPI void imlib_image_copy_alpha_to_image (Imlib_Image image_source, int x, int y)
 
EAPI void imlib_image_copy_alpha_rectangle_to_image (Imlib_Image image_source, int src_x, int src_y, int src_width, int src_height, int dst_x, int dst_y)
 
EAPI void imlib_image_scroll_rect (int x, int y, int width, int height, int delta_x, int delta_y)
 
EAPI void imlib_image_copy_rect (int x, int y, int width, int height, int new_x, int new_y)
 
EAPI Imlib_Font imlib_load_font (const char *font_name)
 
EAPI void imlib_free_font (void)
 
EAPI int imlib_insert_font_into_fallback_chain (Imlib_Font font, Imlib_Font fallback_font)
 
EAPI void imlib_remove_font_from_fallback_chain (Imlib_Font fallback_font)
 
EAPI Imlib_Font imlib_get_prev_font_in_fallback_chain (Imlib_Font fn)
 
EAPI Imlib_Font imlib_get_next_font_in_fallback_chain (Imlib_Font fn)
 
EAPI void imlib_text_draw (int x, int y, const char *text)
 
EAPI void imlib_text_draw_with_return_metrics (int x, int y, const char *text, int *width_return, int *height_return, int *horizontal_advance_return, int *vertical_advance_return)
 
EAPI void imlib_get_text_size (const char *text, int *width_return, int *height_return)
 
EAPI void imlib_get_text_advance (const char *text, int *horizontal_advance_return, int *vertical_advance_return)
 
EAPI int imlib_get_text_inset (const char *text)
 
EAPI void imlib_add_path_to_font_path (const char *path)
 
EAPI void imlib_remove_path_from_font_path (const char *path)
 
EAPI char ** imlib_list_font_path (int *number_return)
 
EAPI int imlib_text_get_index_and_location (const char *text, int x, int y, int *char_x_return, int *char_y_return, int *char_width_return, int *char_height_return)
 
EAPI void imlib_text_get_location_at_index (const char *text, int index, int *char_x_return, int *char_y_return, int *char_width_return, int *char_height_return)
 
EAPI char ** imlib_list_fonts (int *number_return)
 
EAPI void imlib_free_font_list (char **font_list, int number)
 
EAPI int imlib_get_font_cache_size (void)
 
EAPI void imlib_set_font_cache_size (int bytes)
 
EAPI void imlib_flush_font_cache (void)
 
EAPI int imlib_get_font_ascent (void)
 
EAPI int imlib_get_font_descent (void)
 
EAPI int imlib_get_maximum_font_ascent (void)
 
EAPI int imlib_get_maximum_font_descent (void)
 
EAPI Imlib_Color_Modifier imlib_create_color_modifier (void)
 
EAPI void imlib_free_color_modifier (void)
 
EAPI void imlib_modify_color_modifier_gamma (double gamma_value)
 
EAPI void imlib_modify_color_modifier_brightness (double brightness_value)
 
EAPI void imlib_modify_color_modifier_contrast (double contrast_value)
 
EAPI void imlib_set_color_modifier_tables (uint8_t *red_table, uint8_t *green_table, uint8_t *blue_table, uint8_t *alpha_table)
 
EAPI void imlib_get_color_modifier_tables (uint8_t *red_table, uint8_t *green_table, uint8_t *blue_table, uint8_t *alpha_table)
 
EAPI void imlib_reset_color_modifier (void)
 
EAPI void imlib_apply_color_modifier (void)
 
EAPI void imlib_apply_color_modifier_to_rectangle (int x, int y, int width, int height)
 
EAPI Imlib_Updates imlib_image_draw_pixel (int x, int y, char make_updates)
 
EAPI Imlib_Updates imlib_image_draw_line (int x1, int y1, int x2, int y2, char make_updates)
 
EAPI void imlib_image_draw_rectangle (int x, int y, int width, int height)
 
EAPI void imlib_image_fill_rectangle (int x, int y, int width, int height)
 
EAPI ImlibPolygon imlib_polygon_new (void)
 
EAPI void imlib_polygon_free (ImlibPolygon poly)
 
EAPI void imlib_polygon_add_point (ImlibPolygon poly, int x, int y)
 
EAPI void imlib_image_draw_polygon (ImlibPolygon poly, unsigned char closed)
 
EAPI void imlib_image_fill_polygon (ImlibPolygon poly)
 
EAPI void imlib_polygon_get_bounds (ImlibPolygon poly, int *px1, int *py1, int *px2, int *py2)
 
EAPI unsigned char imlib_polygon_contains_point (ImlibPolygon poly, int x, int y)
 
EAPI void imlib_image_draw_ellipse (int xc, int yc, int a, int b)
 
EAPI void imlib_image_fill_ellipse (int xc, int yc, int a, int b)
 
EAPI Imlib_Color_Range imlib_create_color_range (void)
 
EAPI void imlib_free_color_range (void)
 
EAPI void imlib_add_color_to_color_range (int distance_away)
 
EAPI void imlib_image_fill_color_range_rectangle (int x, int y, int width, int height, double angle)
 
EAPI void imlib_image_fill_hsva_color_range_rectangle (int x, int y, int width, int height, double angle)
 
EAPI void imlib_image_attach_data_value (const char *key, void *data, int value, Imlib_Data_Destructor_Function destructor_function)
 
EAPI void * imlib_image_get_attached_data (const char *key)
 
EAPI int imlib_image_get_attached_value (const char *key)
 
EAPI void imlib_image_remove_attached_data_value (const char *key)
 
EAPI void imlib_image_remove_and_free_attached_data_value (const char *key)
 
EAPI void imlib_save_image (const char *file)
 
EAPI void imlib_save_image_with_errno_return (const char *file, int *error_return)
 
EAPI void imlib_save_image_fd (int fd, const char *file)
 
EAPI Imlib_Image imlib_create_rotated_image (double angle)
 
EAPI void imlib_rotate_image_from_buffer (double angle, Imlib_Image src_image)
 
EAPI void imlib_blend_image_onto_image_at_angle (Imlib_Image src_image, char merge_alpha, int src_x, int src_y, int src_width, int src_height, int dst_x, int dst_y, int angle_x, int angle_y)
 
EAPI void imlib_blend_image_onto_image_skewed (Imlib_Image src_image, char merge_alpha, int src_x, int src_y, int src_width, int src_height, int dst_x, int dst_y, int h_angle_x, int h_angle_y, int v_angle_x, int v_angle_y)
 
EAPI void imlib_render_image_on_drawable_skewed (int src_x, int src_y, int src_width, int src_height, int dst_x, int dst_y, int h_angle_x, int h_angle_y, int v_angle_x, int v_angle_y)
 
EAPI void imlib_render_image_on_drawable_at_angle (int src_x, int src_y, int src_width, int src_height, int dst_x, int dst_y, int angle_x, int angle_y)
 
EAPI void imlib_image_filter (void)
 
EAPI Imlib_Filter imlib_create_filter (int initsize)
 
EAPI void imlib_context_set_filter (Imlib_Filter filter)
 
EAPI Imlib_Filter imlib_context_get_filter (void)
 
EAPI void imlib_free_filter (void)
 
EAPI void imlib_image_clear (void)
 
EAPI void imlib_image_clear_color (int r, int g, int b, int a)
 
EAPI Imlib_Image imlib_load_image_frame (const char *file, int frame)
 
EAPI Imlib_Image imlib_load_image_frame_mem (const char *file, int frame, const void *data, size_t size)
 
EAPI void imlib_image_get_frame_info (Imlib_Frame_Info *info)
 
EAPI const char * imlib_strerror (int err)
 
EAPI Imlib_Image imlib_load_image_with_error_return (const char *file, Imlib_Load_Error *error_return)
 
EAPI void imlib_save_image_with_error_return (const char *file, Imlib_Load_Error *error_return)
 
IMLIB2_DEPRECATED EAPI void imlib_image_set_irrelevant_border (char irrelevant)
 
IMLIB2_DEPRECATED EAPI void imlib_image_set_irrelevant_alpha (char irrelevant)
 
IMLIB2_DEPRECATED EAPI void imlib_context_set_TTF_encoding (Imlib_TTF_Encoding encoding)
 
IMLIB2_DEPRECATED EAPI Imlib_TTF_Encoding imlib_context_get_TTF_encoding (void)
 

Detailed Description

Imlib2 library API

Function Documentation

◆ imlib_add_color_to_color_range()

EAPI void imlib_add_color_to_color_range ( int  distance_away)

Add color to color range

Adds the current color to the current color range at a distance_away distance from the previous color in the range (if it's the first color in the range this is irrelevant).

Parameters
distance_awayDistance from the previous color

◆ imlib_add_path_to_font_path()

EAPI void imlib_add_path_to_font_path ( const char *  path)

Add font path

Adds the directory path to the end of the current list of directories to scan for fonts.

Parameters
pathA directory path

◆ imlib_apply_color_modifier()

EAPI void imlib_apply_color_modifier ( void  )

Apply color modifier to image

Uses the current color modifier mapping tables to modify the current image.

◆ imlib_apply_color_modifier_to_rectangle()

EAPI void imlib_apply_color_modifier_to_rectangle ( int  x,
int  y,
int  width,
int  height 
)

Apply color modifier to image part

Works the same way as imlib_apply_color_modifier() but only modifies a selected rectangle in the current image.

Parameters
xThe x coordinate of the left edge of the rectangle
yThe y coordinate of the top edge of the rectangle
widthThe width of the rectangle
heightThe height of the rectangle

◆ imlib_blend_image_onto_image()

EAPI void imlib_blend_image_onto_image ( Imlib_Image  src_image,
char  merge_alpha,
int  src_x,
int  src_y,
int  src_width,
int  src_height,
int  dst_x,
int  dst_y,
int  dst_width,
int  dst_height 
)

Blend part of image onto image

Blends the source rectangle (src_x, src_y, src_width, src_height) from src_image onto the current image at the destination (dst_x, dst_y) location scaled to the width dst_width and height * dst_height. If merge_alpha is set to 1 it will also modify the destination image alpha channel, otherwise the destination alpha channel is left untouched.

Parameters
src_imageThe source image
merge_alphaAlpha flag
src_xX coordinate of the source image
src_yY coordinate of the source image
src_widthWidth of the source image
src_heightHeight of the source image
dst_xX coordinate of the destination image
dst_yY coordinate of the destination image
dst_widthWidth of the destination image
dst_heightHeight of the destination image

◆ imlib_blend_image_onto_image_at_angle()

EAPI void imlib_blend_image_onto_image_at_angle ( Imlib_Image  src_image,
char  merge_alpha,
int  src_x,
int  src_y,
int  src_width,
int  src_height,
int  dst_x,
int  dst_y,
int  angle_x,
int  angle_y 
)

Blend image onto image at angle

Works just like imlib_blend_image_onto_image_skewed() except you cannot skew an image (v_angle_x and v_angle_y are 0).

Parameters
src_imageThe image source
merge_alphaA char
src_xThe source x coordinate
src_yThe source y coordinate
src_widthThe source width
src_heightThe source height
dst_xThe destination x coordinate
dst_yThe destination y coordinate
angle_xAn angle
angle_yAn angle

◆ imlib_blend_image_onto_image_skewed()

EAPI void imlib_blend_image_onto_image_skewed ( Imlib_Image  src_image,
char  merge_alpha,
int  src_x,
int  src_y,
int  src_width,
int  src_height,
int  dst_x,
int  dst_y,
int  h_angle_x,
int  h_angle_y,
int  v_angle_x,
int  v_angle_y 
)

Blend image onto image at angle, skewed

Blends the source rectangle (src_x, src_y, src_width, * src_height) from the src_image onto the current image at the destination (dst_x, dst_y) location. It will be rotated and scaled so that the upper right corner will be positioned h_angle_x pixels to the right (or left, if negative) and h_angle_y pixels down (from (dst_x, dst_y). If v_angle_x and v_angle_y are not 0, the image will also be skewed so that the lower left corner will be positioned v_angle_x pixels to the right and v_angle_y pixels down. The at_angle versions simply have the v_angle_x and v_angle_y set to 0 so the rotation doesn't get skewed, and the render_..._on_drawable ones seem obvious enough; they do the same on a drawable.

Example:

imlib_blend_image_onto_image_skewed(..., 0, 0, 100, 0, 0, 100);
EAPI void imlib_blend_image_onto_image_skewed(Imlib_Image src_image, char merge_alpha, int src_x, int src_y, int src_width, int src_height, int dst_x, int dst_y, int h_angle_x, int h_angle_y, int v_angle_x, int v_angle_y)

will simply scale the image to be 100x100.

imlib_blend_image_onto_image_skewed(..., 0, 0, 0, 100, 100, 0);

will scale the image to be 100x100, and flip it diagonally.

imlib_blend_image_onto_image_skewed(..., 100, 0, 0, 100, -100, 0);

will scale the image and rotate it 90 degrees clockwise.

imlib_blend_image_onto_image_skewed(..., 50, 0, 50, 50, -50, 50);

will rotate the image 45 degrees clockwise, and will scale it so its corners are at (50,0)-(100,50)-(50,100)-(0,50) i.e. it fits into the 100x100 square, so it's scaled down to 70.7% (sqrt(2)/2).

imlib_blend_image_onto_image_skewed(..., 50, 50, 100 * cos(a), 100 * sin(a), 0);

will rotate the image ‘a’ degrees, with its upper left corner at (50,50).

Parameters
src_imageThe source image
merge_alphaA char
src_xThe source x coordinate
src_yThe source y coordinate
src_widthThe source width
src_heightThe source height
dst_xThe destination x coordinate
dst_yThe destination y coordinate
h_angle_xAn angle
h_angle_yAn angle
v_angle_xAn angle
v_angle_yAn angle

◆ imlib_clone_image()

EAPI Imlib_Image imlib_clone_image ( void  )

Clone image

Creates an exact duplicate of the current image.

Returns
Image handle (NULL on failure)

◆ imlib_context_disconnect_display()

EAPI void imlib_context_disconnect_display ( void  )

Tell Imlib2 that the current display connection has been closed

Call when (and only when) you close a display connection but continue using Imlib2 on a different connection.

◆ imlib_context_free()

EAPI void imlib_context_free ( Imlib_Context  context)

Free context

◆ imlib_context_get()

EAPI Imlib_Context imlib_context_get ( void  )

Get context handle

◆ imlib_context_get_angle()

EAPI double imlib_context_get_angle ( void  )

Return the current angle used to render text in

Used if the direction is IMLIB_TEXT_TO_ANGLE.

Returns
The current text rendering angle

◆ imlib_context_get_anti_alias()

EAPI char imlib_context_get_anti_alias ( void  )

Return the current "anti-aliasing" mode

Returns
The current anti alias flag

◆ imlib_context_get_blend()

EAPI char imlib_context_get_blend ( void  )

Return current blending mode

Returns
The current blending flag

◆ imlib_context_get_cliprect()

EAPI void imlib_context_get_cliprect ( int *  x,
int *  y,
int *  w,
int *  h 
)

Return the current clip rectangle

Parameters
xThe top left x coordinate of the rectangle
yThe top left y coordinate of the rectangle
wThe width of the rectangle
hThe height of the rectangle

◆ imlib_context_get_color()

EAPI void imlib_context_get_color ( int *  red,
int *  green,
int *  blue,
int *  alpha 
)

Return the current drawing color in RGBA space

Parameters
redRed channel of the current color
greenGreen channel of the current color
blueBlue channel of the current color
alphaAlpha channel of the current color

◆ imlib_context_get_color_cmya()

EAPI void imlib_context_get_color_cmya ( int *  cyan,
int *  magenta,
int *  yellow,
int *  alpha 
)

Return the current drawing color in CMYA space

Parameters
cyanCyan channel of the current color
magentaMagenta channel of the current color
yellowYellow channel of the current color
alphaAlpha channel of the current color

◆ imlib_context_get_color_hlsa()

EAPI void imlib_context_get_color_hlsa ( float *  hue,
float *  lightness,
float *  saturation,
int *  alpha 
)

Return the current drawing color in HLSA space

Parameters
hueHue channel of the current color
lightnessLightness channel of the current color
saturationSaturation channel of the current color
alphaAlpha channel of the current color

◆ imlib_context_get_color_hsva()

EAPI void imlib_context_get_color_hsva ( float *  hue,
float *  saturation,
float *  value,
int *  alpha 
)

Return the current drawing color in HSVA space

Parameters
hueHue channel of the current color
saturationSaturation channel of the current color
valueValue channel of the current color
alphaAlpha channel of the current color

◆ imlib_context_get_color_modifier()

EAPI Imlib_Color_Modifier imlib_context_get_color_modifier ( void  )

Return the current color modifier

Returns
The current color modifier

◆ imlib_context_get_color_range()

EAPI Imlib_Color_Range imlib_context_get_color_range ( void  )

Return the current color range being used for gradients

Returns
The current color range

◆ imlib_context_get_colormap()

EAPI Colormap imlib_context_get_colormap ( void  )

Return the current Colormap

Returns
The current colormap

◆ imlib_context_get_direction()

EAPI Imlib_Text_Direction imlib_context_get_direction ( void  )

Return the current direction to render text in

Returns
The current text rendering direction

◆ imlib_context_get_display()

EAPI Display * imlib_context_get_display ( void  )

Return the current display used for Imlib2's display context

Returns
The current display

◆ imlib_context_get_dither()

EAPI char imlib_context_get_dither ( void  )

Return the current dithering mode

Returns
The current dithering flag

◆ imlib_context_get_dither_mask()

EAPI char imlib_context_get_dither_mask ( void  )

Return the current mask dithering mode

Returns
The current dither mask flag

◆ imlib_context_get_drawable()

EAPI Drawable imlib_context_get_drawable ( void  )

Return the current Drawable

Returns
The current drawable

◆ imlib_context_get_filter()

EAPI Imlib_Filter imlib_context_get_filter ( void  )

Get the current image filter

Returns
Current filter

◆ imlib_context_get_font()

EAPI Imlib_Font imlib_context_get_font ( void  )

Return the current font

Returns
The current font

◆ imlib_context_get_image()

EAPI Imlib_Image imlib_context_get_image ( void  )

Return the current context image

Returns
The current image

◆ imlib_context_get_image_data_memory_function()

EAPI Imlib_Image_Data_Memory_Function imlib_context_get_image_data_memory_function ( void  )

Return the current image data memeory management function

Returns
The image data memory management function

◆ imlib_context_get_imlib_color()

EAPI Imlib_Color * imlib_context_get_imlib_color ( void  )

Return the current drawing color as a color struct

Do NOT free this pointer.

Returns
The current color

◆ imlib_context_get_mask()

EAPI Pixmap imlib_context_get_mask ( void  )

Return the current mask pixmap

Returns
The current pixmap

◆ imlib_context_get_mask_alpha_threshold()

EAPI int imlib_context_get_mask_alpha_threshold ( void  )

Return the current mask alpha threshold

Returns
The current mask mask alpha threshold

◆ imlib_context_get_operation()

EAPI Imlib_Operation imlib_context_get_operation ( void  )

Return the current operation mode

Returns
The current operation mode

◆ imlib_context_get_progress_function()

EAPI Imlib_Progress_Function imlib_context_get_progress_function ( void  )

Return the current progress function

Returns
The current progress function

◆ imlib_context_get_progress_granularity()

EAPI char imlib_context_get_progress_granularity ( void  )

Return the current progress granularity

Returns
The current progress granularity

◆ imlib_context_get_TTF_encoding()

IMLIB2_DEPRECATED EAPI Imlib_TTF_Encoding imlib_context_get_TTF_encoding ( void  )

Deprecated function - hasn't done anything useful in ~20 years

Deprecated:
Useless - don't use

◆ imlib_context_get_visual()

EAPI Visual * imlib_context_get_visual ( void  )

Return the current visual

Returns
The current visual

◆ imlib_context_new()

EAPI Imlib_Context imlib_context_new ( void  )

Create new context

◆ imlib_context_pop()

EAPI void imlib_context_pop ( void  )

Pop context

◆ imlib_context_push()

EAPI void imlib_context_push ( Imlib_Context  context)

Push context

◆ imlib_context_set_angle()

EAPI void imlib_context_set_angle ( double  angle)

Set the text drawing angle

Sets the angle at which text strings will be drawn if the text direction has been set to IMLIB_TEXT_TO_ANGLE with imlib_context_set_direction().

Parameters
angleAngle of the text strings

◆ imlib_context_set_anti_alias()

EAPI void imlib_context_set_anti_alias ( char  anti_alias)

Set "anti-aliasing" mode when scaling images

This isn't quite correct since it's actually super and sub pixel sampling that it turns on and off, but anti-aliasing is used for having "smooth" edges to lines and shapes and this means when images are scaled they will keep their smooth appearance. Passing in 1 turns this on and 0 turns it off.

Parameters
anti_aliasThe anti-alias flag

◆ imlib_context_set_blend()

EAPI void imlib_context_set_blend ( char  blend)

Set blending mode

Select whether to blend or not during rendering operations. Setting blend to 1 enables blending and 0 disables blending.

Parameters
blendThe blending flag

◆ imlib_context_set_cliprect()

EAPI void imlib_context_set_cliprect ( int  x,
int  y,
int  w,
int  h 
)

Set the clip rectangle

Parameters
xThe top left x coordinate of the rectangle
yThe top left y coordinate of the rectangle
wThe width of the rectangle
hThe height of the rectangle

◆ imlib_context_set_color()

EAPI void imlib_context_set_color ( int  red,
int  green,
int  blue,
int  alpha 
)

Set the drawing color in RGBA space

Sets the color with which text and lines are drawn when being rendered onto an image. Values for red, green, blue and alpha are between 0 and 255

  • any other values have undefined results.
Parameters
redRed channel of the color
greenGreen channel of the color
blueBlue channel of the color
alphaAlpha channel of the color

◆ imlib_context_set_color_cmya()

EAPI void imlib_context_set_color_cmya ( int  cyan,
int  magenta,
int  yellow,
int  alpha 
)

Set the drawing color in CMYA space

Values for cyan, magenta, yellow and alpha are between 0 and 255

  • any other values have undefined results.
Parameters
cyanCyan channel of the color
magentaMagenta channel of the color
yellowYellow channel of the color
alphaAlpha channel of the color

◆ imlib_context_set_color_hlsa()

EAPI void imlib_context_set_color_hlsa ( float  hue,
float  lightness,
float  saturation,
int  alpha 
)

Set the drawing color in HLSA space

Values for hue are between 0 and 360, values for lightness and saturation between 0 and 1, and values for alpha are between 0 and 255

  • any other values have undefined results.
Parameters
hueHue channel of the color
lightnessLightness channel of the color
saturationSaturation channel of the color
alphaAlpha channel of the color

◆ imlib_context_set_color_hsva()

EAPI void imlib_context_set_color_hsva ( float  hue,
float  saturation,
float  value,
int  alpha 
)

Set the drawing color in HSVA space

Values for hue are between 0 and 360, values for saturation and value between 0 and 1, and values for alpha are between 0 and 255

  • any other values have undefined results.
Parameters
hueHue channel of the color
saturationSaturation channel of the color
valueValue channel of the color
alphaAlpha channel of the color

◆ imlib_context_set_color_modifier()

EAPI void imlib_context_set_color_modifier ( Imlib_Color_Modifier  color_modifier)

Set the color modifier

The color modifier is used when rendering pixmaps or images to a drawable or images onto other images.

Color modifiers are lookup tables that map the values in the red, green, blue and alpha channels to other values in the same channel when rendering, allowing for fades, color correction etc. to be done whilst rendering. Pass in NULL as the color_modifier to disable the color modifier for rendering.

Parameters
color_modifierThe color modifier

◆ imlib_context_set_color_range()

EAPI void imlib_context_set_color_range ( Imlib_Color_Range  color_range)

Set the color range to use for rendering gradients

Parameters
color_rangeColor range

◆ imlib_context_set_colormap()

EAPI void imlib_context_set_colormap ( Colormap  colormap)

Set the colormap to use when rendering to drawables and allocating colors

You must set this to render any images or produce pixmaps (this can be the default colormap).

Parameters
colormapThe Colormap to use

◆ imlib_context_set_direction()

EAPI void imlib_context_set_direction ( Imlib_Text_Direction  direction)

Set the text drawing direction

Sets the direction in which to draw text in terms of simple 90 degree orientations or an arbitrary angle. The direction can be one of IMLIB_TEXT_TO_RIGHT, IMLIB_TEXT_TO_LEFT, IMLIB_TEXT_TO_DOWN, IMLIB_TEXT_TO_UP or IMLIB_TEXT_TO_ANGLE. The default is IMLIB_TEXT_TO_RIGHT. If you use IMLIB_TEXT_TO_ANGLE, you will also have to set the angle with imlib_context_set_angle().

Parameters
directionThe text direction

◆ imlib_context_set_display()

EAPI void imlib_context_set_display ( Display *  display)

Set the X display to use for rendering of images to drawables

You do not need to set this if you do not intend to render an image to an X drawable. If you do you will need to set this. If you change displays just set this to the new display pointer. Do not use a Display pointer if you have closed that display already - also note that if you close a display connection and continue to render using Imlib2 without setting the display pointer to NULL or something new, crashes may occur.

Parameters
displayThe Display to use

◆ imlib_context_set_dither()

EAPI void imlib_context_set_dither ( char  dither)

Set dithering mode

Sets the dithering flag for rendering to a drawable or when pixmaps are produced. This affects the color image appearance. Dithering slows down rendering but produces considerably better results. This option has no effect for rendering in 24 bit and up, but in 16 bit and lower it will dither, producing smooth gradients and much better quality images. Setting dither to 1 enables dithering and 0 disables dithering.

Parameters
ditherThe dithering flag

◆ imlib_context_set_dither_mask()

EAPI void imlib_context_set_dither_mask ( char  dither_mask)

Set mask dithering mode

When rendering to a mask or producing pixmap masks from images dither_mask selects if the mask is to be dithered or not. Passing in 1 for dither_mask means the mask pixmap will be dithered, 0 means it will not be dithered.

Parameters
dither_maskThe dither mask flag

◆ imlib_context_set_drawable()

EAPI void imlib_context_set_drawable ( Drawable  drawable)

Set the X drawable to which images will be rendered

This may be either a pixmap or a window. You must set this to render anything.

Parameters
drawableAn X Drawable

◆ imlib_context_set_filter()

EAPI void imlib_context_set_filter ( Imlib_Filter  filter)

Set the current image filter

Set this to NULL to disable filters.

Parameters
filterThe filter

◆ imlib_context_set_font()

EAPI void imlib_context_set_font ( Imlib_Font  font)

Set the font to use when rendering text

The font should be loaded first with imlib_load_font().

Parameters
fontThe font

◆ imlib_context_set_image()

EAPI void imlib_context_set_image ( Imlib_Image  image)

Set the image Imlib2 will be using with its function calls

Parameters
imageThe image

◆ imlib_context_set_image_data_memory_function()

EAPI void imlib_context_set_image_data_memory_function ( Imlib_Image_Data_Memory_Function  memory_function)

Set the image data memory management function

Parameters
memory_functionThe image data memory management function

◆ imlib_context_set_mask()

EAPI void imlib_context_set_mask ( Pixmap  mask)

Set the 1-bit deep pixmap to be drawn to when generating a mask pixmap

This is only useful if the image you are rendering has alpha. Set this to 0 to not render a pixmap mask.

Parameters
maskA pixmap with depth 1

◆ imlib_context_set_mask_alpha_threshold()

EAPI void imlib_context_set_mask_alpha_threshold ( int  mask_alpha_threshold)

Set mask alpha threshold

When rendering to a mask or producing pixmap masks from images mask_alpha_threshold selects the alpha threshold above which mask bits are set. The default mask alpha threshold is 128, meaning that a mask bit will be set if the pixel alpha is >= 128.

Parameters
mask_alpha_thresholdThe mask alpha threshold

◆ imlib_context_set_operation()

EAPI void imlib_context_set_operation ( Imlib_Operation  operation)

Set drawing operation

When Imlib2 draws an image onto another or an image onto a drawable it is able to do more than just blend the result on using the given alpha channel of the image. It is also able to do saturating additive, subtractive and a combination of the both (called reshade) rendering. The default mode is IMLIB_OP_COPY. you can also set it to IMLIB_OP_ADD, IMLIB_OP_SUBTRACT or IMLIB_OP_RESHADE. IMLIB_OP_COPY performs basic alpha blending: DST = (SRC * A) + (DST * (1 - A)). IMLIB_OP_ADD does DST = DST + (SRC * A). IMLIB_OP_SUBTRACT does DST = DST - (SRC * A) IMLIB_OP_RESHADE does DST = DST + (((SRC - * 0.5) / 2) * A).

Parameters
operationThe drawing operation

◆ imlib_context_set_progress_function()

EAPI void imlib_context_set_progress_function ( Imlib_Progress_Function  progress_function)

Set the progress function to be called back whilst loading images

Set this to the function to be called, or set it to NULL to disable progress callbacks.

Parameters
progress_functionThe progress function

◆ imlib_context_set_progress_granularity()

EAPI void imlib_context_set_progress_granularity ( char  progress_granularity)

Set progress callback granularity

This hints as to how often to call the progress callback. 0 means as often as possible. 1 means whenever 15 more of the image has been decoded, 10 means every 10% of the image decoding, 50 means every 50% and 100 means only call at the end. Values outside of the range 0-100 are undefined.

Parameters
progress_granularityThe progress granularity

◆ imlib_context_set_TTF_encoding()

IMLIB2_DEPRECATED EAPI void imlib_context_set_TTF_encoding ( Imlib_TTF_Encoding  encoding)

Deprecated function - hasn't done anything useful in ~20 years

Deprecated:
Useless - don't use

◆ imlib_context_set_visual()

EAPI void imlib_context_set_visual ( Visual *  visual)

Set the visual to use when rendering images to drawables

You need to set this for anything to render to a drawable or produce pixmaps (this can be the default visual).

Parameters
visualThe Visual to use

◆ imlib_copy_drawable_to_image()

EAPI char imlib_copy_drawable_to_image ( Pixmap  mask,
int  src_x,
int  src_y,
int  src_width,
int  src_height,
int  dst_x,
int  dst_y,
char  need_to_grab_x 
)

Copy part of drawable to image

Grabs a section of the current drawable (optionally using the pixmap mask provided as a corresponding mask for that drawable - if mask is 0 this is not used). If mask is 1 the mask will be set to the shape mask of the drawable. It grabs the (src_x, src_y, src_width, src_height) rectangle and places it at the destination (dst_x, dst_y) location in the current image. If need_to_grab_x is 1 the X Server s grabbed to avoid possible race conditions. Set to 1 unless the server is already grabbed.

Parameters
maskA mask
src_xThe top left x coordinate of the rectangle
src_yThe top left y coordinate of the rectangle
src_widthThe width of the rectangle
src_heightThe height of the rectangle
dst_xThe x coordinate of the new location
dst_yThe x coordinate of the new location
need_to_grab_xGrab flag
Returns
1 on success, 0 otherwise

◆ imlib_create_color_modifier()

EAPI Imlib_Color_Modifier imlib_create_color_modifier ( void  )

Create empty color modifier

Creates a new empty color modifier and returns a valid handle on success. NULL is returned on failure.

Returns
Color modifier handle (NULL on failure)

◆ imlib_create_color_range()

EAPI Imlib_Color_Range imlib_create_color_range ( void  )

Create empty color range

Returns
Color range handle (NULL on error)

◆ imlib_create_cropped_image()

EAPI Imlib_Image imlib_create_cropped_image ( int  x,
int  y,
int  width,
int  height 
)

Create cropped image

Creates a duplicate of a (x, y, width, height) rectangle in the current image.

Parameters
xThe top left x coordinate of the rectangle
yThe top left y coordinate of the rectangle
widthThe width of the rectangle
heightThe height of the rectangle
Returns
Image handle (NULL on failure)

◆ imlib_create_cropped_scaled_image()

EAPI Imlib_Image imlib_create_cropped_scaled_image ( int  src_x,
int  src_y,
int  src_width,
int  src_height,
int  dst_width,
int  dst_height 
)

Create cropped and scaled image

Works the same as imlib_create_cropped_image() but will scale the new image to the new destination dst_width and dst_height whilst cropping.

Parameters
src_xThe top left x coordinate of the source rectangle
src_yThe top left y coordinate of the source rectangle
src_widthThe width of the source rectangle
src_heightThe height of the source rectangle
dst_widthThe width of the destination image
dst_heightThe height of the destination image
Returns
Image handle (NULL on failure)

◆ imlib_create_filter()

EAPI Imlib_Filter imlib_create_filter ( int  initsize)

Create image filter object

◆ imlib_create_image()

EAPI Imlib_Image imlib_create_image ( int  width,
int  height 
)

Create a new blank image

Creates a new blank image of size width and height. The contents of this image at creation time are undefined (they could be garbage memory). You are free to do whatever you like with this image. It is not cached.

Parameters
widthThe width of the image
heightThe height of the image
Returns
A new blank image on success or NULL on failure

◆ imlib_create_image_from_drawable()

EAPI Imlib_Image imlib_create_image_from_drawable ( Pixmap  mask,
int  x,
int  y,
int  width,
int  height,
char  need_to_grab_x 
)

Create image from drawable

Return an image (using the mask mask to determine the alpha channel) from the current drawable. If mask is 0 it will not create a useful alpha channel in the image. If mask is 1 the mask will be set to the shape mask of the drawable. It will create an image from the (x, y, width , height) rectangle in the drawable. If need_to_grab_x is 1 the X Server s grabbed to avoid possible race conditions. Set to 1 unless the server is already grabbed. If you have not already grabbed the server you MUST set this to 1.

Parameters
maskA mask
xThe top left x coordinate of the rectangle
yThe top left y coordinate of the rectangle
widthThe width of the rectangle
heightThe height of the rectangle
need_to_grab_xGrab flag
Returns
Image handle (NULL on failure)

◆ imlib_create_image_from_ximage()

EAPI Imlib_Image imlib_create_image_from_ximage ( XImage *  image,
XImage *  mask,
int  x,
int  y,
int  width,
int  height,
char  need_to_grab_x 
)

Create image from XImage

Parameters
imageAn XImage
maskAn XImage mask
xThe top left x coordinate of the rectangle
yThe top left y coordinate of the rectangle
widthThe width of the rectangle
heightThe height of the rectangle
need_to_grab_xGrab flag
Returns
Image handle (NULL on failure)

◆ imlib_create_image_using_copied_data()

EAPI Imlib_Image imlib_create_image_using_copied_data ( int  width,
int  height,
uint32_t *  data 
)

Create a new image using given pixel data

Works the same way as imlib_create_image_using_data() but Imlib2 copies the image data to the image structure. You may now do whatever you wish with the original data as it will not be needed anymore.

Parameters
widthThe width of the image
heightThe height of the image
dataThe data
Returns
Image handle (NULL on failure)

◆ imlib_create_image_using_data()

EAPI Imlib_Image imlib_create_image_using_data ( int  width,
int  height,
uint32_t *  data 
)

Create a new image using given pixel data

Creates an image from the image data specified with the width width and the height height specified. The image data data must be in the same format as imlib_image_get_data() would return. You are responsible for freeing this image data once the image is freed. This is useful for when you already have static buffers of the same format Imlib2 uses (many video grabbing devices use such a format) and wish to use Imlib2 to render the results onto another image, or X drawable. On success an image handle is returned - otherwise NULL is returned.

Parameters
widthThe width of the image
heightThe height of the image
dataThe data
Returns
Image handle (NULL on failure)

◆ imlib_create_image_using_data_and_memory_function()

EAPI Imlib_Image imlib_create_image_using_data_and_memory_function ( int  width,
int  height,
uint32_t *  data,
Imlib_Image_Data_Memory_Function  func 
)

Create a new image using given pixel data and memory management function

Creates an image from the image data specified with the width width and the height height specified. The image data data must be in the same format as imlib_image_get_data() would return. The memory management function func is responsible for freeing this image data once the image is freed.

Parameters
widthThe width of the image
heightThe height of the image
dataThe data
funcThe memory management function
Returns
Image handle (NULL on failure)

◆ imlib_create_rotated_image()

EAPI Imlib_Image imlib_create_rotated_image ( double  angle)

Create rotated image

Creates a new copy of the current image, but rotated by angle radians.

Parameters
angleAn angle in radians
Returns
Image handle (NULL on failure)

◆ imlib_create_scaled_image_from_drawable()

EAPI Imlib_Image imlib_create_scaled_image_from_drawable ( Pixmap  mask,
int  src_x,
int  src_y,
int  src_width,
int  src_height,
int  dst_width,
int  dst_height,
char  need_to_grab_x,
char  get_mask_from_shape 
)

Create image from drawable, scaled

Creates an image from the current drawable (optionally using the mask pixmap specified to determine alpha transparency) and scale the grabbed data first before converting to an actual image (to minimize reads from the frame buffer which can be slow). The source (src_x, src_y, src_width, src_height) rectangle will be grabbed, scaled to the destination dst_width and dst_height, then converted to an image. If need_to_grab_x is 1 the X Server s grabbed to avoid possible race conditions. Set to 1 unless the server is already grabbed. If get_mask_from_shape and the current drawable is a window its shape is used for determining the alpha channel.

Parameters
maskA mask
src_xThe top left x coordinate of the rectangle
src_yThe top left y coordinate of the rectangle
src_widthThe width of the rectangle
src_heightThe height of the rectangle
dst_widthThe width of the returned image
dst_heightThe height of the returned image
need_to_grab_xGrab flag
get_mask_from_shapeA char
Returns
Image handle (NULL on failure)

◆ imlib_flush_font_cache()

EAPI void imlib_flush_font_cache ( void  )

Flush all speculatively cached fonts from the font cache

◆ imlib_flush_loaders()

EAPI void imlib_flush_loaders ( void  )

Flush loader cache

If you want Imlib2 to forcibly flush any cached loaders it has and re-load them from disk (this is useful if the program just installed a new loader and does not want to wait till Imlib2 deems it an optimal time to rescan the loaders)

◆ imlib_free_color_modifier()

EAPI void imlib_free_color_modifier ( void  )

Free the current color modifier

◆ imlib_free_color_range()

EAPI void imlib_free_color_range ( void  )

Free the current color range

◆ imlib_free_filter()

EAPI void imlib_free_filter ( void  )

Free the current image filter

◆ imlib_free_font()

EAPI void imlib_free_font ( void  )

Unload current font

◆ imlib_free_font_list()

EAPI void imlib_free_font_list ( char **  font_list,
int  number 
)

Free the font list returned by imlib_list_fonts()

Parameters
font_listThe font list
numberNumber of fonts in the list

◆ imlib_free_image()

EAPI void imlib_free_image ( void  )

Free the current image

◆ imlib_free_image_and_decache()

EAPI void imlib_free_image_and_decache ( void  )

Free the current image AND remove it from the cache

◆ imlib_free_pixmap_and_mask()

EAPI void imlib_free_pixmap_and_mask ( Pixmap  pixmap)

Free pixmap and any associated mask

The pixmap will remain cached until the image the pixmap was generated from is dirtied or decached, or the cache is flushed.

Parameters
pixmapThe pixmap

◆ imlib_get_best_visual()

EAPI Visual * imlib_get_best_visual ( Display *  display,
int  screen,
int *  depth_return 
)

Return the visual that Imlib2 thinks will give you the best quality output

If not NULL depth_return will return the depth of the visual.

Parameters
displayThe display
screenThe screen
depth_returnThe depth of the returned visual
Returns
The best visual

◆ imlib_get_cache_size()

EAPI int imlib_get_cache_size ( void  )

Return the current maximum size of the image cache in bytes

The cache is a unified cache used for image data AND pixmaps.

Returns
The current image cache max size

◆ imlib_get_cache_used()

EAPI int imlib_get_cache_used ( void  )

Return the current size of the image cache in bytes

The cache is a unified cache used for image data AND pixmaps.

Returns
The current image cache memory usage

◆ imlib_get_color_modifier_tables()

EAPI void imlib_get_color_modifier_tables ( uint8_t *  red_table,
uint8_t *  green_table,
uint8_t *  blue_table,
uint8_t *  alpha_table 
)

Get current color modifier tables

Copies the table values from the current color modifier into the pointers to mapping tables specified. They must have 256 entries and be uint8_t format.

Parameters
red_tableA 256 element uint8_t array
green_tableA 256 element uint8_t array
blue_tableA 256 element uint8_t array
alpha_tableA 256 element uint8_t array

◆ imlib_get_color_usage()

EAPI int imlib_get_color_usage ( void  )

Get the maximum number of colors Imlib2 is allowed to allocate

The default is 256.

Returns
The current maximum number of colors

◆ imlib_get_error()

EAPI int imlib_get_error ( void  )

Get error code from previous imlib function call

The error code is set in function calls that involve direct or indirect image loading or saving.

Returns
error code 0: Success, positive: Regular errnos, negative: IMLIB_ERR_... values, see above

◆ imlib_get_font_ascent()

EAPI int imlib_get_font_ascent ( void  )

Return the current font's ascent

Returns
The font's ascent value in pixels

◆ imlib_get_font_cache_size()

EAPI int imlib_get_font_cache_size ( void  )

Return the font cache size

Returns
The font cache size in bytes

◆ imlib_get_font_descent()

EAPI int imlib_get_font_descent ( void  )

Return the current font's descent

Returns
The font's descent value in pixels

◆ imlib_get_maximum_font_ascent()

EAPI int imlib_get_maximum_font_ascent ( void  )

Return the current font's maximum ascent

Returns
The font's maximum ascent

◆ imlib_get_maximum_font_descent()

EAPI int imlib_get_maximum_font_descent ( void  )

Return the current font's maximum descent

Returns
The font's maximum descent

◆ imlib_get_next_font_in_fallback_chain()

EAPI Imlib_Font imlib_get_next_font_in_fallback_chain ( Imlib_Font  fn)

Return next font in font fallback chain

◆ imlib_get_prev_font_in_fallback_chain()

EAPI Imlib_Font imlib_get_prev_font_in_fallback_chain ( Imlib_Font  fn)

Return previous font in font fallback chain

◆ imlib_get_text_advance()

EAPI void imlib_get_text_advance ( const char *  text,
int *  horizontal_advance_return,
int *  vertical_advance_return 
)

Get text advances

Gets the advance horizontally and vertically in pixels the next text string would need to be placed at for the current font. The advances are not adjusted for rotation so you will have to translate the advances (which are calculated as if the text was drawn horizontally from left to right) depending on the text orientation.

Parameters
textA string
horizontal_advance_returnHorizontal offset
vertical_advance_returnVertical offset

◆ imlib_get_text_inset()

EAPI int imlib_get_text_inset ( const char *  text)

Get text inset

Returns the inset of the first character of text in using the current font and returns that value in pixels.

Parameters
textA string
Returns
The inset value of text

◆ imlib_get_text_size()

EAPI void imlib_get_text_size ( const char *  text,
int *  width_return,
int *  height_return 
)

Get text size

Gets the width and height in pixels the text string would use up if drawn with the current font.

Parameters
textA string
width_returnThe width of the text
height_returnThe height of the text

◆ imlib_get_visual_depth()

EAPI int imlib_get_visual_depth ( Display *  display,
Visual *  visual 
)

Convenience function that returns the depth of a visual

Parameters
displayThe display
visualThe visual

◆ imlib_get_ximage_cache_count_max()

EAPI int imlib_get_ximage_cache_count_max ( void  )

Return the maximum number of XImages to cache

Returns
The current XImage cache max count

◆ imlib_get_ximage_cache_count_used()

EAPI int imlib_get_ximage_cache_count_used ( void  )

Return the current number of cached XImages

Returns
The current number of cached XImages

◆ imlib_get_ximage_cache_size_max()

EAPI int imlib_get_ximage_cache_size_max ( void  )

Return the XImage cache maximum size

Returns
The current XImage cache max size

◆ imlib_get_ximage_cache_size_used()

EAPI int imlib_get_ximage_cache_size_used ( void  )

Return the current XImage cache memory usage

Returns
The current XImage cache memory usage

◆ imlib_image_attach_data_value()

EAPI void imlib_image_attach_data_value ( const char *  key,
void *  data,
int  value,
Imlib_Data_Destructor_Function  destructor_function 
)

Attach data to image

Attaches data to the current image with the string key of key, and the data of data and an integer of value. The * destructor_function function, if not NULL is called when this image is freed so the destructor can free data, if this is needed.

Parameters
keyThe key
dataA pointer
valueA value
destructor_functionAn Imlib internal function

◆ imlib_image_blur()

EAPI void imlib_image_blur ( int  radius)

Blur the current image

A radius value of 0 has no effect, 1 and above determine the blur matrix radius that determine how much to blur the image.

Parameters
radiusThe radius

◆ imlib_image_clear()

EAPI void imlib_image_clear ( void  )

Clear current image

Set all pixels values to 0.

◆ imlib_image_clear_color()

EAPI void imlib_image_clear_color ( int  r,
int  g,
int  b,
int  a 
)

Set all current image pixels to given color

◆ imlib_image_copy_alpha_rectangle_to_image()

EAPI void imlib_image_copy_alpha_rectangle_to_image ( Imlib_Image  image_source,
int  src_x,
int  src_y,
int  src_width,
int  src_height,
int  dst_x,
int  dst_y 
)

Copy partial image alpha

Copies the source (src_x, src_y, src_width, src_height) rectangle alpha channel from the source image image_source and replaces the alpha channel on the destination image at the (dst_x, dst_y) coordinates.

Parameters
image_sourceAn image
src_xThe top left x coordinate of the rectangle
src_yThe top left y coordinate of the rectangle
src_widthThe width of the rectangle
src_heightThe height of the rectangle
dst_xThe top left x coordinate of the destination rectangle
dst_yThe top left x coordinate of the destination rectangle

◆ imlib_image_copy_alpha_to_image()

EAPI void imlib_image_copy_alpha_to_image ( Imlib_Image  image_source,
int  x,
int  y 
)

Copy image alpha

Copies the alpha channel of the source image image_source to the (x, y) coordinates of the current image, replacing the alpha channel there.

Parameters
image_sourceAn image
xThe x coordinate
yThe y coordinate

◆ imlib_image_copy_rect()

EAPI void imlib_image_copy_rect ( int  x,
int  y,
int  width,
int  height,
int  new_x,
int  new_y 
)

Copy image part within image

Copies a rectangle of size width, height at the (x, y) location specified in the current image to a new location (new_x, new_y) in the same image.

Parameters
xThe top left x coordinate of the rectangle
yThe top left y coordinate of the rectangle
widthThe width of the rectangle
heightThe height of the rectangle
new_xThe top left x coordinate of the new location
new_yThe top left y coordinate of the new location

◆ imlib_image_draw_ellipse()

EAPI void imlib_image_draw_ellipse ( int  xc,
int  yc,
int  a,
int  b 
)

Draw an ellipse (no fill)

Draws an ellipse on the current context image. The ellipse is defined as (x-xc)^2/a^2 + (y-yc)^2/b^2 = 1. This means that the point (xc, yc) marks the center of the ellipse, a defines the horizontal amplitude of the ellipse, and b defines the vertical amplitude.

Parameters
xcX coordinate of the center of the ellipse
ycY coordinate of the center of the ellipse
aThe horizontal amplitude of the ellipse
bThe vertical amplitude of the ellipse

◆ imlib_image_draw_line()

EAPI Imlib_Updates imlib_image_draw_line ( int  x1,
int  y1,
int  x2,
int  y2,
char  make_updates 
)

Draw a line

Draws a line using the current color on the current image from coordinates (x1, y1) to (x2, y2). If make_updates is 1 it will also return an update you can use for an updates list, otherwise it returns NULL.

Parameters
x1The x coordinate of the first point
y1The y coordinate of the first point
x2The x coordinate of the second point
y2The y coordinate of the second point
make_updatesa char
Returns
An updates list

◆ imlib_image_draw_pixel()

EAPI Imlib_Updates imlib_image_draw_pixel ( int  x,
int  y,
char  make_updates 
)

Draw a pixel

Draws a pixel using the urrent color on the current image at coordinate (x1, y1). If make_updates is 1 it will also return an update you can use for an updates list, otherwise it returns NULL.

Parameters
xThe x coordinate of the first point
yThe y coordinate of the first point
make_updatesMake updates flag
Returns
An updates list

◆ imlib_image_draw_polygon()

EAPI void imlib_image_draw_polygon ( ImlibPolygon  poly,
unsigned char  closed 
)

Draw a polygon (no fill)

Draws the polygon poly onto the current context image. Points which have been added to the polygon are drawn in sequence, first to last. The final point will be joined with the first point if closed is non-zero.

Parameters
polyA polygon
closedClosed polygon flag

◆ imlib_image_draw_rectangle()

EAPI void imlib_image_draw_rectangle ( int  x,
int  y,
int  width,
int  height 
)

Draw a rectangle (no fill)

Draws the outline of a rectangle on the current image at the (x, y) coordinates with a size of width and height pixels, using the current color.

Parameters
xThe top left x coordinate of the rectangle
yThe top left y coordinate of the rectangle
widthThe width of the rectangle
heightThe height of the rectangle

◆ imlib_image_fill_color_range_rectangle()

EAPI void imlib_image_fill_color_range_rectangle ( int  x,
int  y,
int  width,
int  height,
double  angle 
)

Fill image rectangle with color range

Fills a rectangle of width width and height height at the (x, y) location specified in the current image with a linear gradient of the current color range at an angle of angle degrees with 0 degrees being vertical from top to bottom going clockwise from there.

Parameters
xThe x coordinate of the left edge of the rectangle
yThe y coordinate of the top edge of the rectangle
widthThe width of the rectangle
heightThe height of the rectangle
angleAngle of gradient

◆ imlib_image_fill_ellipse()

EAPI void imlib_image_fill_ellipse ( int  xc,
int  yc,
int  a,
int  b 
)

Draw an ellipse (filled)

Fills an ellipse on the current context image using the current context color. The ellipse is defined as (x-xc)^2/a^2 + (y-yc)^2/b^2 = 1. This means that the point (xc, yc) marks the center of the ellipse, a defines the horizontal amplitude of the ellipse, and b defines the vertical amplitude.

Parameters
xcX coordinate of the center of the ellipse
ycY coordinate of the center of the ellipse
aThe horizontal amplitude of the ellipse
bThe vertical amplitude of the ellipse

◆ imlib_image_fill_hsva_color_range_rectangle()

EAPI void imlib_image_fill_hsva_color_range_rectangle ( int  x,
int  y,
int  width,
int  height,
double  angle 
)

Fill image rectangle with HSVA color range

Fills a rectangle of width width and height height at the (x, y) location specified in the current image with a linear gradient in HSVA color space of the current color range at an angle of angle degrees with 0 degrees being vertical from top to bottom going clockwise from there.

Parameters
xThe x coordinate of the left edge of the rectangle
yThe y coordinate of the top edge of the rectangle
widthThe width of the rectangle
heightThe height of the rectangle
angleAngle of gradient

◆ imlib_image_fill_polygon()

EAPI void imlib_image_fill_polygon ( ImlibPolygon  poly)

Draw a polygon (filled)

Fills the area defined by the polygon polyon the current context image with the current context color.

Parameters
polyA polygon

◆ imlib_image_fill_rectangle()

EAPI void imlib_image_fill_rectangle ( int  x,
int  y,
int  width,
int  height 
)

Draw rectangle (filled)

Draws a filled rectangle on the current image at the (x, y) coordinates with a size of width and height pixels, using the current color.

Parameters
xThe top left x coordinate of the rectangle
yThe top left y coordinate of the rectangle
widthThe width of the rectangle
heightThe height of the rectangle

◆ imlib_image_filter()

EAPI void imlib_image_filter ( void  )

Filter current image with current filter

◆ imlib_image_flip_diagonal()

EAPI void imlib_image_flip_diagonal ( void  )

Flip/mirror the current image diagonally

Good for quick and dirty 90 degree rotations if used before or after a horizontal or vertical flip.

◆ imlib_image_flip_horizontal()

EAPI void imlib_image_flip_horizontal ( void  )

Flip/mirror the current image horizontally

◆ imlib_image_flip_vertical()

EAPI void imlib_image_flip_vertical ( void  )

Flip/mirror the current image vertically

◆ imlib_image_format()

EAPI char * imlib_image_format ( void  )

Return the current image's format

Do not free this string. Duplicate it if you need it for later use.

Returns
Current image format

◆ imlib_image_get_attached_data()

EAPI void * imlib_image_get_attached_data ( const char *  key)

Get attached image data

Gets the data attached to the current image with the key key specified.

Parameters
keyThe key
Returns
The attached data as a pointer, or NULL if none

◆ imlib_image_get_attached_value()

EAPI int imlib_image_get_attached_value ( const char *  key)

Get attached image data value

Returns the value attached to the current image with the specified key key. If none could be found 0 is returned.

Parameters
keyThe key
Returns
The attached value as an integer, or 0 if none

◆ imlib_image_get_border()

EAPI void imlib_image_get_border ( Imlib_Border *  border)

Get image border

The border is the area at the edge of the image that does not scale with the rest of the image when resized - the borders remain constant in size. This is useful for scaling bevels at the edge of images differently to the image center.

Parameters
borderReturns the image border

◆ imlib_image_get_data()

EAPI uint32_t * imlib_image_get_data ( void  )

Get a pointer to the image data for the current image

When you get this pointer it is assumed you are planning on writing to the data, thus once you do this the image can no longer be used for caching - in fact all images cached from this one will also be affected when you put the data back. If this matters it is suggested you clone the image first before playing with the image data. The image data is returned in the format of a uint32_t (32 bits) per pixel in a linear array ordered from the top left of the image to the bottom right going from left to right each line. Each pixel has the upper 8 bits as the alpha channel and the lower 8 bits are the blue channel - so a pixel's bits are ARGB (from most to least significant, 8 bits per channel). You must put the data back at some point.

Returns
A pointer to the image data

◆ imlib_image_get_data_for_reading_only()

EAPI uint32_t * imlib_image_get_data_for_reading_only ( void  )

Get a pointer to the image data for the current image (read-only)

Functions the same way as imlib_image_get_data(), but returns a pointer expecting the program to NOT write to the data returned (it is for inspection purposes only). Writing to this data has undefined results. The data does not need to be put back.

Returns
A pointer to the image data

◆ imlib_image_get_filename()

EAPI const char * imlib_image_get_filename ( void  )

Get the filename for the current image

The pointer returned is only valid as long as no operations cause the filename of the image to change. Saving the file with a different name would cause this. It is suggested you duplicate the string if you wish to continue to use the string for later processing. Do not free the string pointer returned by this function.

Returns
The current image filename

◆ imlib_image_get_frame_info()

EAPI void imlib_image_get_frame_info ( Imlib_Frame_Info *  info)

Get information about current image frame

Parameters
infoImlib_Frame_Info struct returning the information

◆ imlib_image_get_height()

EAPI int imlib_image_get_height ( void  )

Get the height in pixels of the current image

◆ imlib_image_get_width()

EAPI int imlib_image_get_width ( void  )

Get the width in pixels of the current image

◆ imlib_image_has_alpha()

EAPI char imlib_image_has_alpha ( void  )

Return whether or not the current image has an alpa channel

Returns 1 if the current context image has an alpha channel, or 0 if it does not.

Returns
Current alpha channel flag

◆ imlib_image_orientate()

EAPI void imlib_image_orientate ( int  orientation)

Rotate the current image

Performs 90 degree rotations on the current image. 0 does not rotate, 1 rotates clockwise by 90 degree, 2, rotates clockwise by 180 degrees, 3 rotates clockwise by 270 degrees.

Parameters
orientationThe orientation

◆ imlib_image_put_back_data()

EAPI void imlib_image_put_back_data ( uint32_t *  data)

Put back data obtained by imlib_image_get_data().

data must be returned by imlib_image_get_data().

Parameters
dataThe pointer to the image data

◆ imlib_image_query_pixel()

EAPI void imlib_image_query_pixel ( int  x,
int  y,
Imlib_Color *  color_return 
)

Get image pixel value at given location

Fills the color_return color structure with the color of the pixel in the current image that is at the (x, y) location.

Parameters
xThe x coordinate of the pixel
yThe y coordinate of the pixel
color_returnThe returned color

◆ imlib_image_query_pixel_cmya()

EAPI void imlib_image_query_pixel_cmya ( int  x,
int  y,
int *  cyan,
int *  magenta,
int *  yellow,
int *  alpha 
)

Get image pixel value at given location - CMYA space

Parameters
xThe x coordinate of the pixel
yThe y coordinate of the pixel
cyanThe returned cyan channel
magentaThe returned magenta channel
yellowThe returned yellow channel
alphaThe returned alpha channel

◆ imlib_image_query_pixel_hlsa()

EAPI void imlib_image_query_pixel_hlsa ( int  x,
int  y,
float *  hue,
float *  lightness,
float *  saturation,
int *  alpha 
)

Get image pixel value at given location - HLSA space

Parameters
xThe x coordinate of the pixel
yThe y coordinate of the pixel
hueThe returned hue channel
lightnessThe returned lightness channel
saturationThe returned saturation channel
alphaThe returned alpha channel

◆ imlib_image_query_pixel_hsva()

EAPI void imlib_image_query_pixel_hsva ( int  x,
int  y,
float *  hue,
float *  saturation,
float *  value,
int *  alpha 
)

Get image pixel value at given location - HSVA space

Parameters
xThe x coordinate of the pixel
yThe y coordinate of the pixel
hueThe returned hue channel
saturationThe returned saturation channel
valueThe returned value channel
alphaThe returned alpha channel

◆ imlib_image_remove_and_free_attached_data_value()

EAPI void imlib_image_remove_and_free_attached_data_value ( const char *  key)

Detach image data

Removes the data and value attached to the current image with the specified key key and also calls the destructor function that was supplied when attaching it (see imlib_image_attach_data_value()).

Parameters
keyThe key

◆ imlib_image_remove_attached_data_value()

EAPI void imlib_image_remove_attached_data_value ( const char *  key)

Detach image data

Detaches the data & value attached with the specified key key from the current image.

Parameters
keyThe key

◆ imlib_image_scroll_rect()

EAPI void imlib_image_scroll_rect ( int  x,
int  y,
int  width,
int  height,
int  delta_x,
int  delta_y 
)

Scroll image

Scrolls a rectangle of size width, height at the (x, y) location within the current image by the delta_x, delta_y distance.

Parameters
xThe top left x coordinate of the rectangle
yThe top left y coordinate of the rectangle
widthThe width of the rectangle
heightThe height of the rectangle
delta_xDistance along the x coordinates
delta_yDistance along the y coordinates

◆ imlib_image_set_border()

EAPI void imlib_image_set_border ( Imlib_Border *  border)

Set image border

Parameters
borderImage border

◆ imlib_image_set_changes_on_disk()

EAPI void imlib_image_set_changes_on_disk ( void  )

Force timestamp check on next load

By default Imlib2 will not check the timestamp of an image on disk and compare it with the image in its cache - this is to minimize disk activity when using the cache. Call this function and it will flag the current context image as being liable to change on disk and Imlib2 will check the timestamp of the image file on disk and compare it with the cached image when it next needs to use this image in the cache.

◆ imlib_image_set_format()

EAPI void imlib_image_set_format ( const char *  format)

Set image format

This formt is used when you wish to save an image in a different format that it was loaded in, or if the image currently has no file format associated with it.

Parameters
formatImage format

◆ imlib_image_set_has_alpha()

EAPI void imlib_image_set_has_alpha ( char  has_alpha)

Set the alpha flag for the current image

Set has_alpha to 1 to enable the alpha channel or 0 to disable it.

Parameters
has_alphaAlpha flag

◆ imlib_image_set_irrelevant_alpha()

IMLIB2_DEPRECATED EAPI void imlib_image_set_irrelevant_alpha ( char  irrelevant)

Deprecated function - hasn't done anything useful ever

Deprecated:
Useless - don't use

◆ imlib_image_set_irrelevant_border()

IMLIB2_DEPRECATED EAPI void imlib_image_set_irrelevant_border ( char  irrelevant)

Deprecated function - hasn't done anything useful ever

Deprecated:
Useless - don't use

◆ imlib_image_set_irrelevant_format()

EAPI void imlib_image_set_irrelevant_format ( char  irrelevant)

Set if the format value of the current image is irrelevant for caching purposes

By default it is. Pass irrelevant as 1 to make it irrelevant and 0 to make it relevant for caching.

Parameters
irrelevantIrrelevant format flag

◆ imlib_image_sharpen()

EAPI void imlib_image_sharpen ( int  radius)

Sharpen the current image

The radius value affects how much to sharpen by.

Parameters
radiusThe radius

◆ imlib_image_tile()

EAPI void imlib_image_tile ( void  )

Modify current image for horizontal and vertical tiling

Modifies an image so it will tile seamlessly horizontally and vertically if used as a tile (i.e. drawn multiple times horizontally and vertically).

◆ imlib_image_tile_horizontal()

EAPI void imlib_image_tile_horizontal ( void  )

Modify current image for horizontal tiling

Modifies an image so it will tile seamlessly horizontally if used as a tile (i.e. drawn multiple times horizontally).

◆ imlib_image_tile_vertical()

EAPI void imlib_image_tile_vertical ( void  )

Modify current image for vertical tiling

Modifies an image so it will tile seamlessly vertically if used as a tile (i.e. drawn multiple times vertically).

◆ imlib_insert_font_into_fallback_chain()

EAPI int imlib_insert_font_into_fallback_chain ( Imlib_Font  font,
Imlib_Font  fallback_font 
)

Add font to fallback chain

This arranges for the given fallback font to be used if a glyph does not exist in the given font when text is being rendered. Fonts can be arranged in an aribitrarily long chain and attempts will be made in order on the chain. Cycles in the chain are not possible since the given fallback font is removed from any chain it's already in. A fallback font may be a member of only one chain. Adding it as the fallback font to another font will remove it from it's first fallback chain.

Parameters
fontA previously loaded font
fallback_fontA previously loaded font to be chained to the given font
Returns
0 on success

◆ imlib_list_font_path()

EAPI char ** imlib_list_font_path ( int *  number_return)

Return font path list

Returns a list of strings that are the directories in the font path. Do not free this list or change it in any way. If you add or delete members of the font path this list will be invalid. If you intend to use this list later duplicate it for your own use. The number of elements in the array of strings is put into number_return.

Parameters
number_returnNumber of paths in the list
Returns
A list of strings

◆ imlib_list_fonts()

EAPI char ** imlib_list_fonts ( int *  number_return)

Return a list of fonts imlib2 can find in its font path

Parameters
number_returnNumber of fonts in the list
Returns
A list of fonts

◆ imlib_load_font()

EAPI Imlib_Font imlib_load_font ( const char *  font_name)

Load a truetype font

Loads a truetype font from the first directory in the font path that contains that font. The font name font_name format is "font_name/size". For example. If there is a font file called blum.ttf somewhere in the font path you might use "blum/20" to load a 20 pixel sized font of blum. If the font cannot be found NULL is returned.

Parameters
font_nameThe font name with the size
Returns
NULL if no font found

◆ imlib_load_image()

EAPI Imlib_Image imlib_load_image ( const char *  file)

Load an image from file (header only)

Please see the section How Image Loading Works for more detail.

Parameters
fileFile name
Returns
Image handle (NULL on failure)

◆ imlib_load_image_fd()

EAPI Imlib_Image imlib_load_image_fd ( int  fd,
const char *  file 
)

Read an image from file descriptor

The file name file is only used to guess the file format. The image is loaded without deferred image data decoding and without looking in the cache.

fd must be mmap'able (so it cannot be a pipe). fd will be closed after calling this function.

Parameters
fdImage file descriptor
fileFile name
Returns
Image handle (NULL on failure)

◆ imlib_load_image_frame()

EAPI Imlib_Image imlib_load_image_frame ( const char *  file,
int  frame 
)

Load image frame

Loads the specified frame within the image. On success an image handle is returned, otherwise NULL is returned (e.g. if the requested frame does not exist). The image is loaded immediately.

Parameters
fileImage file
frameFrame number
Returns
Image handle (NULL on failure)

◆ imlib_load_image_frame_mem()

EAPI Imlib_Image imlib_load_image_frame_mem ( const char *  file,
int  frame,
const void *  data,
size_t  size 
)

Load image frame form memory

Loads the specified frame within the image from memory. The file name file is only used to guess the file format. On success an image handle is returned, otherwise NULL is returned (e.g. if the requested frame does not exist). The image is loaded immediately.

Parameters
fileFile name
frameFrame number
dataImage data
sizeImage data size
Returns
Image handle (NULL on failure)

◆ imlib_load_image_immediately()

EAPI Imlib_Image imlib_load_image_immediately ( const char *  file)

Load an image from file "immediately" (header and data)

This forces the image data to be decoded at load time instead of decoding being deferred until it is needed.

Parameters
fileFile name
Returns
Image handle (NULL on failure)

◆ imlib_load_image_immediately_without_cache()

EAPI Imlib_Image imlib_load_image_immediately_without_cache ( const char *  file)

Load an image "immediately" without looking in the cache first

Parameters
fileFile name
Returns
Image handle (NULL on failure)

◆ imlib_load_image_mem()

EAPI Imlib_Image imlib_load_image_mem ( const char *  file,
const void *  data,
size_t  size 
)

Read an image from memory

The file name file is only used to guess the file format. The image is loaded without deferred image data decoding and without looking in the cache.

Parameters
fileFile name
dataImage data
sizeImage data size
Returns
Image handle (NULL on failure)

◆ imlib_load_image_with_errno_return()

EAPI Imlib_Image imlib_load_image_with_errno_return ( const char *  file,
int *  error_return 
)

Load an image from file with error return

The image is loaded without deferred image data decoding.

On error error_return is set to the detail of the error. error values: 0: Success, positive: Regular errnos, negative: IMLIB_ERR_... values, see above

Parameters
fileFile name
error_returnThe returned error
Returns
Image handle (NULL on failure)

◆ imlib_load_image_with_error_return()

EAPI Imlib_Image imlib_load_image_with_error_return ( const char *  file,
Imlib_Load_Error *  error_return 
)

Load an image from file with error return

The image is loaded without deferred image data decoding.

On error error_return is set to the detail of the error.

Parameters
fileFile name
error_returnThe returned error
Returns
Image handle (NULL on failure)
Deprecated:
Use imlib_load_image_with_errno_return()

◆ imlib_load_image_without_cache()

EAPI Imlib_Image imlib_load_image_without_cache ( const char *  file)

Load an image without looking in the cache first

Parameters
fileFile name
Returns
Image handle (NULL on failure)

◆ imlib_modify_color_modifier_brightness()

EAPI void imlib_modify_color_modifier_brightness ( double  brightness_value)

Modify current color modifier brightness

Modifies the current color modifier by adjusting the brightness by the value brightness_value. The color modifier is modified not set, so calling this repeatedly has cumulative effects. brightness values of 0 do not affect anything. -1.0 will make things completely black and 1.0 will make things all white. Values in-between vary brightness linearly.

Parameters
brightness_valueValue of brightness

◆ imlib_modify_color_modifier_contrast()

EAPI void imlib_modify_color_modifier_contrast ( double  contrast_value)

Modify current color modifier contrast

Modifies the current color modifier by adjusting the contrast by the value contrast_value. The color modifier is modified not set, so calling this repeatedly has cumulative effects. Contrast of 1.0 does nothing. 0.0 will merge to gray, 2.0 will double contrast etc.

Parameters
contrast_valueValue of contrast

◆ imlib_modify_color_modifier_gamma()

EAPI void imlib_modify_color_modifier_gamma ( double  gamma_value)

Modify current color modifier gamma

Modifies the current color modifier by adjusting the gamma by the value specified gamma_value. The color modifier is modified not set, so calling this repeatedly has cumulative effects. A gamma of 1.0 is normal linear, 2.0 brightens and 0.5 darkens etc. Negative values are not allowed.

Parameters
gamma_valueValue of gamma

◆ imlib_polygon_add_point()

EAPI void imlib_polygon_add_point ( ImlibPolygon  poly,
int  x,
int  y 
)

Add point to polygon

Adds the point (x, y) to the polygon poly. The point will be added to the end of the polygon's internal point list. The points are drawn in order, from the first to the last.

Parameters
polyA polygon
xThe X coordinate
yThe Y coordinate

◆ imlib_polygon_contains_point()

EAPI unsigned char imlib_polygon_contains_point ( ImlibPolygon  poly,
int  x,
int  y 
)

Check if polygon contains point

Returns non-zero if the point (x, y) is within the area defined by the polygon poly.

Parameters
polyA polygon
xThe X coordinate
yThe Y coordinate
Returns
non-zero if point is inside polygon

◆ imlib_polygon_free()

EAPI void imlib_polygon_free ( ImlibPolygon  poly)

Free a polygon object.

Parameters
polyA polygon

◆ imlib_polygon_get_bounds()

EAPI void imlib_polygon_get_bounds ( ImlibPolygon  poly,
int *  px1,
int *  py1,
int *  px2,
int *  py2 
)

Get polygon bounds

Calculates the bounding area of the polygon poly. (px1, py1) defines the upper left corner of the bounding box and (px2, py2) defines it's lower right corner.

Parameters
polyA polygon
px1X coordinate of the upper left corner
py1Y coordinate of the upper left corner
px2X coordinate of the lower right corner
py2Y coordinate of the lower right corner

◆ imlib_polygon_new()

EAPI ImlibPolygon imlib_polygon_new ( void  )

Create empty polygon object

Returns
a new polygon object with no points set

◆ imlib_remove_font_from_fallback_chain()

EAPI void imlib_remove_font_from_fallback_chain ( Imlib_Font  fallback_font)

Remove font from fallback chain

This removes the given font from any fallback chain it may be in.

Parameters
fallback_fontA font previously added to a fallback chain

◆ imlib_remove_path_from_font_path()

EAPI void imlib_remove_path_from_font_path ( const char *  path)

Remove font path

Removes a font path from the font path list

Parameters
pathA directory path

◆ imlib_render_get_pixel_color()

EAPI uint32_t imlib_render_get_pixel_color ( void  )

Return X11 pixel value of current color

◆ imlib_render_image_on_drawable()

EAPI void imlib_render_image_on_drawable ( int  x,
int  y 
)

Render image onto drawable

Renders the current image onto the current drawable at the (x, y) pixel location specified without scaling.

Parameters
xX coordinate of the pixel
yY coordinate of the pixel

◆ imlib_render_image_on_drawable_at_angle()

EAPI void imlib_render_image_on_drawable_at_angle ( int  src_x,
int  src_y,
int  src_width,
int  src_height,
int  dst_x,
int  dst_y,
int  angle_x,
int  angle_y 
)

Blend image onto drawable at angle

Works just like imlib_render_image_on_drawable_skewed() except you cannot skew an image (v_angle_x and v_angle_y are 0).

Parameters
src_xThe source x coordinate
src_yThe source y coordinate
src_widthThe source width
src_heightThe source height
dst_xThe destination x coordinate
dst_yThe destination y coordinate
angle_xAn angle
angle_yAn angle

◆ imlib_render_image_on_drawable_at_size()

EAPI void imlib_render_image_on_drawable_at_size ( int  x,
int  y,
int  width,
int  height 
)

Render image onto drawable at given size

Renders the current image onto the current drawable at the (x, y) location specified AND scale the image to the width width and height height.

Parameters
xX coordinate of the pixel
yY coordinate of the pixel
widthWidth of the rendered image
heightHeight of the rendered image

◆ imlib_render_image_on_drawable_skewed()

EAPI void imlib_render_image_on_drawable_skewed ( int  src_x,
int  src_y,
int  src_width,
int  src_height,
int  dst_x,
int  dst_y,
int  h_angle_x,
int  h_angle_y,
int  v_angle_x,
int  v_angle_y 
)

Blend image onto drawable at angle, skewed

Works just like imlib_blend_image_onto_image_skewed(), except it blends the image onto the current drawable instead of the current image.

Parameters
src_xThe source x coordinate
src_yThe source y coordinate
src_widthThe source width
src_heightThe source height
dst_xThe destination x coordinate
dst_yThe destination y coordinate
h_angle_xAn angle
h_angle_yAn angle
v_angle_xAn angle
v_angle_yAn angle

◆ imlib_render_image_part_on_drawable_at_size()

EAPI void imlib_render_image_part_on_drawable_at_size ( int  src_x,
int  src_y,
int  src_width,
int  src_height,
int  dst_x,
int  dst_y,
int  dst_width,
int  dst_height 
)

Render part of image onto drawable at given size

Renders the source (src_x, src_y, src_width, src_height) pixel rectangle from the current image onto the current drawable at the (dst_x, dst_y) location scaled to the width dst_width and height dst_height.

Parameters
src_xX coordinate of the source image
src_yY coordinate of the source image
src_widthWidth of the source image
src_heightHeight of the source image
dst_xX coordinate of the destination image
dst_yY coordinate of the destination image
dst_widthWidth of the destination image
dst_heightHeight of the destination image

◆ imlib_render_pixmaps_for_whole_image()

EAPI void imlib_render_pixmaps_for_whole_image ( Pixmap *  pixmap_return,
Pixmap *  mask_return 
)

Create pixmap/mask of the current image

The mask is generated if the image has an alpha value.

The pixmaps must be freed using imlib_free_pixmap_and_mask().

Parameters
pixmap_returnThe returned pixmap
mask_returnThe returned mask

◆ imlib_render_pixmaps_for_whole_image_at_size()

EAPI void imlib_render_pixmaps_for_whole_image_at_size ( Pixmap *  pixmap_return,
Pixmap *  mask_return,
int  width,
int  height 
)

Create pixmap/mask of the current image at given size

Works just like imlib_render_pixmaps_for_whole_image(), but will scale the output result to the width width and height height specified. Scaling is done before depth conversion so pixels used for dithering don't grow large.

Parameters
pixmap_returnThe returned pixmap
mask_returnThe returned mask
widthWidth of the pixmap
heightHeight of the pixmap

◆ imlib_reset_color_modifier()

EAPI void imlib_reset_color_modifier ( void  )

Reset current color modifier tables

Resets the current color modifier to have linear mapping tables

◆ imlib_rotate_image_from_buffer()

EAPI void imlib_rotate_image_from_buffer ( double  angle,
Imlib_Image  src_image 
)

Rotate image onto image

Rotate @ src_image onto current image.

Parameters
src_imageThe source image
angleAn angle in radians

◆ imlib_save_image()

EAPI void imlib_save_image ( const char *  file)

Save image to file

Saves the current image in the format specified by the current image's format setting to the filename file. If the image's format is not set, the format is derived from file.

Parameters
fileThe file name

◆ imlib_save_image_fd()

EAPI void imlib_save_image_fd ( int  fd,
const char *  file 
)

Save image to file descriptor

Saves the current image in the format specified by the current image's format setting to the file given by fd. The file name file is used only to derive the file format if the image's format is not set.

fd will be closed after calling this function.

Parameters
fdImage file descriptor
fileThe file name

◆ imlib_save_image_with_errno_return()

EAPI void imlib_save_image_with_errno_return ( const char *  file,
int *  error_return 
)

Save image to file with error return

Works the same way imlib_save_image() works, but will set the error_return to an error value if the save fails. error values: 0: Success, positive: Regular errnos, negative: IMLIB_ERR_... values, see above

Parameters
fileThe file name
error_returnThe returned error

◆ imlib_save_image_with_error_return()

EAPI void imlib_save_image_with_error_return ( const char *  file,
Imlib_Load_Error *  error_return 
)

Save image to file with error return

Works the same way imlib_save_image() works, but will set the error_return to an error value if the save fails.

Parameters
fileThe file name
error_returnThe returned error
Deprecated:
Use imlib_save_image_with_errno_return()

◆ imlib_set_cache_size()

EAPI void imlib_set_cache_size ( int  bytes)

Set the cache size

The size is in bytes. Setting the cache size to 0 effectively flushes the cache and keeps the cache size at 0 until set to another value. Whenever you set the cache size Imlib2 will flush as many old images and pixmap from the cache as needed until the current cache usage is less than or equal to the cache size.

Parameters
bytesImage cache max size

◆ imlib_set_color_modifier_tables()

EAPI void imlib_set_color_modifier_tables ( uint8_t *  red_table,
uint8_t *  green_table,
uint8_t *  blue_table,
uint8_t *  alpha_table 
)

Set current color modifier tables

Explicitly copies the mapping tables from the table pointers passed into this function into those of the current color modifier. Tables are 256 entry arrays of uint8_t which are a mapping of that channel value to a new channel value. A normal mapping would be linear (v[0] = 0, v[10] = 10, v[50] = 50, v[200] = 200, v[255] = 255).

Parameters
red_tableA 256 element uint8_t array
green_tableA 256 element uint8_t array
blue_tableA 256 element uint8_t array
alpha_tableA 256 element uint8_t array

◆ imlib_set_color_usage()

EAPI void imlib_set_color_usage ( int  max)

Set the maximum number of colors Imlib2 is allowed to allocate

The default is 256. This has no effect in depths greater than 8 bit.

Parameters
maxMaximum number of colors

◆ imlib_set_font_cache_size()

EAPI void imlib_set_font_cache_size ( int  bytes)

Set the font cache size

Whenever you set the font cache size Imlib2 will flush fonts from the cache until the memory used by fonts is less than or equal to the font cache size. Setting the size to 0 effectively frees all speculatively cached fonts.

Parameters
bytesThe font cache size in bytes

◆ imlib_set_ximage_cache_count_max()

EAPI void imlib_set_ximage_cache_count_max ( int  count)

Set the maximum number of XImages to cache

Setting the cache size to 0 effectively flushes the cache and keeps the cached XImage count at 0 until set to another value. Whenever you set the max count Imlib2 will flush as many old XImages from the cache as possible until the current cached XImage count is less than or equal to the cache max count.

Parameters
countXImage cache max count

◆ imlib_set_ximage_cache_size_max()

EAPI void imlib_set_ximage_cache_size_max ( int  bytes)

Set the XImage cache maximum size

Setting the cache size to 0 effectively flushes the cache and keeps the cache size at 0 until set to another value. Whenever you set the max size Imlib2 will flush as many old XImages from the cache as possible until the current XImage cache usage is less than or equal to the cache max size.

Parameters
bytesXImage cache max size in bytes

◆ imlib_strerror()

EAPI const char * imlib_strerror ( int  err)

Return string describing error code

err must be a value returned by imlib_load/save_image_with_errno_return(). The returned string must not be modified or freed.

Parameters
errThe error code
Returns
String describing the error code

◆ imlib_text_draw()

EAPI void imlib_text_draw ( int  x,
int  y,
const char *  text 
)

Draw text

Draws the null-byte terminated string text using the current font on the current image at the (x, y) location (x, y denoting the top left corner of the font string)

Parameters
xThe x coordinate of the top left corner
yThe y coordinate of the top left corner
textA null-byte terminated string

◆ imlib_text_draw_with_return_metrics()

EAPI void imlib_text_draw_with_return_metrics ( int  x,
int  y,
const char *  text,
int *  width_return,
int *  height_return,
int *  horizontal_advance_return,
int *  vertical_advance_return 
)

Draw text and return metrics

Works just like imlib_text_draw() but also returns the width and height of the string drawn, and horizontal_advance_return returns the number of pixels you should advance horizontally to draw another string (useful if you are drawing a line of text word by word) and vertical_advance_return does the same for the vertical direction (i.e. drawing text line by line).

Parameters
xThe x coordinate of the top left corner
yThe y coordinate of the top left corner
textA null-byte terminated string
width_returnThe width of the string
height_returnThe height of the string
horizontal_advance_returnHorizontal offset
vertical_advance_returnVertical offset

◆ imlib_text_get_index_and_location()

EAPI int imlib_text_get_index_and_location ( const char *  text,
int  x,
int  y,
int *  char_x_return,
int *  char_y_return,
int *  char_width_return,
int *  char_height_return 
)

Return character number in text

Returns the character number in the string text using the current font at the (x, y) pixel location which is an offset relative to the top left of that string. -1 is returned if there is no character there. If there is a character, char_x_return, char_y_return, char_width_return and char_height_return (respectively the character x, y, width and height) are also filled in.

Parameters
textA string
xThe x offset
yThe y offset
char_x_returnThe x coordinate of the character
char_y_returnThe x coordinate of the character
char_width_returnThe width of the character
char_height_returnThe height of the character
Returns
Character number, -1 if no character found

◆ imlib_text_get_location_at_index()

EAPI void imlib_text_get_location_at_index ( const char *  text,
int  index,
int *  char_x_return,
int *  char_y_return,
int *  char_width_return,
int *  char_height_return 
)

Get geometry of character in text

Gets the geometry of the character at index index in the text string using the current font.

Parameters
textA string
indexThe character index
char_x_returnThe x coordinate of the character
char_y_returnThe y coordinate of the character
char_width_returnThe width of the character
char_height_returnThe height of the character

◆ imlib_update_append_rect()

EAPI Imlib_Updates imlib_update_append_rect ( Imlib_Updates  updates,
int  x,
int  y,
int  w,
int  h 
)

Append rectangle to updates list

Appends an update rectangle to the updates list passed in (if the updates is NULL it will create a new updates list) and returns a handle to the modified updates list (the handle may be modified so only use the new updates handle returned).

Parameters
updatesAn updates list
xThe top left x coordinate of the rectangle
yThe top left y coordinate of the rectangle
wThe width of the rectangle
hThe height of the rectangle
Returns
The updates handle

◆ imlib_updates_append_updates()

EAPI Imlib_Updates imlib_updates_append_updates ( Imlib_Updates  updates,
Imlib_Updates  appended_updates 
)

Append update list to update list

Appends appended_updates to the updates list updates and returns the new list.

Parameters
updatesAn updates list
appended_updatesThe updates list to append
Returns
The new updates list

◆ imlib_updates_clone()

EAPI Imlib_Updates imlib_updates_clone ( Imlib_Updates  updates)

Duplicate update list

Creates a duplicate of an updates list.

Parameters
updatesAn updates list
Returns
Duplicate of updates

◆ imlib_updates_free()

EAPI void imlib_updates_free ( Imlib_Updates  updates)

Free updates list

Parameters
updatesAn updates list

◆ imlib_updates_get_coordinates()

EAPI void imlib_updates_get_coordinates ( Imlib_Updates  updates,
int *  x_return,
int *  y_return,
int *  width_return,
int *  height_return 
)

Return the coordinates of first update in update list

Parameters
updatesAn updates list
x_returnThe top left x coordinate of the update
y_returnThe top left y coordinate of the update
width_returnThe width of the update
height_returnThe height of the update

◆ imlib_updates_get_next()

EAPI Imlib_Updates imlib_updates_get_next ( Imlib_Updates  updates)

Get the next update in an updates list

Parameters
updatesAn updates list
Returns
The next updates

◆ imlib_updates_init()

EAPI Imlib_Updates imlib_updates_init ( void  )

Return empty updates list

Initializes an updates list before you add any updates to it or merge it for rendering etc.

Returns
The initialized updates list

◆ imlib_updates_merge()

EAPI Imlib_Updates imlib_updates_merge ( Imlib_Updates  updates,
int  w,
int  h 
)

Merge updates list

Takes an updates list, and modifies it by merging overlapped rectangles and lots of tiny rectangles into larger rectangles to minimize the number of rectangles in the list for optimized redrawing. The new updates handle is now valid and the old one passed in is not.

Parameters
updatesAn updates list
wThe width of the rectangle
hThe height of the rectangle
Returns
The updates handle

◆ imlib_updates_merge_for_rendering()

EAPI Imlib_Updates imlib_updates_merge_for_rendering ( Imlib_Updates  updates,
int  w,
int  h 
)

Merge updates list

Works almost exactly as imlib_updates_merge() but is more lenient on the spacing between update rectangles - if they are very close it amalgamates 2 smaller rectangles into 1 larger one.

Parameters
updatesAn updates list
wThe width of the rectangle
hThe height of the rectangle
Returns
The updates handle

◆ imlib_updates_set_coordinates()

EAPI void imlib_updates_set_coordinates ( Imlib_Updates  updates,
int  x,
int  y,
int  width,
int  height 
)

Modify the coordinates of the first update in update list

Parameters
updatesAn updates list
xThe top left x coordinate of the update
yThe top left y coordinate of the update
widthThe width of the update
heightThe height of the update

◆ imlib_version()

EAPI int imlib_version ( void  )

Return Imlib2 version