Drawing.h File Reference

#include <X11/Xlib.h>
#include <X11/Xfuncproto.h>
#include <stdio.h>

Include dependency graph for Drawing.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef unsigned long Pixel

Functions

_XFUNCPROTOBEGIN void XmuDrawRoundedRectangle (Display *dpy, Drawable draw, GC gc, int x, int y, int w, int h, int ew, int eh)
void XmuFillRoundedRectangle (Display *dpy, Drawable draw, GC gc, int x, int y, int w, int h, int ew, int eh)
void XmuDrawLogo (Display *dpy, Drawable drawable, GC gcFore, GC gcBack, int x, int y, unsigned int width, unsigned int height)
Pixmap XmuCreatePixmapFromBitmap (Display *dpy, Drawable d, Pixmap bitmap, unsigned int width, unsigned int height, unsigned int depth, unsigned long fore, unsigned long back)
Pixmap XmuCreateStippledPixmap (Screen *screen, Pixel fore, Pixel back, unsigned int depth)
void XmuReleaseStippledPixmap (Screen *screen, Pixmap pixmap)
Pixmap XmuLocateBitmapFile (Screen *screen, _Xconst char *name, char *srcname_return, int srcnamelen, int *width_return, int *height_return, int *xhot_return, int *yhot_return)
Pixmap XmuLocatePixmapFile (Screen *screen, _Xconst char *name, unsigned long fore, unsigned long back, unsigned int depth, char *srcname_return, int srcnamelen, int *width_return, int *height_return, int *xhot_return, int *yhot_return)
int XmuReadBitmapData (FILE *fstream, unsigned int *width_return, unsigned int *height_return, unsigned char **datap_return, int *xhot_return, int *yhot_return)
int XmuReadBitmapDataFromFile (_Xconst char *filename, unsigned int *width_return, unsigned int *height_return, unsigned char **datap_return, int *xhot_return, int *yhot_return)


Typedef Documentation

typedef unsigned long Pixel

Definition at line 43 of file Drawing.h.


Function Documentation

Pixmap XmuCreatePixmapFromBitmap ( Display *  dpy,
Drawable  d,
Pixmap  bitmap,
unsigned int  width,
unsigned int  height,
unsigned int  depth,
unsigned long  fore,
unsigned long  back 
)

Definition at line 46 of file CrPixFBit.c.

References gc.

00058 {
00059     Pixmap pixmap;
00060 
00061     pixmap = XCreatePixmap (dpy, d, width, height, depth);
00062     if (pixmap != None) {
00063         GC gc;
00064         XGCValues xgcv;
00065 
00066         xgcv.foreground = fore;
00067         xgcv.background = back;
00068         xgcv.graphics_exposures = False;
00069 
00070         gc = XCreateGC (dpy, d,
00071                         (GCForeground | GCBackground | GCGraphicsExposures),
00072                         &xgcv);
00073         if (gc) {
00074             XCopyPlane (dpy, bitmap, pixmap, gc, 0, 0, width, height, 0, 0, 1);
00075             XFreeGC (dpy, gc);
00076         } else {
00077             XFreePixmap (dpy, pixmap);
00078             pixmap = None;
00079         }
00080     }
00081     return pixmap;
00082 }

Pixmap XmuCreateStippledPixmap ( Screen *  screen,
Pixel  fore,
Pixel  back,
unsigned int  depth 
)

Definition at line 72 of file GrayPixmap.c.

References _PixmapCache::background, _PixmapCache::depth, display, _PixmapCache::foreground, _PixmapCache::next, _PixmapCache::pixmap, pixmap_height, pixmap_width, pixmapCache, _PixmapCache::ref_count, and _PixmapCache::screen.

Referenced by ChangeSensitive(), CreateGC(), CreateGCs(), GetGCs(), GetgrayGC(), Realize(), and reset_shadow_gc().

00078 {
00079     register Display *display = DisplayOfScreen(screen);
00080     CacheEntry *cachePtr;
00081     Pixmap stippled_pixmap;
00082     static unsigned char pixmap_bits[] = {
00083         0x02, 0x01,
00084     };
00085 
00086 /*
00087  *      Creates a stippled pixmap of depth DefaultDepth(screen)
00088  *      caches these so that multiple requests share the pixmap
00089  */
00090 
00091 #define pixmap_width 2
00092 #define pixmap_height 2
00093 
00094     /* see if we already have a pixmap suitable for this screen */
00095     for (cachePtr = pixmapCache; cachePtr; cachePtr = cachePtr->next) {
00096         if (cachePtr->screen == screen && cachePtr->foreground == fore &&
00097             cachePtr->background == back && cachePtr->depth == depth)
00098             return( cachePtr->ref_count++, cachePtr->pixmap );
00099     }
00100 
00101     stippled_pixmap = XCreatePixmapFromBitmapData (display,
00102                         RootWindowOfScreen(screen), (char *)pixmap_bits, 
00103                         pixmap_width, pixmap_height, fore, back, depth);
00104 
00105     /* and insert it at the head of the cache */
00106     cachePtr = XtNew(CacheEntry);
00107     cachePtr->screen = screen;
00108     cachePtr->foreground = fore;
00109     cachePtr->background = back;
00110     cachePtr->depth = depth;
00111     cachePtr->pixmap = stippled_pixmap;
00112     cachePtr->ref_count = 1;
00113     cachePtr->next = pixmapCache;
00114     pixmapCache = cachePtr;
00115 
00116     return( stippled_pixmap );
00117 }

Here is the caller graph for this function:

void XmuDrawLogo ( Display *  dpy,
Drawable  drawable,
GC  gcFore,
GC  gcBack,
int  x,
int  y,
unsigned int  width,
unsigned int  height 
)

Definition at line 43 of file DrawLogo.c.

References CoordModeOrigin, and size.

00045 {
00046     unsigned int size;
00047     int thin, gap, d31;
00048     XPoint poly[4];
00049 
00050     XFillRectangle(dpy, drawable, gcBack, x, y, width, height);
00051 
00052     /* for now, do a centered even-sized square, at least for now */
00053     size = width;
00054     if (height < width)
00055          size = height;
00056     size &= ~1;
00057     x += (width - size) >> 1;
00058     y += (height - size) >> 1;
00059 
00060 /*    
00061  * Draw what will be the thin strokes.
00062  *
00063  *           ----- 
00064  *          /    /
00065  *         /    /
00066  *        /    /
00067  *       /    /
00068  *      /____/
00069  *           d
00070  *
00071  * Point d is 9/44 (~1/5) of the way across.
00072  */
00073 
00074     thin = (size / 11);
00075     if (thin < 1) thin = 1;
00076     gap = (thin+3) / 4;
00077     d31 = thin + thin + gap;
00078     poly[0].x = x + size;              poly[0].y = y;
00079     poly[1].x = x + size-d31;          poly[1].y = y;
00080     poly[2].x = x + 0;                 poly[2].y = y + size;
00081     poly[3].x = x + d31;               poly[3].y = y + size;
00082     XFillPolygon(dpy, drawable, gcFore, poly, 4, Convex, CoordModeOrigin);
00083 
00084 /*    
00085  * Erase area not needed for lower thin stroke.
00086  *
00087  *           ------ 
00088  *          /     /
00089  *         /  __ /
00090  *        /  /  /
00091  *       /  /  /
00092  *      /__/__/
00093  */
00094 
00095     poly[0].x = x + d31/2;                       poly[0].y = y + size;
00096     poly[1].x = x + size / 2;                    poly[1].y = y + size/2;
00097     poly[2].x = x + (size/2)+(d31-(d31/2));      poly[2].y = y + size/2;
00098     poly[3].x = x + d31;                         poly[3].y = y + size;
00099     XFillPolygon(dpy, drawable, gcBack, poly, 4, Convex, CoordModeOrigin);
00100 
00101 /*    
00102  * Erase area not needed for upper thin stroke.
00103  *
00104  *           ------ 
00105  *          /  /  /
00106  *         /--/  /
00107  *        /     /
00108  *       /     /
00109  *      /_____/
00110  */
00111 
00112     poly[0].x = x + size - d31/2;                poly[0].y = y;
00113     poly[1].x = x + size / 2;                    poly[1].y = y + size/2;
00114     poly[2].x = x + (size/2)-(d31-(d31/2));      poly[2].y = y + size/2;
00115     poly[3].x = x + size - d31;                  poly[3].y = y;
00116     XFillPolygon(dpy, drawable, gcBack, poly, 4, Convex, CoordModeOrigin);
00117 
00118 /*
00119  * Draw thick stroke.
00120  * Point b is 1/4 of the way across.
00121  *
00122  *      b
00123  * -----
00124  * \    \
00125  *  \    \
00126  *   \    \
00127  *    \    \
00128  *     \____\
00129  */
00130 
00131     poly[0].x = x;                     poly[0].y = y;
00132     poly[1].x = x + size/4;            poly[1].y = y;
00133     poly[2].x = x + size;              poly[2].y = y + size;
00134     poly[3].x = x + size - size/4;     poly[3].y = y + size;
00135     XFillPolygon(dpy, drawable, gcFore, poly, 4, Convex, CoordModeOrigin);
00136 
00137 /*    
00138  * Erase to create gap.
00139  *
00140  *          /
00141  *         /
00142  *        /
00143  *       /
00144  *      /
00145  */
00146 
00147     poly[0].x = x + size- thin;        poly[0].y = y;
00148     poly[1].x = x + size-( thin+gap);  poly[1].y = y;
00149     poly[2].x = x + thin;              poly[2].y = y + size;
00150     poly[3].x = x + thin + gap;        poly[3].y = y + size;
00151     XFillPolygon(dpy, drawable, gcBack, poly, 4, Convex, CoordModeOrigin);
00152 }

_XFUNCPROTOBEGIN void XmuDrawRoundedRectangle ( Display *  dpy,
Drawable  draw,
GC  gc,
int  x,
int  y,
int  w,
int  h,
int  ew,
int  eh 
)

Definition at line 42 of file DrRndRect.c.

00044 {
00045         XArc    arcs[8];
00046   int ew2, eh2;
00047 
00048   if ((ew2 = (ew << 1)) > w)
00049     ew2 = ew = 0;
00050   if ((eh2 = (eh << 1)) > h)
00051     eh2 = eh = 0;
00052 
00053         arcs[0].x = x;
00054         arcs[0].y = y;
00055   arcs[0].width = ew2;
00056   arcs[0].height = eh2;
00057   arcs[0].angle1 = 180 * 64;
00058   arcs[0].angle2 = -90 * 64;
00059 
00060         arcs[1].x = x + ew;
00061         arcs[1].y = y;
00062   arcs[1].width = w - ew2;
00063         arcs[1].height = 0;
00064   arcs[1].angle1 = 180 * 64;
00065   arcs[1].angle2 = -180 * 64;
00066 
00067   arcs[2].x = x + w - ew2;
00068         arcs[2].y = y;
00069   arcs[2].width = ew2;
00070   arcs[2].height = eh2;
00071   arcs[2].angle1 = 90 * 64;
00072   arcs[2].angle2 = -90 * 64;
00073 
00074         arcs[3].x = x + w;
00075         arcs[3].y = y + eh;
00076         arcs[3].width = 0;
00077   arcs[3].height = h - eh2;
00078         arcs[3].angle1 = 90 * 64;
00079   arcs[3].angle2 = -180 * 64;
00080 
00081   arcs[4].x = x + w - ew2;
00082   arcs[4].y = y + h - eh2;
00083   arcs[4].width = ew2;
00084   arcs[4].height = eh2;
00085         arcs[4].angle1 = 0;
00086   arcs[4].angle2 = -90 * 64;
00087 
00088         arcs[5].x = x + ew;
00089         arcs[5].y = y + h;
00090   arcs[5].width = w - ew2;
00091         arcs[5].height = 0;
00092         arcs[5].angle1 = 0;
00093   arcs[5].angle2 = -180 * 64;
00094 
00095         arcs[6].x = x;
00096   arcs[6].y = y + h - eh2;
00097   arcs[6].width = ew2;
00098   arcs[6].height = eh2;
00099   arcs[6].angle1 = 270 * 64;
00100   arcs[6].angle2 = -90 * 64;
00101 
00102         arcs[7].x = x;
00103         arcs[7].y = y + eh;
00104         arcs[7].width = 0;
00105   arcs[7].height = h - eh2;
00106   arcs[7].angle1 = 270 * 64;
00107   arcs[7].angle2 = -180 * 64;
00108 
00109   XDrawArcs(dpy, draw, gc, arcs, 8);
00110 }

void XmuFillRoundedRectangle ( Display *  dpy,
Drawable  draw,
GC  gc,
int  x,
int  y,
int  w,
int  h,
int  ew,
int  eh 
)

Definition at line 113 of file DrRndRect.c.

Referenced by ShapeEllipseOrRoundedRectangle().

00115 {
00116         XArc    arcs[4];
00117         XRectangle rects[3];
00118         XGCValues vals;
00119   int ew2, eh2;
00120 
00121         XGetGCValues(dpy, gc, GCArcMode, &vals);
00122         if (vals.arc_mode != ArcPieSlice)
00123             XSetArcMode(dpy, gc, ArcPieSlice);
00124 
00125   if ((ew2 = (ew << 1)) > w)
00126     ew2 = ew = 0;
00127   if ((eh2 = (eh << 1)) > h)
00128     eh2 = eh = 0;
00129 
00130         arcs[0].x = x;
00131         arcs[0].y = y;
00132   arcs[0].width = ew2;
00133   arcs[0].height = eh2;
00134   arcs[0].angle1 = 180 * 64;
00135   arcs[0].angle2 = -90 * 64;
00136 
00137   arcs[1].x = x + w - ew2 - 1;
00138         arcs[1].y = y;
00139   arcs[1].width = ew2;
00140   arcs[1].height = eh2;
00141   arcs[1].angle1 = 90 * 64;
00142   arcs[1].angle2 = -90 * 64;
00143 
00144   arcs[2].x = x + w - ew2 - 1;
00145   arcs[2].y = y + h - eh2 - 1;
00146   arcs[2].width = ew2;
00147   arcs[2].height = eh2;
00148         arcs[2].angle1 = 0;
00149   arcs[2].angle2 = -90 * 64;
00150 
00151         arcs[3].x = x;
00152   arcs[3].y = y + h - eh2 - 1;
00153   arcs[3].width = ew2;
00154   arcs[3].height = eh2;
00155   arcs[3].angle1 = 270 * 64;
00156   arcs[3].angle2 = -90 * 64;
00157 
00158   XFillArcs(dpy, draw, gc, arcs, 4);
00159 
00160         rects[0].x = x + ew;
00161         rects[0].y = y;
00162   rects[0].width = w - ew2;
00163         rects[0].height = h;
00164 
00165         rects[1].x = x;
00166         rects[1].y = y + eh;
00167         rects[1].width = ew;
00168   rects[1].height = h - eh2;
00169 
00170         rects[2].x = x + w - ew;
00171         rects[2].y = y + eh;
00172         rects[2].width = ew;
00173   rects[2].height = h - eh2;
00174 
00175   XFillRectangles(dpy, draw, gc, rects, 3);
00176 
00177         if (vals.arc_mode != ArcPieSlice)
00178             XSetArcMode(dpy, gc, vals.arc_mode);
00179 }

Here is the caller graph for this function:

Pixmap XmuLocateBitmapFile ( Screen *  screen,
_Xconst char *  name,
char *  srcname_return,
int  srcnamelen,
int width_return,
int height_return,
int xhot_return,
int yhot_return 
)

Definition at line 77 of file LocBitmap.c.

References XmuLocatePixmapFile().

Referenced by XmuCvtStringToBitmap().

00080 {
00081     return XmuLocatePixmapFile (screen, name, 
00082                                 (unsigned long) 1, (unsigned long) 0,
00083                                 (unsigned int) 1, srcname, srcnamelen,
00084                                 widthp, heightp, xhotp, yhotp);
00085 }

Here is the call graph for this function:

Here is the caller graph for this function:

Pixmap XmuLocatePixmapFile ( Screen *  screen,
_Xconst char *  name,
unsigned long  fore,
unsigned long  back,
unsigned int  depth,
char *  srcname_return,
int  srcnamelen,
int width_return,
int height_return,
int xhot_return,
int yhot_return 
)

Definition at line 92 of file LocBitmap.c.

References _XmuCCLookupDisplay(), BITMAPDIR, _XmuCvtCache::bitmapFilePath, data, dpy, filename, height, i, int, NULL, PATH_MAX, root, split_path_string(), _XmuCvtCache::string_to_bitmap, value, void(), width, XmuReadBitmapDataFromFile(), and XmuSnprintf().

Referenced by XmuLocateBitmapFile().

00097 {
00098 
00099 #ifndef BITMAPDIR
00100 #define BITMAPDIR "/usr/include/X11/bitmaps"
00101 #endif
00102 
00103     Display *dpy = DisplayOfScreen (screen);
00104     Window root = RootWindowOfScreen (screen);
00105     Bool try_plain_name = True;
00106     XmuCvtCache *cache = _XmuCCLookupDisplay (dpy);
00107     char **file_paths = (char **) NULL;
00108     char filename[PATH_MAX];
00109 #if 0
00110     char* bitmapdir = BITMAPDIR;
00111 #endif
00112     unsigned int width, height;
00113     int xhot, yhot;
00114     int i;
00115 
00116     /*
00117      * look in cache for bitmap path
00118      */
00119     if (cache) {
00120         if (!cache->string_to_bitmap.bitmapFilePath) {
00121             XrmName xrm_name[2];
00122             XrmClass xrm_class[2];
00123             XrmRepresentation rep_type;
00124             XrmValue value;
00125 
00126             xrm_name[0] = XrmPermStringToQuark ("bitmapFilePath");
00127             xrm_name[1] = NULLQUARK;
00128             xrm_class[0] = XrmPermStringToQuark ("BitmapFilePath");
00129             xrm_class[1] = NULLQUARK;
00130             if (!XrmGetDatabase(dpy)) {
00131                 /* what a hack; need to initialize it */
00132                 (void) XGetDefault (dpy, "", "");
00133             }
00134             if (XrmQGetResource (XrmGetDatabase(dpy), xrm_name, xrm_class, 
00135                                  &rep_type, &value) &&
00136                 rep_type == XrmPermStringToQuark("String")) {
00137                 cache->string_to_bitmap.bitmapFilePath = 
00138                   split_path_string (value.addr);
00139             }
00140         }
00141         file_paths = cache->string_to_bitmap.bitmapFilePath;
00142     }
00143 
00144     /*
00145      * Search order:
00146      *    1.  name if it begins with / or ./
00147      *    2.  "each prefix in file_paths"/name
00148      *    3.  BITMAPDIR/name
00149      *    4.  name if didn't begin with / or .
00150      */
00151 
00152     for (i = 1; i <= 4; i++) {
00153         char *fn = filename;
00154         Pixmap pixmap;
00155         unsigned char *data;
00156 
00157         switch (i) {
00158           case 1:
00159 #ifndef __UNIXOS2__
00160             if (!(name[0] == '/' || ((name[0] == '.') && name[1] == '/')))
00161 #else
00162             if (!(name[0] == '/' || (name[0] == '.' && name[1] == '/') ||
00163                   (isalpha(name[0]) && name[1] == ':')))
00164 #endif
00165               continue;
00166             fn = (char *) name;
00167             try_plain_name = False;
00168             break;
00169           case 2:
00170             if (file_paths && *file_paths) {
00171                 XmuSnprintf(filename, sizeof(filename),
00172                             "%s/%s", *file_paths, name);
00173                 file_paths++;
00174                 i--;
00175                 break;
00176             }
00177             continue;
00178           case 3:
00179             XmuSnprintf(filename, sizeof(filename), "%s/%s", BITMAPDIR, name);
00180             break;
00181           case 4:
00182             if (!try_plain_name) continue;
00183             fn = (char *) name;
00184             break;
00185         }
00186 
00187         data = NULL;
00188         pixmap = None;
00189 #ifdef __UNIXOS2__
00190         fn = (char*)__XOS2RedirRoot(fn);
00191 #endif
00192         if (XmuReadBitmapDataFromFile (fn, &width, &height, &data,
00193                                        &xhot, &yhot) == BitmapSuccess) {
00194             pixmap = XCreatePixmapFromBitmapData (dpy, root, (char *) data,
00195                                                   width, height,
00196                                                   fore, back, depth);
00197             XFree ((char *)data);
00198         }
00199 
00200         if (pixmap) {
00201             if (widthp) *widthp = (int)width;
00202             if (heightp) *heightp = (int)height;
00203             if (xhotp) *xhotp = xhot;
00204             if (yhotp) *yhotp = yhot;
00205             if (srcname && srcnamelen > 0) {
00206                 strncpy (srcname, fn, srcnamelen - 1);
00207                 srcname[srcnamelen - 1] = '\0';
00208             }
00209             return pixmap;
00210         }
00211     }
00212 
00213     return None;
00214 }

Here is the call graph for this function:

Here is the caller graph for this function:

int XmuReadBitmapData ( FILE *  fstream,
unsigned int width_return,
unsigned int height_return,
unsigned char **  datap_return,
int xhot_return,
int yhot_return 
)

Definition at line 146 of file RdBitF.c.

References data, initHexTable(), initialized, int, line, MAX_SIZE, NextInt(), NULL, RETURN, size, type, value, and Xmalloc.

Referenced by XmuReadBitmapDataFromFile().

00148 {
00149     unsigned char *data = NULL;         /* working variable */
00150     char line[MAX_SIZE];                /* input line from file */
00151     int size;                           /* number of bytes of data */
00152     char name_and_type[MAX_SIZE];       /* an input line */
00153     char *type;                         /* for parsing */
00154     int value;                          /* from an input line */
00155     int version10p;                     /* boolean, old format */
00156     int padding;                        /* to handle alignment */
00157     int bytes_per_line;                 /* per scanline of data */
00158     unsigned int ww = 0;                /* width */
00159     unsigned int hh = 0;                /* height */
00160     int hx = -1;                        /* x hotspot */
00161     int hy = -1;                        /* y hotspot */
00162 
00163 #undef  Xmalloc /* see MALLOC_0_RETURNS_NULL in Xlibint.h */
00164 #define Xmalloc(size) malloc(size)
00165 
00166     /* first time initialization */
00167     if (initialized == False) initHexTable();
00168 
00169     /* error cleanup and return macro   */
00170 #define RETURN(code) { if (data) free (data); return code; }
00171 
00172     while (fgets(line, MAX_SIZE, fstream)) {
00173         if (strlen(line) == MAX_SIZE-1) {
00174             RETURN (BitmapFileInvalid);
00175         }
00176         if (sscanf(line,"#define %s %d",name_and_type,&value) == 2) {
00177             if (!(type = strrchr(name_and_type, '_')))
00178               type = name_and_type;
00179             else
00180               type++;
00181 
00182             if (!strcmp("width", type))
00183               ww = (unsigned int) value;
00184             if (!strcmp("height", type))
00185               hh = (unsigned int) value;
00186             if (!strcmp("hot", type)) {
00187                 if (type-- == name_and_type || type-- == name_and_type)
00188                   continue;
00189                 if (!strcmp("x_hot", type))
00190                   hx = value;
00191                 if (!strcmp("y_hot", type))
00192                   hy = value;
00193             }
00194             continue;
00195         }
00196     
00197         if (sscanf(line, "static short %s = {", name_and_type) == 1)
00198           version10p = 1;
00199         else if (sscanf(line,"static unsigned char %s = {",name_and_type) == 1)
00200           version10p = 0;
00201         else if (sscanf(line, "static char %s = {", name_and_type) == 1)
00202           version10p = 0;
00203         else
00204           continue;
00205 
00206         if (!(type = strrchr(name_and_type, '_')))
00207           type = name_and_type;
00208         else
00209           type++;
00210 
00211         if (strcmp("bits[]", type))
00212           continue;
00213     
00214         if (!ww || !hh)
00215           RETURN (BitmapFileInvalid);
00216 
00217         if ((ww % 16) && ((ww % 16) < 9) && version10p)
00218           padding = 1;
00219         else
00220           padding = 0;
00221 
00222         bytes_per_line = (ww+7)/8 + padding;
00223 
00224         size = bytes_per_line * hh;
00225         data = (unsigned char *) Xmalloc ((unsigned int) size);
00226         if (!data) 
00227           RETURN (BitmapNoMemory);
00228 
00229         if (version10p) {
00230             unsigned char *ptr;
00231             int bytes;
00232 
00233             for (bytes=0, ptr=data; bytes<size; (bytes += 2)) {
00234                 if ((value = NextInt(fstream)) < 0)
00235                   RETURN (BitmapFileInvalid);
00236                 *(ptr++) = value;
00237                 if (!padding || ((bytes+2) % bytes_per_line))
00238                   *(ptr++) = value >> 8;
00239             }
00240         } else {
00241             unsigned char *ptr;
00242             int bytes;
00243 
00244             for (bytes=0, ptr=data; bytes<size; bytes++, ptr++) {
00245                 if ((value = NextInt(fstream)) < 0) 
00246                   RETURN (BitmapFileInvalid);
00247                 *ptr=value;
00248             }
00249         }
00250         break;
00251     }                                   /* end while */
00252 
00253     if (data == NULL) {
00254         RETURN (BitmapFileInvalid);
00255     }
00256 
00257     *datap = data;
00258     data = NULL;
00259     *width = ww;
00260     *height = hh;
00261     if (x_hot) *x_hot = hx;
00262     if (y_hot) *y_hot = hy;
00263 
00264     RETURN (BitmapSuccess);
00265 }

Here is the call graph for this function:

Here is the caller graph for this function:

int XmuReadBitmapDataFromFile ( _Xconst char *  filename,
unsigned int width_return,
unsigned int height_return,
unsigned char **  datap_return,
int xhot_return,
int yhot_return 
)

Definition at line 382 of file RdBitF.c.

References fopen_file, NULL, and XmuReadBitmapData().

Referenced by XmuCvtStringToBitmap(), and XmuLocatePixmapFile().

00385 {
00386     FILE *fstream;
00387     int status;
00388 
00389 #ifdef __UNIXOS2__
00390     filename = __XOS2RedirRoot(filename);
00391 #endif
00392     if ((fstream = fopen_file (filename, "r")) == NULL) {
00393         return BitmapOpenFailed;
00394     }
00395     status = XmuReadBitmapData(fstream, width, height, datap, x_hot, y_hot);
00396     fclose (fstream);
00397     return status;
00398 }

Here is the call graph for this function:

Here is the caller graph for this function:

void XmuReleaseStippledPixmap ( Screen *  screen,
Pixmap  pixmap 
)

Definition at line 120 of file GrayPixmap.c.

References display, _PixmapCache::next, _PixmapCache::pixmap, pixmapCache, _PixmapCache::ref_count, and _PixmapCache::screen.

Referenced by Destroy(), and SetValues().

00121 {
00122     register Display *display = DisplayOfScreen(screen);
00123     CacheEntry *cachePtr, **prevP;
00124     for (prevP = &pixmapCache, cachePtr = pixmapCache; cachePtr;) {
00125         if (cachePtr->screen == screen && cachePtr->pixmap == pixmap) {
00126             if (--cachePtr->ref_count == 0) {
00127                 XFreePixmap( display, pixmap );
00128                 *prevP = cachePtr->next;
00129                 XtFree( (char*)cachePtr );
00130                 break;
00131             }
00132         }
00133         prevP = &cachePtr->next;
00134         cachePtr = *prevP;
00135     }
00136 }

Here is the caller graph for this function:


Generated on Sun Mar 4 16:03:50 2007 for Scilab [trunk] by  doxygen 1.5.1