/* initialisation function. */ static tvalue im2_init(Display *disp) { Visual *vis; Colormap cm; int depth; imlib_set_cache_size(sequ_config_imlib_cache_size*1048576); imlib_set_color_usage(sequ_config_imlib_color_usage); imlib_context_set_dither(sequ_config_imlib_dither); imlib_context_set_anti_alias(sequ_config_imlib_anti_alias); if(im2_initialized == TRUE) return TRUE; if(!disp) return FALSE; vis = DefaultVisual(disp, DefaultScreen(disp)); depth = DefaultDepth(disp, DefaultScreen(disp)); cm = DefaultColormap(disp, DefaultScreen(disp)); imlib_context_set_display(disp); imlib_context_set_visual(vis); imlib_context_set_colormap(cm); im2_initialized=TRUE; return TRUE; }
/** Draw an image in a drawable * \param dr Drawable * \param x X position * \param y Y position * \param name Path of the image */ static void draw_image(Drawable dr, int x, int y, int w, int h, char *name) { Imlib_Image image; if(!name) return; imlib_set_cache_size(2048 * 1024); imlib_context_set_display(dpy); imlib_context_set_visual(DefaultVisual(dpy, DefaultScreen(dpy))); imlib_context_set_colormap(DefaultColormap(dpy, DefaultScreen(dpy))); imlib_context_set_drawable(dr); image = imlib_load_image(patht(name)); imlib_context_set_image(image); if(w <= 0) w = imlib_image_get_width(); if(h <= 0) h = imlib_image_get_height(); if(image) { imlib_render_image_on_drawable_at_size(x, y, w, h); imlib_free_image(); } else warnx("Can't draw image: '%s'", name); return; }
void R_init_imlib2(struct R_app *app) { imlib_context_set_display(app->display); imlib_context_set_visual(app->visual); imlib_context_set_colormap(app->colormap); imlib_context_set_blend(0); imlib_context_set_mask(0); imlib_set_cache_size(IMLIB2_CACHE_SIZE); imlib_set_font_cache_size(IMLIB2_FONT_CACHE_SIZE); imlib_add_path_to_font_path(RESURRECTION_FONT_SEARCH_PATH "ttf"); return; }
void init_imlib(void) { bg_image = imlib_load_image("/home/matt/gradient.jpg"); /* imlib settings */ imlib_set_cache_size(2048 * 1024); imlib_set_color_usage(128); imlib_context_set_dither(1); imlib_context_set_blend(1); imlib_context_set_display(disp); imlib_context_set_visual(vis); imlib_context_set_colormap(cm); }
int app_init_imlib2(struct R_app *app) { if (app == NULL) { return -1; } imlib_context_set_display(app->display); imlib_context_set_visual(app->visual); imlib_context_set_colormap(app->colormap); imlib_context_set_drawable(app->window->win); imlib_context_set_blend(0); imlib_context_set_mask(0); imlib_set_font_cache_size(1024 * 1024); #if 0 imlib_add_path_to_font_path(RESURRECTION_FONT_SEARCH_PATH "ttf/"); #endif imlib_set_cache_size(4096 * 1024); return 0; }