JWM Source Documentation
Macros | Functions
image.c File Reference

Functions to load images. More...

#include "jwm.h"
#include <X11/xpm.h>
#include "image.h"
#include "main.h"
#include "error.h"
#include "color.h"
#include "misc.h"

Go to the source code of this file.

Macros

#define HASH_SIZE   16
 Load an XBM image from the specified file.
 

Functions

static ImageNodeLoadPNGImage (const char *fileName)
 Load a PNG image from the given file name.
 
static ImageNodeLoadXPMImage (const char *fileName)
 Load a JPEG image from the specified file.
 
static ImageNodeCreateImageFromXImages (XImage *image, XImage *shape)
 
static int AllocateColor (Display *d, Colormap cmap, char *name, XColor *c, void *closure)
 Callback to allocate a color for libxpm.
 
static int FreeColors (Display *d, Colormap cmap, Pixel *pixels, int n, void *closure)
 Callback to free colors allocated by libxpm.
 
ImageNodeLoadImage (const char *fileName, int width, int height, char preserveAspect)
 Load an image from the specified file.
 
ImageNodeLoadImageFromDrawable (Drawable pmap, Pixmap mask)
 Load an image from a pixmap.
 
ImageNodeCreateImage (unsigned width, unsigned height, char bitmap)
 
void DestroyImage (ImageNode *image)
 Destroy an image node.
 

Detailed Description

Functions to load images.

Author
Joe Wingbermuehle
Date
2005-2007

Definition in file image.c.

Macro Definition Documentation

#define HASH_SIZE   16

Load an XBM image from the specified file.

Create an image from XImages giving color and shape information.

Definition at line 564 of file image.c.

Referenced by CreateImageFromXImages().

Function Documentation

int AllocateColor ( Display *  d,
Colormap  cmap,
char *  name,
XColor *  c,
void *  closure 
)
static

Callback to allocate a color for libxpm.

Definition at line 636 of file image.c.

References GetColor(), and JXParseColor.

Referenced by LoadXPMImage().

ImageNode* CreateImage ( unsigned  width,
unsigned  height,
char  bitmap 
)
ImageNode * CreateImageFromXImages ( XImage *  image,
XImage *  shape 
)
static

Definition at line 565 of file image.c.

References colors, CreateImage(), ImageNode::data, dest, display, HASH_SIZE, JXQueryColor, and rootColormap.

Referenced by LoadImageFromDrawable(), and LoadXPMImage().

void DestroyImage ( ImageNode image)

Destroy an image node.

Definition at line 623 of file image.c.

References ImageNode::data, ImageNode::next, and Release.

Referenced by DoDestroyIcon(), GetScaledIcon(), LoadNamedIcon(), LoadNamedIconHelper(), and LoadPNGImage().

int FreeColors ( Display *  d,
Colormap  cmap,
Pixel *  pixels,
int  n,
void *  closure 
)
static

Callback to free colors allocated by libxpm.

We don't need to do anything here since color.c takes care of this.

Definition at line 654 of file image.c.

Referenced by LoadXPMImage().

ImageNode* LoadImage ( const char *  fileName,
int  width,
int  height,
char  preserveAspect 
)

Load an image from the specified file.

Load an image from a file.

Definition at line 67 of file image.c.

References JUNLIKELY, LoadPNGImage(), LoadXPMImage(), and StrCmpNoCase().

Referenced by GetBestImage(), LoadNamedIcon(), and LoadNamedIconHelper().

ImageNode* LoadImageFromDrawable ( Drawable  pmap,
Pixmap  mask 
)

Load an image from a pixmap.

Load an image from a Drawable.

Definition at line 146 of file image.c.

References CreateImageFromXImages(), display, IconNode::height, JXDestroyImage, JXGetGeometry, JXGetImage, and IconNode::width.

Referenced by CreateIconFromDrawable().

ImageNode * LoadPNGImage ( const char *  fileName)
static

Load a PNG image from the given file name.

Since libpng uses longjmp, this function is not reentrant to simplify the issues surrounding longjmp and local variables.

Definition at line 180 of file image.c.

References _, AllocateStack, Assert, CreateImage(), ImageNode::data, DestroyImage(), ImageNode::height, IconNode::height, JUNLIKELY, ReleaseStack, Warning(), and IconNode::width.

Referenced by LoadImage().

ImageNode * LoadXPMImage ( const char *  fileName)
static

Load a JPEG image from the specified file.

Load an XPM image from the specified file.

Definition at line 511 of file image.c.

References AllocateColor(), Assert, CreateImageFromXImages(), display, FreeColors(), and JXDestroyImage.

Referenced by LoadImage().

joewing.net / Projects / JWM