1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2025-01-27 17:18:33 +00:00

Added support for rending images by way of IMLIB2.

This commit is contained in:
Brenden Matthews 2009-05-17 23:11:22 -06:00
parent ddcc8ceb70
commit 6477962dc9
5 changed files with 11 additions and 7 deletions

View File

@ -1,5 +1,6 @@
2009-05-17
* Added support for the Lua programming language
* Added support for rending images by way of IMLIB2
2009-05-11
* Added arguments to hwmon for value precalculation

View File

@ -1048,7 +1048,7 @@
<option>&lt;path to image&gt; (-p x,y) (-s WxH)</option>
</term>
<listitem>
Renders an image from the path specified using IMLIB2. Takes 2 optional arguments, one being a position, the other an size. Changing the x,y position will move the position of the image, and changing the WxH will scale the image. Example: ${image /home/brenden/cheeseburger.jpg -p 20,20 -s 200x200} will render 'cheeseburger.jpg' at (20,20) scaled to 200x200 pixels.
Renders an image from the path specified using IMLIB2. Takes 2 optional arguments, one being a position, the other an size. Changing the x,y position will move the position of the image, and changing the WxH will scale the image. Example: ${image /home/brenden/cheeseburger.jpg -p 20,20 -s 200x200} will render 'cheeseburger.jpg' at (20,20) scaled to 200x200 pixels. Conky does not make any attempt to adjust the position (or any other formatting) of images, they are just rendered as per the arguments passed. The only reason $image is part of the TEXT section, is to allow for runtime modifications, through $execp $lua_parse, $lua_read_parse, or some other method.
<para></para></listitem>
</varlistentry>

View File

@ -6660,12 +6660,12 @@ static void main_loop(void)
XftDrawSetClip(window.xftdraw, region);
}
#endif
#ifdef IMLIB2
cimlib_render(text_start_x + border_margin, text_start_y + border_margin, window.width, window.height);
#endif /* IMLIB2 */
draw_stuff();
XDestroyRegion(region);
region = XCreateRegion();
#ifdef IMLIB2
cimlib_event_end(text_start_x + border_margin, text_start_y + border_margin, window.width, window.height);
#endif /* IMLIB2 */
}
} else {
#endif /* X11 */

View File

@ -118,7 +118,7 @@ static void cimlib_draw_image(struct image_list_s *cur)
image = imlib_load_image(cur->name);
if (image) {
int w, h;
DBGP("Drawing image '%s'", cur->name);
DBGP("Drawing image '%s' at (%i,%i) scaled to %ix%i", cur->name, cur->x, cur->y, cur->w, cur->h);
imlib_context_set_image(image);
w = imlib_image_get_width();
h = imlib_image_get_height();
@ -141,12 +141,15 @@ static void cimlib_draw_all(void)
}
}
void cimlib_event_end(int x, int y, int width, int height)
void cimlib_render(int x, int y, int width, int height)
{
if (!image_list_start) return; /* are we actually drawing anything? */
/* take all the little rectangles to redraw and merge them into
* something sane for rendering */
buffer = imlib_create_image(width, height);
/* clear our buffer */
imlib_context_set_image(buffer);
imlib_image_clear();
/* we can blend stuff now */
imlib_context_set_blend(1);

View File

@ -27,7 +27,7 @@
void cimlib_add_image(const char *name);
void cimlib_set_cache_size(long size);
void cimlib_init(Display *display, Window drawable, Visual *visual, Colormap colourmap);
void cimlib_event_end(int x, int y, int width, int height);
void cimlib_render(int x, int y, int width, int height);
void cimlib_cleanup(void);
#endif /* _CONKY_IMBLI2_H_ */