49 #ifndef _PIXMAP_HELPER_H_ 50 #define _PIXMAP_HELPER_H_ 59 #define ID_ICON_FIRST 101 60 #define ID_APPLICATION 101 61 #define ID_ICON_OK 102 62 #define ID_ICON_STOP 103 63 #define ID_ICON_WARN 104 64 #define ID_ICON_WHAT 105 65 #define ID_ICON_QUESTION 105 66 #define ID_ICON_SPLAT 106 67 #define ID_ICON_ASTERISK 106 68 #define ID_ICON_BANG 107 69 #define ID_ICON_TRIANGLE 108 70 #define ID_ICON_WHAT_BOLD 109 71 #define ID_ICON_WTF 110 72 #define ID_ICON_DEATH 111 73 #define ID_ICON_FINGER 112 74 #define ID_ICON_SKULL 113 75 #define ID_ICON_THUMBUP 114 76 #define ID_ICON_THUMBDOWN 115 77 #define ID_ICON_BEAR 116 78 #define ID_ICON_BARNEY 117 79 #define ID_ICON_APP 118 80 #define ID_ICON_LAST 118 94 #define RGB255_TO_XCOLOR(R,G,B,X) { (X).red = ((unsigned int)(R) << 8) & 0xffff; \ 95 (X).green = ((unsigned int)(G) << 8) & 0xffff; \ 96 (X).blue = ((unsigned int)(B) << 8) & 0xffff; \ 97 (X).flags = DoRed | DoGreen | DoBlue; } 110 #define RGB_TO_XCOLOR(R,G,B,X) { (X).red = ((unsigned int)(R)) & 0xffff; \ 111 (X).green = ((unsigned int)(G)) & 0xffff; \ 112 (X).blue = ((unsigned int)(B)) & 0xffff; \ 113 (X).flags = DoRed | DoGreen | DoBlue; } 129 #define RGB255_FROM_XCOLOR(X,R,G,B) {register unsigned short __iR,__iG,__iB; RGB_FROM_XCOLOR(X,__iR, __iG, __iB); \ 130 if(__iR < 0xff80){ __iR += 0x80; } \ 131 if(__iG < 0xff80){ __iG += 0x80; } \ 132 if(__iB < 0xff80){ __iB += 0x80; } \ 133 __iR = __iR >> 8; __iG = __iG >> 8; __iB = __iB >> 8; \ 134 __iR &= 0xff; __iG &= 0xff; __iB &= 0xff; \ 135 (R) = __iR; (G) = __iG; (B) = __iB; } 150 #define RGB_FROM_XCOLOR(X,R,G,B) { (R) = (((X).flags) & DoRed) ? ((unsigned int)(X).red) & 0xffff : 0; \ 151 (G) = (((X).flags) & DoGreen) ? ((unsigned int)(X).green) & 0xffff : 0; \ 152 (B) = (((X).flags) & DoBlue) ? ((unsigned int)(X).blue) & 0xffff : 0; } 181 extern XStandardColormap PXM_StandardColormapFromColormap_rval;
190 PXM_StandardColormapFromColormap_rval.colormap = colormap;
192 return &PXM_StandardColormapFromColormap_rval;
223 void PXM_RGBToYUV(
int iR,
int iG,
int iB,
int *piY,
int *piU,
int *piV);
243 void PXM_RGBToHSV(
int iR,
int iG,
int iB,
int *piH,
int *piS,
int *piV);
274 void PXM_YUVToRGB(
int iY,
int iU,
int iV,
int *piR,
int *piG,
int *piB);
294 void PXM_HSVToRGB(
int iH,
int iS,
int iV,
int *piR,
int *piG,
int *piB);
428 unsigned long clrFGPixel,
unsigned long clrBGPixel);
501 unsigned int height,
unsigned int depth);
534 Pixmap
PXM_CopyPixmap(Display *pDisplay, Drawable dw, Pixmap pxImage);
549 #if defined(X11WORKBENCH_TOOLKIT_HAVE_XSHM_EXTENSION) || defined(__DOXYGEN__) 563 #else // !X11WORKBENCH_TOOLKIT_HAVE_XSHM_EXTENSION 565 #define WBXShmQueryExtension(X) (0) 567 #endif // X11WORKBENCH_TOOLKIT_HAVE_XSHM_EXTENSION, __DOXYGEN__ 600 int WBXPutImage(Display *pDisplay, Drawable dw,
WBGC gc, XImage *pImage,
601 int src_x,
int src_y,
int dest_x,
int dest_y,
602 unsigned int width,
unsigned int height);
625 XImage *
WBXGetImage(Display *pDisplay, Drawable dw,
626 int x,
int y,
unsigned int width,
unsigned int height,
627 unsigned long plane_mask,
int format);
656 XImage *
WBXCopyImage(Display *pDisplay, XImage *pImage);
743 XPoint *points,
int npoints,
int mode);
767 int x1,
int y1,
int x2,
int y2);
790 XPoint *points,
int npoints,
int mode);
814 int x,
int y,
unsigned int width,
unsigned int height);
838 int x,
int y,
unsigned int width,
unsigned int height);
864 int x,
int y,
unsigned int width,
unsigned int height,
865 int angle1,
int angle2);
891 int x,
int y,
unsigned int width,
unsigned int height,
892 int angle1,
int angle2);
916 XPoint *points,
int npoints,
int shape,
int mode);
941 int x,
int y,
const char *
string,
int length);
1011 if(pImage->depth <= 1)
1013 return (
unsigned long)pImage->bytes_per_line * (
unsigned long)pImage->height;
1016 return (
unsigned long)pImage->bytes_per_line * (
unsigned long)pImage->height
1017 * (
unsigned long)pImage->depth;
1038 unsigned long lPixel,
WB_GEOM *pGeom);
1069 unsigned char WB_isqrt(
unsigned char iVal);
1080 unsigned char WB_icos0(
unsigned char iVal);
1102 #define WB_isin(X) WB_icos((X) - 256) 1109 #endif // __cplusplus 1111 #endif // _PIXMAP_HELPER_H_ int WBXDrawArc(XImage *pImage, WBGC hGC, int x, int y, unsigned int width, unsigned int height, int angle1, int angle2)
XImage version for XDrawArc()
static __inline__ XStandardColormap * PXM_StandardColormapFromColormap(Display *pDisplay, Colormap colormap)
create temporary XStandardColormap from a Colormap
Pixmap PXM_GetIconPixmap(int idIcon, XPM_ATTRIBUTES *pAttr, Pixmap *pMask)
Create Icon pixmap pair using pre-defined resource ID.
void PXM_RGBToYUV(int iR, int iG, int iB, int *piY, int *piU, int *piV)
Convert R, G, B values to Y, U, V with 0-255 range.
'window helper' main header file for the X11workbench Toolkit API
static __inline__ unsigned long PXM_GetImageDataLength(XImage *pImage)
Returns the length of XImage data.
void WBDefaultStandardColormap(Display *pDisplay, XStandardColormap *pMap)
returns a default XStandardColormap structure for the default screen of the specified display
unsigned char WB_isqrt(unsigned char iVal)
integer square root of a value 0-255
XImage * WBXImageFromRegion(Region rgnSource, int width, int height)
Create a Region from an XImage.
int WBXFillPolygon(XImage *pImage, WBGC hGC, XPoint *points, int npoints, int shape, int mode)
XImage version for XFillPolygon()
void PXM_YUVToRGB(int iY, int iU, int iV, int *piR, int *piG, int *piB)
Convert Y, U, V values to R, G, B with 0-255 range.
void PXM_RegisterAppIcons(char *ppRegAppLarge[], char *ppRegAppSmall[])
Icon Registration for application 'large' and 'small' icons.
Pixmap PXM_LoadPixmap(char *ppXPM[], XPM_ATTRIBUTES *pAttr, Pixmap *pMask)
Create pixmap or pixmap pair using an XPM array.
int PXM_FreePixmap(Display *pDisplay, Pixmap pxImage)
Wrapper for XCreatePixmap()
Compatibility structure for use with MyLoadPixmapFromData() whenever libXpm is not in use.
int WBXDrawRectangle(XImage *pImage, WBGC hGC, int x, int y, unsigned int width, unsigned int height)
XImage version for XDrawRectangle()
int WBXPutImage(Display *pDisplay, Drawable dw, WBGC gc, XImage *pImage, int src_x, int src_y, int dest_x, int dest_y, unsigned int width, unsigned int height)
Write contents of an XImage onto a Drawable.
void PXM_OnExit(void)
Frees resources allocated by Pixmap utility functions.
static __inline__ Display * WBGetDefaultDisplay(void)
Returns the default Display.
internal wrapper struct for X11 'geometry' definition
void PXM_RGBToPixel(XStandardColormap *pMap, XColor *pColor)
Icon Registration for application 'large' and 'small' icons.
int WBXFillRectangle(XImage *pImage, WBGC hGC, int x, int y, unsigned int width, unsigned int height)
XImage version for XFillRectangle()
void PXM_PixelToRGB(XStandardColormap *pMap, XColor *pColor)
Convert the pixel menber of an XColor to RGB.
Pixmap PXM_GetIconPixmapFromAtom(Atom aIcon, XPM_ATTRIBUTES *pAttr, Pixmap *pMask)
Create Icon pixmap pair using a registered or pre-defined resource ID.
int WBXDrawLine(XImage *pImage, WBGC hGC, int x1, int y1, int x2, int y2)
XImage version for XDrawLines()
XImage * WBXCopyImage(Display *pDisplay, XImage *pImage)
Make a copy of an XImage.
Pixmap PXM_ImageToPixmap(Display *pDisplay, Drawable dw, XImage *pImage, unsigned long clrFGPixel, unsigned long clrBGPixel)
Convert 'locally stored' XImage to 'server object' Pixmap.
int PXM_RegisterPixmapResource(Atom aResource, char *ppResource[])
Register an icon (or pixmap) resource using an Atom.
int WBXShmQueryExtension(Display *pDisplay)
Indicates whether the 'XShm' extensions are available (libXext)
void WBDebugDumpColormap(const char *szTitle, const XStandardColormap *pMap)
Dump XStandardColormap members for debugging.
unsigned char WB_icos0(unsigned char iVal)
integer 255 * cos(iVal * pi / 512) calculation via lookup table (legacy, to be removed?...
void WBDebugDumpXColor(const char *szTitle, const XColor *pColor)
Dump XColor members for debugging.
static __inline__ void * PXM_GetImageDataPtr(XImage *pImage)
Returns pointer to XImage data.
int WBXDrawPoint(XImage *pImage, WBGC hGC, int x, int y)
XImage version for XDrawPoint()
int WBXDrawString(XImage *pImage, WB_FONTC pFont, WBGC hGC, int x, int y, const char *string, int length)
XImage version for XDrawString() or DTDrawString()
int WBXDrawPoints(XImage *pImage, WBGC hGC, XPoint *points, int npoints, int mode)
XImage version for XDrawPoints()
XImage * PXM_PixmapToImage(Display *pDisplay, Pixmap pxImage)
Convert pixmap to image (a wrapper for XGetImage on a pixmap)
XImage * WBXGetImage(Display *pDisplay, Drawable dw, int x, int y, unsigned int width, unsigned int height, unsigned long plane_mask, int format)
Read contents of a Drawable onto an XImage.
void WBSimpleAntiAliasImage(const XStandardColormap *pMap, XImage *pImage, unsigned long lPixel, WB_GEOM *pGeom)
Simple anti-alias of an XImage using foreground pixel color.
void PXM_RGBToHSV(int iR, int iG, int iB, int *piH, int *piS, int *piV)
Convert R, G, B values to H, S, V with 0-255 range.
int WBXDestroyImage(XImage *pImage)
Destroy an XImage - call this instead of XDestroyImage()
char WB_icos(int iVal)
integer 127 * cos(iVal * pi / 512) calculation via lookup table
Pixmap PXM_ImageToPixmap0(Display *pDisplay, Drawable dw, XImage *pImage)
Convert 'locally stored' XImage to 'server object' Pixmap using default FG/BG colors for monochrome.
int WBXDrawLines(XImage *pImage, WBGC hGC, XPoint *points, int npoints, int mode)
XImage version for XDrawLine()
An allocated structure containing XFontStruct, XFontInfo, and XftFont [as applicable] for a specified...
internal wrapper struct for GC with local cache
Pixmap PXM_CopyPixmap(Display *pDisplay, Drawable dw, Pixmap pxImage)
Copy a pixmap for the specified Display and Drawable.
void PXM_HSVToRGB(int iH, int iS, int iV, int *piR, int *piG, int *piB)
Convert H, S, V values to R, G, B with 0-255 range.
void WBSimpleAntiAliasPixmap(Display *pDisplay, const XStandardColormap *pMap, Pixmap pxImage, unsigned long lPixel, WB_GEOM *pGeom)
Simple anti-alias of a Pixmap using foreground pixel color.
int WBXFillArc(XImage *pImage, WBGC hGC, int x, int y, unsigned int width, unsigned int height, int angle1, int angle2)
XImage version for XFillArc()
Pixmap PXM_CreatePixmap(Display *pDisplay, Drawable dw, unsigned int width, unsigned int height, unsigned int depth)
Wrapper for XCreatePixmap()
Region WBXImageToRegion(const XImage *pImage)
Create a Region from an XImage.