Commit Graph

52 Commits

Author SHA1 Message Date
Roman Kosenko 4bdc716d8a Fix image cropping/enlarging
Function imlib_create_cropped_image() from imlib2 doesn't initialize
buffer for new image, so if we use crop bounds bigger than original ones
we need to erase garbage from derived image.
This bug produced colorful pressed buttons (FS#516, FS#822).

Signed-off-by: Roman Kosenko <madkite@gmail.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-27 11:14:18 +02:00
Julien Danjou f8984fc503 image: load with image
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-12-14 10:27:15 +01:00
Julien Danjou 4b622523eb image: Use imlib2's image cache
This makes imlib add images loaded from files to its image cache again. That way
we avoid loading the same image again and again (e.g. if you cycle through the
list layouts all the layout icons are loaded).

To not reintroduce FS#651 (fixed in 2dadce9b), we call
imlib_image_set_changes_on_disk(). This causes two stat() calls if the same file
is loaded again to check if the file's timestamps changed which is still less
expensive than loading the whole image again.

Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-12-14 10:24:08 +01:00
Julien Danjou 2dadce9bdb image: load image without cache (FS#651)
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-10-07 19:54:00 +02:00
Uli Schlachter 2d15a67f25 Image: Allow objects to be drawn outside of the image
At least for circles it's really useful to be allowed to draw a circle which is
only partly inside the image. For the other drawing functions there should be no
reason why this shouldn't be allowed.

Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-09-27 16:00:58 +02:00
Uli Schlachter 8165a3b483 image: Fix a memleak
Before this patch, this code allocated a buffer and then created an imlib image
from this via imlib_create_using_copied_data(), but this function does not take
ownership of the buffer you pass in and thus we had a memory leak.

This is fixed by using a separate function for creating "empty" images which
doesn't have this memory leak problem.

This patch was verified using a quick valgrind run and seemed to be fine.

Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-09-26 13:20:00 +02:00
Julien Danjou b2297fda46 globalconf: remove config.h include
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-09-07 17:28:55 +02:00
Julien Danjou 5b718cdacb structs: rename to globalconf
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-09-07 17:23:01 +02:00
Brian Gianforcaro 3145e3145e Grammar/spelling corrections in comments and docs.
Signed-off-by: Brian Gianforcaro <b.gianfo@gmail.com>
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-08-31 10:39:36 +02:00
Uli Schlachter c0661abc61 image.argb32(): Check for zero height or width
This makes image.argb32() fail in a better way if it is called with a zero size.

Bug found by anrxc and reported a FS#597 and FS#599.

Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-08-27 11:04:09 +02:00
Julien Danjou 4d0a025f51 luaclass: add handling of {new,}index of missing properties (FS#584)
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-08-21 15:30:48 +02:00
Julien Danjou a916f2cd55 image: port to new class system
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-08-21 15:30:47 +02:00
Julien Danjou dc61d258f0 luaclass: optimize type handling
We use lua_class_t pointer as key in the registry to store metatable we
will compare.
lauxlib uses a string, which sucks, because it forces to do a
pushliteral() each time you want to get a metatable from the registry,
which is slower.

Signed-off-by: Julien Danjou <julien@danjou.info>
2009-08-21 15:30:47 +02:00
Julien Danjou 047d04d438 luaobject: import __tostring as object meta function
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-07-29 16:09:14 +02:00
Julien Danjou c1d99f0960 luaobject: emit signal on new object
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-07-29 15:48:18 +02:00
Julien Danjou dea2b6303a luaobject: import signals meta methods in objects
Signed-off-by: Julien Danjou <julien@danjou.info>

Conflicts:
2009-07-29 15:48:18 +02:00
Uli Schlachter 154d3a0d4a Add image_to_1bit_pixmap()
This function converts an image_t into a 1bit pixmap.

Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-07-27 14:23:59 +02:00
Brian Gianforcaro 404ec8eb24 Fix doxygen generation warnings.
Signed-off-by: Brian Gianforcaro <b.gianfo@gmail.com>
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-07-27 11:18:43 +02:00
Julien Danjou c95ba76d2f luaobject: use object header and standard gc everywhere
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-06-16 16:26:45 +02:00
Uli Schlachter d62b75679a image: Remove some code duplication
Only the indices are different between the big / little endian versions of this
loop, so just move the indices into local variables and we are done.

Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-06-10 11:39:12 +02:00
Julien Danjou 45c2ac38a4 image: only compute when needed
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-06-04 17:23:17 +02:00
Julien Danjou 908ba16cf9 image: add draw_rectangle_gradient()
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-06-04 17:22:55 +02:00
Gregor Best 88dd246537 image: add insert function to combine two images
Signed-off-by: Gregor Best <farhaven@googlemail.com>
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-06-04 17:22:51 +02:00
Julien Danjou 43902aed69 luaa: fix memory leak in __gc
We need to wipe the ref_array.

Signed-off-by: Julien Danjou <julien@danjou.info>
2009-05-08 09:53:20 +02:00
Julien Danjou 5344818677 image: fix new() documentation
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-05-07 20:24:46 +02:00
Julien Danjou 8828d629f4 image: do not return update
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-05-07 15:15:27 +02:00
Julien Danjou 024ee30fe5 image: move empty creation
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-05-04 10:49:45 +02:00
Julien Danjou 14b090e566 image: fix conversion on different endianness (FS#504)
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-04-27 12:09:04 +02:00
Uli Schlachter d19d679f2a Make the image code use color instead of xcolor
Signed-off-by: Uli Schlachter <psychon@znc.in>
2009-04-18 14:02:21 +02:00
Julien Danjou f473a107b0 cleanup #includes
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-04-17 16:52:25 +02:00
Gregor Best ece9eb8874 image: export drawing routines to lua
Signed-off-by: Gregor Best <farhaven@googlemail.com>
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-04-16 18:46:54 +02:00
Gregor Best 4431d67679 image: initialize new images
Signed-off-by: Gregor Best <farhaven@googlemail.com>
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-04-16 18:46:54 +02:00
Julien Danjou 541d4f565f image: use new object system
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-04-12 15:11:32 +02:00
Julien Danjou 301affeaed image: cleanup header declaration
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-04-11 11:50:55 +02:00
Uli Schlachter 95457c5ab7 Move the definition of globalconf into a header file
Pretty much every single source file needs this struct, so it makes sense to
define it in a common header instead of in every single .c file.

Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-04-10 16:32:42 +02:00
Julien Danjou c8b17808ef image: realloc rather than delete/new
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-12-29 15:39:31 +01:00
Julien Danjou 48d4c41ed9 image: add save method
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-12-29 15:19:01 +01:00
Julien Danjou e7db0a58ee image: set alpha when creating ARGB32 image
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-12-18 17:39:41 +01:00
Julien Danjou 8a43415c0c image: add alpha property
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-12-18 15:18:47 +01:00
Julien Danjou b0d5d7dbef image: add orientate() method
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-12-16 16:45:24 +01:00
Julien Danjou 0288e227ee image: copy data before using it
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-12-16 16:44:25 +01:00
Julien Danjou 5f0e651ede image: check image width and height
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-11-09 15:54:21 +01:00
Julien Danjou 566c5e8639 image: allow empty image creation
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-11-05 13:38:11 +01:00
Julien Danjou 85c7bf07c9 luaa: merge tostring() with DO_LUA_NEW
Also use the same format as standard Lua for tostring output.

Signed-off-by: Julien Danjou <julien@danjou.info>
2008-10-26 16:15:49 +01:00
Julien Danjou 183f372626 image: add argb32() method
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-10-22 20:57:27 +02:00
Julien Danjou 5e96e21c2c image: add width and height attributes
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-10-21 18:29:35 +02:00
Julien Danjou 6ee617e777 image: add crop_and_scale() method
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-10-14 17:37:39 +02:00
Julien Danjou 8c23043cae image: add rotate and crop methods
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-09-22 11:11:55 +02:00
Julien Danjou c8f58d7868 image: add function to create from argb32 data
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-09-22 11:11:55 +02:00
Julien Danjou 6ac0c4130c image: merge draw_image_t and image_t
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-09-22 11:11:55 +02:00