1$#include <Imlib2.h> 2$#include <X11/Xlib.h> 3 4$#define _userdata void* 5 6typedef void *Imlib_Context; 7typedef void *Imlib_Image; 8typedef void *Imlib_Color_Modifier; 9typedef void *Imlib_Updates; 10typedef void *Imlib_Font; 11typedef void *Imlib_Color_Range; 12typedef void *Imlib_Filter; 13typedef struct _imlib_color Imlib_Color; 14typedef void *ImlibPolygon; 15 16enum _imlib_operation 17{ 18 IMLIB_OP_COPY, 19 IMLIB_OP_ADD, 20 IMLIB_OP_SUBTRACT, 21 IMLIB_OP_RESHADE 22}; 23 24enum _imlib_text_direction 25{ 26 IMLIB_TEXT_TO_RIGHT = 0, 27 IMLIB_TEXT_TO_LEFT = 1, 28 IMLIB_TEXT_TO_DOWN = 2, 29 IMLIB_TEXT_TO_UP = 3, 30 IMLIB_TEXT_TO_ANGLE = 4 31}; 32 33enum _imlib_load_error 34{ 35 IMLIB_LOAD_ERROR_NONE, 36 IMLIB_LOAD_ERROR_FILE_DOES_NOT_EXIST, 37 IMLIB_LOAD_ERROR_FILE_IS_DIRECTORY, 38 IMLIB_LOAD_ERROR_PERMISSION_DENIED_TO_READ, 39 IMLIB_LOAD_ERROR_NO_LOADER_FOR_FILE_FORMAT, 40 IMLIB_LOAD_ERROR_PATH_TOO_LONG, 41 IMLIB_LOAD_ERROR_PATH_COMPONENT_NON_EXISTANT, 42 IMLIB_LOAD_ERROR_PATH_COMPONENT_NOT_DIRECTORY, 43 IMLIB_LOAD_ERROR_PATH_POINTS_OUTSIDE_ADDRESS_SPACE, 44 IMLIB_LOAD_ERROR_TOO_MANY_SYMBOLIC_LINKS, 45 IMLIB_LOAD_ERROR_OUT_OF_MEMORY, 46 IMLIB_LOAD_ERROR_OUT_OF_FILE_DESCRIPTORS, 47 IMLIB_LOAD_ERROR_PERMISSION_DENIED_TO_WRITE, 48 IMLIB_LOAD_ERROR_OUT_OF_DISK_SPACE, 49 IMLIB_LOAD_ERROR_UNKNOWN 50}; 51 52enum _imlib_TTF_encoding 53{ 54 IMLIB_TTF_ENCODING_ISO_8859_1, 55 IMLIB_TTF_ENCODING_ISO_8859_2, 56 IMLIB_TTF_ENCODING_ISO_8859_3, 57 IMLIB_TTF_ENCODING_ISO_8859_4, 58 IMLIB_TTF_ENCODING_ISO_8859_5 59}; 60 61typedef enum _imlib_operation Imlib_Operation; 62typedef enum _imlib_load_error Imlib_Load_Error; 63typedef enum _imlib_load_error ImlibLoadError; 64typedef enum _imlib_text_direction Imlib_Text_Direction; 65typedef enum _imlib_TTF_encoding Imlib_TTF_Encoding; 66 67typedef struct _imlib_border Imlib_Border; 68 69Imlib_Context imlib_context_new(void); 70void imlib_context_free(Imlib_Context context); 71 72void imlib_context_push(Imlib_Context context); 73void imlib_context_pop(void); 74Imlib_Context imlib_context_get(void); 75 76void imlib_context_set_display(Display * display); 77void imlib_context_disconnect_display(void); 78void imlib_context_set_visual(Visual * visual); 79void imlib_context_set_colormap(Colormap colormap); 80void imlib_context_set_drawable(Drawable drawable); 81void imlib_context_set_mask(Pixmap mask); 82void imlib_context_set_dither_mask(char dither_mask); 83void imlib_context_set_mask_alpha_threshold(int mask_alpha_threshold); 84void imlib_context_set_anti_alias(char anti_alias); 85void imlib_context_set_dither(char dither); 86void imlib_context_set_blend(char blend); 87void imlib_context_set_color_modifier(Imlib_Color_Modifier color_modifier); 88void imlib_context_set_operation(Imlib_Operation operation); 89void imlib_context_set_font(Imlib_Font font); 90void imlib_context_set_direction(Imlib_Text_Direction direction); 91void imlib_context_set_angle(double angle); 92void imlib_context_set_color(int red, int green, int blue, int alpha); 93void imlib_context_set_color_hsva(float hue, float saturation, float value, int alpha); 94void imlib_context_set_color_hlsa(float hue, float lightness, float saturation, int alpha); 95void imlib_context_set_color_cmya(int cyan, int magenta, int yellow, int alpha); 96void imlib_context_set_color_range(Imlib_Color_Range color_range); 97void imlib_context_set_progress_function(Imlib_Progress_Function 98 progress_function); 99void imlib_context_set_progress_granularity(char progress_granularity); 100void imlib_context_set_image(Imlib_Image image); 101void imlib_context_set_cliprect(int x, int y, int w, int h); 102void imlib_context_set_TTF_encoding(Imlib_TTF_Encoding encoding); 103 104Display *imlib_context_get_display(void); 105Visual *imlib_context_get_visual(void); 106Colormap imlib_context_get_colormap(void); 107Drawable imlib_context_get_drawable(void); 108Pixmap imlib_context_get_mask(void); 109char imlib_context_get_dither_mask(void); 110char imlib_context_get_anti_alias(void); 111int imlib_context_get_mask_alpha_threshold(void); 112char imlib_context_get_dither(void); 113char imlib_context_get_blend(void); 114Imlib_Color_Modifier imlib_context_get_color_modifier(void); 115Imlib_Operation imlib_context_get_operation(void); 116Imlib_Font imlib_context_get_font(void); 117double imlib_context_get_angle(void); 118Imlib_Text_Direction imlib_context_get_direction(void); 119void imlib_context_get_color(int *red, int *green, int *blue, int *alpha); 120void imlib_context_get_color_hsva(float *hue, float *saturation, float *value, int *alpha); 121void imlib_context_get_color_hlsa(float *hue, float *lightness, float *saturation, int *alpha); 122void imlib_context_get_color_cmya(int *cyan, int *magenta, int *yellow, int *alpha); 123Imlib_Color *imlib_context_get_imlib_color(void); 124Imlib_Color_Range imlib_context_get_color_range(void); 125Imlib_Progress_Function imlib_context_get_progress_function(void); 126char imlib_context_get_progress_granularity(void); 127Imlib_Image imlib_context_get_image(void); 128void imlib_context_get_cliprect(int *x, int *y, int *w, int *h); 129Imlib_TTF_Encoding imlib_context_get_TTF_encoding(void); 130 131int imlib_get_cache_size(void); 132void imlib_set_cache_size(int bytes); 133int imlib_get_color_usage(void); 134void imlib_set_color_usage(int max); 135void imlib_flush_loaders(void); 136int imlib_get_visual_depth(Display * display, Visual * visual); 137Visual *imlib_get_best_visual(Display * display, int screen, 138 int *depth_return); 139 140Imlib_Image imlib_load_image(const char *file); 141Imlib_Image imlib_load_image_immediately(const char *file); 142Imlib_Image imlib_load_image_without_cache(const char *file); 143Imlib_Image imlib_load_image_immediately_without_cache(const char *file); 144Imlib_Image imlib_load_image_with_error_return(const char *file, 145 Imlib_Load_Error * 146 error_return); 147void imlib_free_image(void); 148void imlib_free_image_and_decache(void); 149 150int imlib_image_get_width(void); 151int imlib_image_get_height(void); 152const char *imlib_image_get_filename(void); 153int *imlib_image_get_data(void); 154int *imlib_image_get_data_for_reading_only(void); 155void imlib_image_put_back_data(unsigned int * data); 156char imlib_image_has_alpha(void); 157void imlib_image_set_changes_on_disk(void); 158void imlib_image_get_border(Imlib_Border * border); 159void imlib_image_set_border(Imlib_Border * border); 160void imlib_image_set_format(const char *format); 161void imlib_image_set_irrelevant_format(char irrelevant); 162void imlib_image_set_irrelevant_border(char irrelevant); 163void imlib_image_set_irrelevant_alpha(char irrelevant); 164char *imlib_image_format(void); 165void imlib_image_set_has_alpha(char has_alpha); 166void imlib_image_query_pixel(int x, int y, Imlib_Color * color_return); 167void imlib_image_query_pixel_hsva(int x, int y, float *hue, float *saturation, float *value, int *alpha); 168void imlib_image_query_pixel_hlsa(int x, int y, float *hue, float *lightness, float *saturation, int *alpha); 169void imlib_image_query_pixel_cmya(int x, int y, int *cyan, int *magenta, int *yellow, int *alpha); 170 171void imlib_render_pixmaps_for_whole_image(Pixmap * pixmap_return, 172 Pixmap * mask_return); 173void imlib_render_pixmaps_for_whole_image_at_size(Pixmap * pixmap_return, 174 Pixmap * mask_return, 175 int width, int height); 176void imlib_free_pixmap_and_mask(Pixmap pixmap); 177void imlib_render_image_on_drawable(int x, int y); 178void imlib_render_image_on_drawable_at_size(int x, int y, int width, 179 int height); 180void imlib_render_image_part_on_drawable_at_size(int source_x, 181 int source_y, 182 int source_width, 183 int source_height, int x, 184 int y, int width, 185 int height); 186unsigned int imlib_render_get_pixel_color(void); 187void imlib_blend_image_onto_image(Imlib_Image source_image, 188 char merge_alpha, int source_x, 189 int source_y, int source_width, 190 int source_height, int destination_x, 191 int destination_y, int destination_width, 192 int destination_height); 193 194Imlib_Image imlib_create_image(int width, int height); 195Imlib_Image imlib_create_image_using_data(int width, int height, 196 unsigned int * data); 197Imlib_Image imlib_create_image_using_copied_data(int width, int height, 198 unsigned int * data); 199Imlib_Image imlib_create_image_from_drawable(Pixmap mask, int x, int y, 200 int width, int height, 201 char need_to_grab_x); 202Imlib_Image imlib_create_image_from_ximage(XImage *image, XImage *mask, int x, int y, 203 int width, int height, 204 char need_to_grab_x); 205Imlib_Image imlib_create_scaled_image_from_drawable(Pixmap mask, 206 int source_x, 207 int source_y, 208 int source_width, 209 int source_height, 210 int destination_width, 211 int destination_height, 212 char need_to_grab_x, 213 char 214 get_mask_from_shape); 215char imlib_copy_drawable_to_image(Pixmap mask, int x, int y, int width, 216 int height, int destination_x, 217 int destination_y, char need_to_grab_x); 218Imlib_Image imlib_clone_image(void); 219Imlib_Image imlib_create_cropped_image(int x, int y, int width, 220 int height); 221Imlib_Image imlib_create_cropped_scaled_image(int source_x, int source_y, 222 int source_width, 223 int source_height, 224 int destination_width, 225 int destination_height); 226 227Imlib_Updates imlib_updates_clone(Imlib_Updates updates); 228Imlib_Updates imlib_update_append_rect(Imlib_Updates updates, int x, int y, 229 int w, int h); 230Imlib_Updates imlib_updates_merge(Imlib_Updates updates, int w, int h); 231Imlib_Updates imlib_updates_merge_for_rendering(Imlib_Updates updates, 232 int w, int h); 233void imlib_updates_free(Imlib_Updates updates); 234Imlib_Updates imlib_updates_get_next(Imlib_Updates updates); 235void imlib_updates_get_coordinates(Imlib_Updates updates, int *x_return, 236 int *y_return, int *width_return, 237 int *height_return); 238void imlib_updates_set_coordinates(Imlib_Updates updates, int x, int y, 239 int width, int height); 240void imlib_render_image_updates_on_drawable(Imlib_Updates updates, int x, 241 int y); 242Imlib_Updates imlib_updates_init(void); 243Imlib_Updates imlib_updates_append_updates(Imlib_Updates updates, 244 Imlib_Updates appended_updates); 245 246void imlib_image_flip_horizontal(void); 247void imlib_image_flip_vertical(void); 248void imlib_image_flip_diagonal(void); 249void imlib_image_orientate(int orientation); 250void imlib_image_blur(int radius); 251void imlib_image_sharpen(int radius); 252void imlib_image_tile_horizontal(void); 253void imlib_image_tile_vertical(void); 254void imlib_image_tile(void); 255 256Imlib_Font imlib_load_font(const char *font_name); 257void imlib_free_font(void); 258int imlib_insert_font_into_fallback_chain(Imlib_Font font, Imlib_Font fallback_font); 259void imlib_remove_font_from_fallback_chain(Imlib_Font fallback_font); 260Imlib_Font imlib_get_prev_font_in_fallback_chain(Imlib_Font fn); 261Imlib_Font imlib_get_next_font_in_fallback_chain(Imlib_Font fn); 262void imlib_text_draw(int x, int y, const char *text); 263void imlib_text_draw_with_return_metrics(int x, int y, const char *text, 264 int *width_return, 265 int *height_return, 266 int *horizontal_advance_return, 267 int *vertical_advance_return); 268void imlib_get_text_size(const char *text, int *width_return, 269 int *height_return); 270void imlib_get_text_advance(const char *text, 271 int *horizontal_advance_return, 272 int *vertical_advance_return); 273int imlib_get_text_inset(const char *text); 274void imlib_add_path_to_font_path(const char *path); 275void imlib_remove_path_from_font_path(const char *path); 276char **imlib_list_font_path(int *number_return); 277int imlib_text_get_index_and_location(const char *text, int x, int y, 278 int *char_x_return, 279 int *char_y_return, 280 int *char_width_return, 281 int *char_height_return); 282void imlib_text_get_location_at_index(const char *text, int index, 283 int *char_x_return, 284 int *char_y_return, 285 int *char_width_return, 286 int *char_height_return); 287char **imlib_list_fonts(int *number_return); 288void imlib_free_font_list(char **font_list, int number); 289int imlib_get_font_cache_size(void); 290void imlib_set_font_cache_size(int bytes); 291void imlib_flush_font_cache(void); 292int imlib_get_font_ascent(void); 293int imlib_get_font_descent(void); 294int imlib_get_maximum_font_ascent(void); 295int imlib_get_maximum_font_descent(void); 296 297Imlib_Color_Modifier imlib_create_color_modifier(void); 298void imlib_free_color_modifier(void); 299void imlib_modify_color_modifier_gamma(double gamma_value); 300void imlib_modify_color_modifier_brightness(double brightness_value); 301void imlib_modify_color_modifier_contrast(double contrast_value); 302void imlib_set_color_modifier_tables(unsigned char * red_table, 303 unsigned char * green_table, 304 unsigned char * blue_table, 305 unsigned char * alpha_table); 306void imlib_get_color_modifier_tables(unsigned char * red_table, 307 unsigned char * green_table, 308 unsigned char * blue_table, 309 unsigned char * alpha_table); 310void imlib_reset_color_modifier(void); 311void imlib_apply_color_modifier(void); 312void imlib_apply_color_modifier_to_rectangle(int x, int y, int width, 313 int height); 314 315Imlib_Updates imlib_image_draw_pixel(int x, int y, char make_updates); 316Imlib_Updates imlib_image_draw_line(int x1, int y1, int x2, int y2, 317 char make_updates); 318void imlib_image_draw_rectangle(int x, int y, int width, int height); 319void imlib_image_fill_rectangle(int x, int y, int width, int height); 320void imlib_image_copy_alpha_to_image(Imlib_Image image_source, int x, 321 int y); 322void imlib_image_copy_alpha_rectangle_to_image(Imlib_Image image_source, 323 int x, int y, int width, 324 int height, 325 int destination_x, 326 int destination_y); 327void imlib_image_scroll_rect(int x, int y, int width, int height, 328 int delta_x, int delta_y); 329void imlib_image_copy_rect(int x, int y, int width, int height, int new_x, 330 int new_y); 331 332ImlibPolygon imlib_polygon_new(void); 333void imlib_polygon_free(ImlibPolygon poly); 334void imlib_polygon_add_point(ImlibPolygon poly, int x, int y); 335void imlib_image_draw_polygon(ImlibPolygon poly, unsigned char closed); 336void imlib_image_fill_polygon(ImlibPolygon poly); 337void imlib_polygon_get_bounds(ImlibPolygon poly, int *px1, int *py1, 338 int *px2, int *py2); 339unsigned char imlib_polygon_contains_point(ImlibPolygon poly, int x, 340 int y); 341 342void imlib_image_draw_ellipse(int xc, int yc, int a, int b); 343void imlib_image_fill_ellipse(int xc, int yc, int a, int b); 344 345Imlib_Color_Range imlib_create_color_range(void); 346void imlib_free_color_range(void); 347void imlib_add_color_to_color_range(int distance_away); 348void imlib_image_fill_color_range_rectangle(int x, int y, int width, 349 int height, double angle); 350void imlib_image_fill_hsva_color_range_rectangle(int x, int y, int width, 351 int height, double angle); 352 353void imlib_image_attach_data_value(const char *key, void *data, int value, 354 Imlib_Data_Destructor_Function 355 destructor_function); 356void *imlib_image_get_attached_data(const char *key); 357int imlib_image_get_attached_value(const char *key); 358void imlib_image_remove_attached_data_value(const char *key); 359void imlib_image_remove_and_free_attached_data_value(const char *key); 360 361void imlib_save_image(const char *filename); 362void imlib_save_image_with_error_return(const char *filename, 363 Imlib_Load_Error * error_return); 364 365Imlib_Image imlib_create_rotated_image(double angle); 366 367void imlib_rotate_image_from_buffer(double angle, 368 Imlib_Image source_image); 369 370void imlib_blend_image_onto_image_at_angle(Imlib_Image source_image, 371 char merge_alpha, int source_x, 372 int source_y, int source_width, 373 int source_height, 374 int destination_x, 375 int destination_y, int angle_x, 376 int angle_y); 377void imlib_blend_image_onto_image_skewed(Imlib_Image source_image, 378 char merge_alpha, int source_x, 379 int source_y, int source_width, 380 int source_height, 381 int destination_x, 382 int destination_y, int h_angle_x, 383 int h_angle_y, int v_angle_x, 384 int v_angle_y); 385void imlib_render_image_on_drawable_skewed(int source_x, int source_y, 386 int source_width, 387 int source_height, 388 int destination_x, 389 int destination_y, 390 int h_angle_x, int h_angle_y, 391 int v_angle_x, int v_angle_y); 392void imlib_render_image_on_drawable_at_angle(int source_x, int source_y, 393 int source_width, 394 int source_height, 395 int destination_x, 396 int destination_y, 397 int angle_x, int angle_y); 398 399void imlib_image_filter(void); 400Imlib_Filter imlib_create_filter(int initsize); 401void imlib_context_set_filter(Imlib_Filter filter); 402Imlib_Filter imlib_context_get_filter(void); 403void imlib_free_filter(void); 404void imlib_filter_set(int xoff, int yoff, int a, int r, int g, int b); 405void imlib_filter_set_alpha(int xoff, int yoff, int a, int r, int g, 406 int b); 407void imlib_filter_set_red(int xoff, int yoff, int a, int r, int g, int b); 408void imlib_filter_set_green(int xoff, int yoff, int a, int r, int g, 409 int b); 410void imlib_filter_set_blue(int xoff, int yoff, int a, int r, int g, int b); 411void imlib_filter_constants(int a, int r, int g, int b); 412void imlib_filter_divisors(int a, int r, int g, int b); 413 414void imlib_image_clear(void); 415void imlib_image_clear_color(int r, int g, int b, int a); 416 417