new api bits :)

SVN revision: 31
This commit is contained in:
Carsten Haitzler 1999-08-05 05:27:39 +00:00
parent 2553ba9c0d
commit f58f8f260d
3 changed files with 93 additions and 14 deletions

59
api.c
View File

@ -69,27 +69,50 @@ imlib_load_image_immediately(char *file)
__imlib_LoadImage(file, NULL, 0, 1, 0);
}
Imlib_Image imlib_load_image_without_cache(char *file)
Imlib_Image
imlib_load_image_without_cache(char *file)
{
return (Imlib_Image)
__imlib_LoadImage(file, NULL, 0, 0, 1);
}
Imlib_Image imlib_load_image_with_progress_callback_without_cache (char *file,
Imlib_Progress_Function progress_function,
char progress_granulatiy)
Imlib_Image
imlib_load_image_with_progress_callback_without_cache (char *file,
Imlib_Progress_Function progress_function,
char progress_granulatiy)
{
return (Imlib_Image)
__imlib_LoadImage(file, (Imlib_Internal_Progress_Function)progress_function, progress_granulatiy, 0, 1);
}
Imlib_Image imlib_load_image_immediately_without_cache(char *file)
Imlib_Image
imlib_load_image_immediately_without_cache(char *file)
{
return (Imlib_Image)
__imlib_LoadImage(file, NULL, 0, 1, 1);
}
int imlib_get_image_width(Imlib_Image image)
void
imlib_free_image(Imlib_Image image)
{
ImlibImage *im;
CAST_IMAGE(im, image);
__imlib_FreeImage(im);
}
void
imlib_free_image_and_decache(Imlib_Image image)
{
ImlibImage *im;
CAST_IMAGE(im, image);
SET_FLAG(im->flags, F_INVALID);
__imlib_FreeImage(im);
}
int
imlib_get_image_width(Imlib_Image image)
{
ImlibImage *im;
@ -97,7 +120,8 @@ int imlib_get_image_width(Imlib_Image image)
return im->w;
}
int imlib_get_image_height(Imlib_Image image)
int
imlib_get_image_height(Imlib_Image image)
{
ImlibImage *im;
@ -105,7 +129,8 @@ int imlib_get_image_height(Imlib_Image image)
return im->h;
}
DATA32 *imlib_get_image_data(Imlib_Image image)
DATA32 *
imlib_get_image_data(Imlib_Image image)
{
ImlibImage *im;
@ -117,7 +142,8 @@ DATA32 *imlib_get_image_data(Imlib_Image image)
return im->data;
}
void imlib_put_back_image_data(Imlib_Image image)
void
imlib_put_back_image_data(Imlib_Image image)
{
ImlibImage *im;
@ -126,7 +152,8 @@ void imlib_put_back_image_data(Imlib_Image image)
__imlib_DirtyPixmapsForImage(im);
}
char imlib_image_has_alpha(Imlib_Image image)
char
imlib_image_has_alpha(Imlib_Image image)
{
ImlibImage *im;
@ -136,7 +163,8 @@ char imlib_image_has_alpha(Imlib_Image image)
return 0;
}
void imlib_set_image_never_changes_on_disk(Imlib_Image image)
void
imlib_set_image_never_changes_on_disk(Imlib_Image image)
{
ImlibImage *im;
@ -144,7 +172,8 @@ void imlib_set_image_never_changes_on_disk(Imlib_Image image)
UNSET_FLAG(im->flags, F_ALWAYS_CHECK_DISK);
}
void imlib_image_get_border(Imlib_Image image, Imlib_Border *border)
void
imlib_image_get_border(Imlib_Image image, Imlib_Border *border)
{
ImlibImage *im;
@ -155,7 +184,8 @@ void imlib_image_get_border(Imlib_Image image, Imlib_Border *border)
border->bottom = im->border.bottom;
}
void imlib_image_set_border(Imlib_Image image, Imlib_Border *border)
void
imlib_image_set_border(Imlib_Image image, Imlib_Border *border)
{
ImlibImage *im;
@ -172,7 +202,8 @@ void imlib_image_set_border(Imlib_Image image, Imlib_Border *border)
__imlib_DirtyPixmapsForImage(im);
}
char *imlib_image_format(Imlib_Image image)
char *
imlib_image_format(Imlib_Image image)
{
ImlibImage *im;

22
api.h
View File

@ -39,6 +39,10 @@ Imlib_Image imlib_load_image_with_progress_callback_without_cache (char *file,
char progress_granulatiy);
Imlib_Image imlib_load_image_immediately_without_cache(char *file);
/* image destruction functions */
void imlib_free_image(Imlib_Image image);
void imlib_free_image_and_decache(Imlib_Image image);
/* image information retrieval and basic manipulation functions */
int imlib_get_image_width(Imlib_Image image);
int imlib_get_image_height(Imlib_Image image);
@ -50,5 +54,23 @@ void imlib_image_get_border(Imlib_Image image, Imlib_Border *border);
void imlib_image_set_border(Imlib_Image image, Imlib_Border *border);
char *imlib_image_format(Imlib_Image image);
void imlib_render_pixmaps_for_whole_image(Imlib_Image image, Display *display,
Drawable drawable, Visual *visual,
Colormap colormap, int depth,
Pixmap *pixmap_return,
Pixmap *mask_return,
char anti_aliased_scaling,
char dithered_rendering,
char create_dithered_mask);
void imlib_render_pixmaps_for_whole_image_at_size(Imlib_Image image, Display *display,
Drawable drawable, Visual *visual,
Colormap colormap, int depth,
Pixmap *pixmap_return,
Pixmap *mask_return,
char anti_aliased_scaling,
char dithered_rendering,
char create_dithered_mask,
int width, int height);
void imlib_render_image_onto_drawable
/* image drawing/rendering functions */
#endif

26
image.c
View File

@ -170,6 +170,19 @@ __imlib_CleanupImageCache(void)
char operation = 1;
current_cache = __imlib_CurrentCacheSize();
im_last = NULL;
im = images;
while(im)
{
im_last = im;
im = im->next;
if ((im_last->references <= 0) &&
(IMAGE_IS_VALID(im_last)))
{
__imlib_RemoveImageFromCache(im_last);
__imlib_ConsumeImage(im_last);
}
}
while ((current_cache > cache_size) || (operation));
{
im_last = NULL;
@ -293,6 +306,19 @@ __imlib_CleanupImagePixmapCache()
char operation = 1;
current_cache = __imlib_CurrentCacheSize();
ip_last = NULL;
ip = pixmaps;
while(ip)
{
ip_last = ip;
ip = ip->next;
if ((ip_last->references <= 0) &&
(ip_last->dirty))
{
__imlib_RemoveImagePixmapFromCache(ip_last);
__imlib_ConsumeImagePixmap(ip_last);
}
}
while ((current_cache > cache_size) || (operation));
{
ip_last = NULL;