Cursor cursorCreateSpinning (Display * dpy) { Pixmap cursor; Pixmap mask; XColor fg, bg; Cursor xcursor; fg.pixel = 0; fg.red = 0; fg.green = 0; fg.blue = 0; fg.flags = 0xf; bg.pixel = 0xffffffff; bg.red = 0xffff; bg.green = 0xffff; bg.blue = 0xffff; bg.flags = 0xf; cursor = XCreatePixmapFromBitmapData (dpy, DefaultRootWindow(dpy), (char *) xlib_spinning_bits, 32, 32, 0xffffffff, 0x0, 1); mask = XCreatePixmapFromBitmapData (dpy, DefaultRootWindow(dpy), (char *) xlib_spinning_mask_bits, 32, 32, 0xffffffff, 0x0, 1); xcursor = XCreatePixmapCursor (dpy, cursor, mask, &fg, &bg, 2, 2); XFreePixmap (dpy, mask); XFreePixmap (dpy, cursor); return xcursor; }
static void CreateOrUpdateGoodyGC(void) { XGCValues gcval; unsigned long gcmask; Pixel pfore; Pixel pback; if (colorset >= 0) { pfore = Colorset[colorset].fg; pback = Colorset[colorset].bg; } else { pfore = fore; pback = back; } gcmask = GCForeground | GCBackground | GCGraphicsExposures; gcval.foreground = pfore; gcval.background = pback; gcval.graphics_exposures = False; if (FStatusFont->font != NULL) { gcval.font = FStatusFont->font->fid; gcmask = GCFont; } if (statusgc) XChangeGC(dpy, statusgc, gcmask, &gcval); else statusgc = fvwmlib_XCreateGC(dpy, win, gcmask, &gcval); if (do_check_mail) { if (mailpix) XFreePixmap(dpy, mailpix); mailpix = XCreatePixmapFromBitmapData( dpy, win, (char *)minimail_bits, minimail_width, minimail_height, pfore, pback, Pdepth); if (wmailpix) XFreePixmap(dpy, wmailpix); wmailpix = XCreatePixmapFromBitmapData( dpy, win, (char *)minimail_bits, minimail_width, minimail_height, PictureBlackPixel(), PictureWhitePixel(), Pdepth); goodies_width += minimail_width + 7; } else if (do_display_clock) { goodies_width += 3; } else { goodies_width += 0; } }
Display *xwin_init(const char *display_name, const char *prgname, const char *classname, int argc, char **argv, int *pscreen, unsigned int *pw, unsigned int *ph) { XWindowAttributes xwa; /* FILE *f; f = fopen("bee.raw", "rb"); fread(leftarrow_bits, 1, 32, f); fclose(f); f = fopen("beemask.raw", "rb"); fread(rightarrow_bits, 1, 32, f); fclose(f); frickelfix(leftarrow_bits); frickelfix(rightarrow_bits); */ if ((_wndh_gl.display = XOpenDisplay(display_name)) == NULL) { fprintf(stderr, "failed to connect to X server %s\n", XDisplayName(display_name)); exit (EXIT_FAILURE); } XSynchronize(_wndh_gl.display, True); _wndh_gl.default_screen = DefaultScreen(_wndh_gl.display); _wndh_gl.width = DisplayWidth(_wndh_gl.display, _wndh_gl.default_screen); _wndh_gl.height = DisplayHeight(_wndh_gl.display, _wndh_gl.default_screen); _wndh_gl.black = BlackPixel(_wndh_gl.display, _wndh_gl.default_screen); _wndh_gl.white = WhitePixel(_wndh_gl.display, _wndh_gl.default_screen); _wndh_gl.root_window = RootWindow(_wndh_gl.display, _wndh_gl.default_screen); XGetWindowAttributes(_wndh_gl.display, _wndh_gl.root_window, &xwa); _wndh_gl.depth = xwa.depth; _wndh_gl.uparr_pix = XCreatePixmapFromBitmapData(_wndh_gl.display, _wndh_gl.root_window, uparrow_bits, uparrow_width, uparrow_height, _wndh_gl.black, _wndh_gl.white, _wndh_gl.depth); _wndh_gl.dnarr_pix = XCreatePixmapFromBitmapData(_wndh_gl.display, _wndh_gl.root_window, downarrow_bits, downarrow_width, downarrow_height, _wndh_gl.black, _wndh_gl.white, _wndh_gl.depth); _wndh_gl.lfarr_pix = XCreatePixmapFromBitmapData(_wndh_gl.display, _wndh_gl.root_window, leftarrow_bits, leftarrow_width, leftarrow_height, _wndh_gl.black, _wndh_gl.white, _wndh_gl.depth); _wndh_gl.rtarr_pix = XCreatePixmapFromBitmapData(_wndh_gl.display, _wndh_gl.root_window, rightarrow_bits, rightarrow_width, rightarrow_height, _wndh_gl.black, _wndh_gl.white, _wndh_gl.depth); _wndh_gl.sizer_pix = XCreatePixmapFromBitmapData(_wndh_gl.display, _wndh_gl.root_window, sizer_bits, sizer_width, sizer_height, _wndh_gl.black, _wndh_gl.white, _wndh_gl.depth); _wndh_gl.wm_del_atom = XInternAtom(_wndh_gl.display, "WM_DELETE_WINDOW", True); strncpy(_wndh_gl.prgname, prgname, WH_MAX_NAMELENGTH); strncpy(_wndh_gl.classname, classname, WH_MAX_NAMELENGTH); _wndh_gl.argc = argc; _wndh_gl.argv = argv; *pscreen = _wndh_gl.default_screen; *pw = _wndh_gl.width; *ph = _wndh_gl.height; #ifdef DEBUG printf("connected to X server %s\n", XDisplayName(display_name)); #endif return (_wndh_gl.display); }
/* Create the icon window */ static Window create_icon(Widget shell) { Display *display = XtDisplay(shell); Screen *screen = XtScreen(shell); Colormap colormap = XDefaultColormapOfScreen(screen); int depth = DefaultDepthOfScreen(screen); unsigned long black = BlackPixelOfScreen(screen); Window window; Pixmap pixmap, mask; XColor color; GC gc; XGCValues values; /* Create the actual icon window */ window = XCreateSimpleWindow( display, RootWindowOfScreen(screen), 0, 0, mask_width, mask_height, 0, CopyFromParent, CopyFromParent); /* Allocate the color red by name */ XAllocNamedColor(display, colormap, "red", &color, &color); /* Create a pixmap from the red bitmap data */ pixmap = XCreatePixmapFromBitmapData( display, window, (char *)red_bits, red_width, red_height, color.pixel, black, depth); /* Create a graphics context */ values.function = GXxor; gc = XCreateGC(display, pixmap, GCFunction, &values); /* Create a pixmap for the white 'e' and paint it on top */ mask = XCreatePixmapFromBitmapData( display, pixmap, (char *)white_bits, white_width, white_height, WhitePixelOfScreen(screen) ^ black, 0, depth); XCopyArea(display, mask, pixmap, gc, 0, 0, white_width, white_height, 0, 0); XFreePixmap(display, mask); XFreeGC(display, gc); #ifdef HAVE_LIBXEXT /* Create a shape mask and apply it to the window */ mask = XCreateBitmapFromData(display, pixmap, (char *)mask_bits, mask_width, mask_height); XShapeCombineMask(display, window, ShapeBounding, 0, 0, mask, ShapeSet); #endif /* HAVE_LIBXEXT */ /* Set the window's background to be the pixmap */ XSetWindowBackgroundPixmap(display, window, pixmap); return window; }
static Cursor XbrCursorCreate(Display *display, Screen *screen, char *bits, int xhot, int yhot, int width, int height) { Cursor cursor; XColor colours[2]; Pixmap pixmap; Colormap colourmap = DefaultColormapOfScreen(screen); Window root = RootWindowOfScreen(screen); /* Find out the black & white pixel values */ XbrGfxBWPixels(display, screen, colourmap, &colours[0], &colours[1]); /* Convert the bitmap to a pixmap - we could use XbrReadBitmap but that requires a GC, so we use the normal X routine. */ pixmap = XCreatePixmapFromBitmapData(display, root, bits, width, height, colours[1].pixel, colours[0].pixel, 1); /* Create a cursor from the pixmap */ cursor = XCreatePixmapCursor(display, pixmap, pixmap, &colours[0], &colours[1], xhot, yhot); /* Free the pixmap now */ XFreePixmap(display, pixmap); return(cursor); }
int XInitShades(Display *display, int screen) { char *bits; int count; int chars_bitmap = char_bitmap(); int bit; bits = (char *) malloc(chars_bitmap * sizeof(char)); for (count = 0; count < XShadeMax; count++) { /* Load in the next bitmap */ for (bit = 0; bit < chars_bitmap; bit++) bits[bit] = XShadeBits[count * chars_bitmap + bit]; /* Create it and put it into the Pixmap array */ XShade[count] = XCreatePixmapFromBitmapData(display, RootWindow(display, screen), bits, XShadeWidth, XShadeWidth, BlackPixel(display, screen), WhitePixel(display, screen), DisplayPlanes(display, screen)); } TileGC = XCreateGC(display, RootWindow(display, screen), 0, NULL); XSetFillStyle(display, TileGC, FillTiled); XSetTile(display, TileGC, XShade[XShadeMax / 2]); return XShadeMax; }
Pixmap UIMarker(int style, int foreground, int background) { if (style >= (int) (sizeof(_UIMarkers) / sizeof(char *))) return ((Pixmap) NULL); return (XCreatePixmapFromBitmapData(XtDisplay(UITopLevel()), XtWindow(UITopLevel()), _UIMarkers[style], UIWidth, UIHeight, foreground, background, DefaultDepth (XtDisplay(UITopLevel()), DefaultScreen(XtDisplay(UITopLevel()))))); }
//////////////////////////////////////////////////////////// /// /see WindowImpl::SetIcon //////////////////////////////////////////////////////////// void WindowImplX11::SetIcon(unsigned int Width, unsigned int Height, const Uint8* Pixels) { // X11 wants BGRA pixels : swap red and blue channels // Note : this memory will never be freed, but it seems to cause a bug on exit if I do so Uint8* IconPixels = new Uint8[Width * Height * 4]; for (std::size_t i = 0; i < Width * Height; ++i) { IconPixels[i * 4 + 0] = Pixels[i * 4 + 2]; IconPixels[i * 4 + 1] = Pixels[i * 4 + 1]; IconPixels[i * 4 + 2] = Pixels[i * 4 + 0]; IconPixels[i * 4 + 3] = Pixels[i * 4 + 3]; } // Create the icon pixmap Visual* DefVisual = DefaultVisual(ourDisplay, ourScreen); unsigned int DefDepth = DefaultDepth(ourDisplay, ourScreen); XImage* IconImage = XCreateImage(ourDisplay, DefVisual, DefDepth, ZPixmap, 0, (char*)IconPixels, Width, Height, 32, 0); if (!IconImage) { std::cerr << "Failed to set the window's icon" << std::endl; return; } Pixmap IconPixmap = XCreatePixmap(ourDisplay, RootWindow(ourDisplay, ourScreen), Width, Height, DefDepth); XGCValues Values; GC IconGC = XCreateGC(ourDisplay, IconPixmap, 0, &Values); XPutImage(ourDisplay, IconPixmap, IconGC, IconImage, 0, 0, 0, 0, Width, Height); XFreeGC(ourDisplay, IconGC); XDestroyImage(IconImage); // Create the mask pixmap (must have 1 bit depth) std::size_t Pitch = (Width + 7) / 8; static std::vector<Uint8> MaskPixels(Pitch * Height, 0); for (std::size_t j = 0; j < Height; ++j) { for (std::size_t i = 0; i < Pitch; ++i) { for (std::size_t k = 0; k < 8; ++k) { if (i * 8 + k < Width) { Uint8 Opacity = (Pixels[(i * 8 + k + j * Width) * 4 + 3] > 0) ? 1 : 0; MaskPixels[i + j * Pitch] |= (Opacity << k); } } } } Pixmap MaskPixmap = XCreatePixmapFromBitmapData(ourDisplay, myWindow, (char*)&MaskPixels[0], Width, Height, 1, 0, 1); // Send our new icon to the window through the WMHints XWMHints* Hints = XAllocWMHints(); Hints->flags = IconPixmapHint | IconMaskHint; Hints->icon_pixmap = IconPixmap; Hints->icon_mask = MaskPixmap; XSetWMHints(ourDisplay, myWindow, Hints); XFree(Hints); XFlush(ourDisplay); }
void CreateIconManagers() { IconMgr *p; int mask; char str[100]; char str1[100]; Pixel background; char *icon_name; if (Scr->NoIconManagers) return; if (Scr->siconifyPm == None) { Scr->siconifyPm = XCreatePixmapFromBitmapData(dpy, Scr->Root, (char *)siconify_bits, siconify_width, siconify_height, 1, 0, 1); } for (p = &Scr->iconmgr; p != NULL; p = p->next) { mask = XParseGeometry(p->geometry, &JunkX, &JunkY, (unsigned int *) &p->width, (unsigned int *)&p->height); if (mask & XNegative) JunkX = Scr->MyDisplayWidth - p->width - (2 * Scr->BorderWidth) + JunkX; if (mask & YNegative) JunkY = Scr->MyDisplayHeight - p->height - (2 * Scr->BorderWidth) + JunkY; background = Scr->IconManagerC.back; GetColorFromList(Scr->IconManagerBL, p->name, (XClassHint *)NULL, &background); p->w = XCreateSimpleWindow(dpy, Scr->Root, JunkX, JunkY, p->width, p->height, 1, Scr->Black, background); sprintf(str, "%s Icon Manager", p->name); sprintf(str1, "%s Icons", p->name); if (p->icon_name) icon_name = p->icon_name; else icon_name = str1; XSetStandardProperties(dpy, p->w, str, icon_name, None, NULL, 0, NULL); p->twm_win = AddWindow(p->w, TRUE, p); SetMapStateProp (p->twm_win, WithdrawnState); } for (p = &Scr->iconmgr; p != NULL; p = p->next) { GrabButtons(p->twm_win); GrabKeys(p->twm_win); } }
void geSetIcon(ge_Image* icon){ LibGE_LinuxContext* context = (LibGE_LinuxContext*)libge_context->syscontext; Pixmap icon_pixmap = XCreatePixmapFromBitmapData(context->dpy, context->win, (char*)icon->data, icon->width, icon->height, 1, 0, 32); win_hints->flags |= IconPixmapHint; win_hints->icon_pixmap = icon_pixmap; XSetWMHints(context->dpy, context->win, win_hints); }
void MSPixmap::create(MSDisplayServer *pServer_,const char *pName_,const char *bitmap_, int w_,int h_,unsigned long fg_,unsigned long bg_) { int dep=DefaultDepthOfScreen(pServer_->screen()); Pixmap p=XCreatePixmapFromBitmapData(pServer_->display(),pServer_->root(),(char*)bitmap_, w_,h_,fg_,bg_,dep); _pData=new MSPixmapData(pServer_,pName_,p,w_,h_,dep,fg_,bg_); addToHashTable(pName_,(void *)_pData); addReference(); }
Pixmap makepixmap(Widget toplevel, char bits[], int width, int height) { return (Pixmap)XCreatePixmapFromBitmapData(XtDisplay(toplevel), DefaultRootWindow(XtDisplay(toplevel)), bits, width, height, BlackPixelOfScreen(XtScreen(toplevel)), WhitePixelOfScreen(XtScreen(toplevel)), DefaultDepthOfScreen(XtScreen(toplevel))); }
int XInitDither(Display *display, int screen, GC gc, unsigned long fg, unsigned long bg) { char *bits; int count; int chars_bitmap = dither_char_bitmap(); int bit; XGCValues xgcv; DITHERINIT = 1; /* * First thing I should do is load in the Pixmaps */ bits = (char *) malloc(chars_bitmap * sizeof(char)); for (count = 0; count < XDitherMax; count++) { /* * Load in the next bitmap */ for (bit = 0; bit < chars_bitmap; bit++) bits[bit] = XDitherBits[count * chars_bitmap + bit]; /* * Create it and put it into the Pixmap array */ XDither[count] = XCreatePixmapFromBitmapData(display, RootWindow(display, screen), bits, XDitherWidth, XDitherWidth, BlackPixel(display, screen), WhitePixel(display, screen), 1); } /* * Now reset the gc values to be as I need them */ xgcv.background = bg; xgcv.foreground = fg; xgcv.fill_style = FillOpaqueStippled; xgcv.stipple = XDither[4]; XChangeGC(display, gc, GCForeground | GCBackground | GCFillStyle | GCStipple, &xgcv); return (XDitherMax); }
void GLWindow::hideCursor(void) { /* Why is it so goshdarn complicated to just hide the friggin' cursor? */ static char emptyCursorBits[]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; Pixmap emptyCursorPixmap=XCreatePixmapFromBitmapData(display,window,emptyCursorBits,16,16,1,0,1); XColor black,white; // Actually, both are dummy colors Cursor emptyCursor=XCreatePixmapCursor(display,emptyCursorPixmap,emptyCursorPixmap,&black,&white,0,0); XDefineCursor(display,window,emptyCursor); XFreeCursor(display,emptyCursor); XFreePixmap(display,emptyCursorPixmap); }
Pixmap get_pp_pixmap(void){ if(!pp_pixmap) { pp_pixmap = XCreatePixmapFromBitmapData( XtDisplay(root), RootWindowOfScreen(XtScreen(root)), (char*)pp_bitmap_bits, pp_bitmap_width, pp_bitmap_height, BlackPixelOfScreen(XtScreen(root)), /* foreground pixel */ WhitePixelOfScreen(XtScreen(root)), /* background pixel */ DefaultDepthOfScreen(XtScreen(root)) /* depth */); } return pp_pixmap; }
void MpButton::AddIcon (const char *btmp, int w, int h, int align, bool bitmask) { // remove possible previous icon DeleteIcon(); // link bitmap bitmap = btmp; icon_width = w; icon_height = h; pixmap = XCreatePixmapFromBitmapData(Mp.theDisplay, Win(), (char*) btmp, w, h, Mp.TextColor.Pixel(), // foreground Mp.CanvasColor.Pixel(), // background Mp.theDepth); if (bitmask) { mask = XCreatePixmapFromBitmapData(Mp.theDisplay, Win(), (char*) btmp, w, h, Mp.WhiteColor.Pixel(), // foreground Mp.BlackColor.Pixel(), // background 1); if (!mask) Mp.Warn("MpButton::AddIcon(XBM): Can't allocate icon bitmap mask"); } if (pixmap) { // remember size icon_width = w; icon_height = h; // remember alignment if (align == MpBase::AlignLeft) state |= icon_align_left; else if (align == MpBase::AlignRight) state |= icon_align_right; } else Mp.Warn("MpButton::AddIcon(XBM): Can't allocate icon pixmap"); }
JXImage::JXImage ( JXDisplay* display, JXColormap* colormap, const JConstBitmap& bitmap, const JColorIndex origForeColor, const JColorIndex origBackColor, const JSize depth ) : JImage(bitmap.w, bitmap.h, colormap) { JXImageX(display, colormap, depth); const JColorIndex foreColor = (origForeColor == kJXTransparentColor && itsDepth > 1 ? colormap->GetBlackColor() : origForeColor); const JColorIndex backColor = (origBackColor == kJXTransparentColor && itsDepth > 1 ? colormap->GetDefaultBackColor() : origBackColor); unsigned long forePixel, backPixel; if (itsDepth == 1) { forePixel = JXImageMask::ColorToBit(foreColor); backPixel = JXImageMask::ColorToBit(backColor); } else { forePixel = itsColormap->GetXPixel(foreColor); backPixel = itsColormap->GetXPixel(backColor); } itsPixmap = XCreatePixmapFromBitmapData(*itsDisplay, itsDisplay->GetRootWindow(), (char*) bitmap.data, bitmap.w, bitmap.h, forePixel, backPixel, itsDepth); assert( itsPixmap != None ); if (itsDepth != itsDisplay->GetDepth()) { itsGC = new JXGC(itsDisplay, itsColormap, itsPixmap); assert( itsGC != NULL ); } RegisterColor(foreColor); RegisterColor(backColor); }
static void mark(int w) { Pixmap mark_pmap; mark_pmap = XCreatePixmapFromBitmapData(display, main_window, mark_bits[w], mark_width, mark_height, forepix, backpix, DefaultDepth(display, 0)); XCopyArea(display, mark_pmap, main_window, gc, 0, 0, mark_width, mark_height, points[0].x - mark_width / 2, points[0].y - mark_height / 2); XFreePixmap(display, mark_pmap); }
static void fillpoly(XPoint * points, int type, int n) { Pixmap till_pmap; till_pmap = XCreatePixmapFromBitmapData(display, main_window, till_bits[type], till_width, till_height, forepix, backpix, DefaultDepth(display, 0)); XSetTile(display, gc, till_pmap); XSetFillStyle(display, gc, FillTiled); XFillPolygon(display, main_window, gc, points, n, Convex, CoordModeOrigin); XFreePixmap(display, till_pmap); }
static void fillbox(int type, short x, short y, short w, short h) { Pixmap till_pmap; till_pmap = XCreatePixmapFromBitmapData(display, main_window, till_bits[type], till_width, till_height, forepix, backpix, DefaultDepth(display, 0)); XSetTile(display, gc, till_pmap); XSetFillStyle(display, gc, FillTiled); XFillRectangle(display, main_window, gc, x, y, w, h); XFreePixmap(display, till_pmap); }
static void init_fillpattern (Window theWindow) // // generate the fill pixmaps // { for (int i = 0; i <= MaxFillPattern; i++) { if ( (fill_pattern[i] = XCreatePixmapFromBitmapData(Mp.theDisplay,theWindow, (char *)fill_images[i],8,8, Mp.BlackColor.Pixel(),Mp.WhiteColor.Pixel(), Mp.theDepth) ) == 0) Matpack.Error(Mat::UnspecifiedError, "init_fillpattern: can't allocate polygon fill pattern"); } }
Pixmap count_xcreatepixmapfrombitmapdata (const char *fname, int line, Display * display, Drawable drawable, char *data, unsigned int width, unsigned int height, unsigned long fg, unsigned long bg, unsigned int depth) { Pixmap pmap = XCreatePixmapFromBitmapData (display, drawable, data, width, height, fg, bg, depth); if (pmap == None) return None; count_alloc (fname, line, (void *)pmap, width * height * depth / 8, C_PIXMAP | C_FROMBITMAP); return pmap; }
void DrawBitmap(char *data, int x, int y, int width, int height) { Pixmap pix; if (lsx_curwin->toplevel == NULL || data == NULL) return; pix = XCreatePixmapFromBitmapData(display, window, data, width, height, cur_di->foreground, cur_di->background, DefaultDepth(display, lsx_curwin->screen)); if (pix == 0) return; XCopyArea(display, pix, window, drawgc, 0,0, width, height, x,y); XFreePixmap(display, pix); }
static Object P_Create_Pixmap_From_Bitmap_Data (Object win, Object data, Object pw, Object ph, Object fg, Object bg, Object depth) { register unsigned int w, h; Check_Type (win, T_Window); Check_Type (data, T_String); w = Get_Integer (pw); h = Get_Integer (ph); if (w * h > 8 * STRING(data)->size) Primitive_Error ("bitmap too small"); return Make_Pixmap (WINDOW(win)->dpy, XCreatePixmapFromBitmapData (WINDOW(win)->dpy, WINDOW(win)->win, STRING(data)->data, w, h, Get_Pixel (fg), Get_Pixel (bg), Get_Integer (depth))); }
/* Returns a pixmap of the xscreensaver logo. */ Pixmap xscreensaver_logo (Screen *screen, Visual *visual, Drawable drawable, Colormap cmap, unsigned long background_color, unsigned long **pixels_ret, int *npixels_ret, Pixmap *mask_ret, Bool big_p) { Display *dpy = DisplayOfScreen (screen); int depth = visual_depth (screen, visual); int iw, ih; XImage *image; Pixmap p = 0; unsigned char *mask = 0; image = minixpm_to_ximage (dpy, visual, cmap, depth, background_color, (screenlocker_xpm), &iw, &ih, pixels_ret, npixels_ret, (mask_ret ? &mask : 0)); if (image) { XGCValues gcv; GC gc; p = XCreatePixmap (dpy, drawable, iw, ih, depth); gc = XCreateGC (dpy, p, 0, &gcv); XPutImage (dpy, p, gc, image, 0, 0, 0, 0, iw, ih); free (image->data); image->data = 0; XDestroyImage (image); XFreeGC (dpy, gc); if (mask_ret && mask) { *mask_ret = (Pixmap) XCreatePixmapFromBitmapData (dpy, drawable, (char *) mask, iw, ih, 1L, 0L, 1); free (mask); } } return p; }
Pixmap wlp_xbm_from_data(Widget w, Display *dpy, Pixel fg, Pixel bg, char *data, int wd, int ht) { Arg a; int depth; if(w == NULL) return XCreateBitmapFromData(dpy, RootWindow(dpy, DefaultScreen(dpy)), data, wd, ht); dpy = XtDisplay(w); XtSetArg(a, XmNdepth, &depth); XtGetValues(w, &a, 1); return XCreatePixmapFromBitmapData(dpy, XtWindow(w), data, wd, ht, fg, bg, depth); }
static t_app *init_app(t_x11 *x11, int argc, char *argv[]) { static const char *but_nm[ebutNR] = { "Quit", "Start", "Stop", "Rewind", "Toggle Gly" }; XSizeHints hints; Pixmap pm; int th; t_app *app; t_windata *wd; int i, dx; snew(app, 1); th = XTextHeight(x11->font)+4; InitWin(&(app->wd), 0, 0, MAXDEG+6, MAXDEG+6+th+6, 0, "Ramachandran Movie"); dx = app->wd.width/ebutNR; app->wd.self = XCreateSimpleWindow(x11->disp, x11->root, app->wd.x, app->wd.y, app->wd.width, app->wd.height, app->wd.bwidth, x11->fg, x11->bg); x11->RegisterCallback(x11, app->wd.self, x11->root, mainCallBack, app); x11->SetInputMask(x11, app->wd.self, StructureNotifyMask); hints.flags = 0; pm = XCreatePixmapFromBitmapData(x11->disp, x11->root, (char *)rama_bits, rama_width, rama_height, WHITE, BLACK, 1); XSetStandardProperties(x11->disp, app->wd.self, app->wd.text, "Rama", pm, argv, argc, &hints); x11->RegisterCallback(x11, app->wd.self, x11->root, appCallBack, app); x11->SetInputMask(x11, app->wd.self, ButtonPressMask | ExposureMask | StructureNotifyMask); app->xr = init_xrama(x11, app->wd.self, th+6, app); for (i = 0; (i < ebutNR); i++) { wd = &(app->but[i]); InitWin(wd, i*dx+2, 2, dx-4, th, 1, but_nm[i]); wd->self = XCreateSimpleWindow(x11->disp, app->wd.self, wd->x, wd->y, wd->width, wd->height, wd->bwidth, x11->fg, x11->bg); x11->RegisterCallback(x11, wd->self, app->wd.self, appCallBack, app); x11->SetInputMask(x11, wd->self, ButtonPressMask | ExposureMask); } return app; }
void create_flasher(Widget parent) { Widget flasher_pane; Display *display; /* Create the menu pane for the menu */ flasher_pane = XmCreatePulldownMenu(parent, "Flasher", NULL, 0); display=XtDisplay(parent); cov = XCreatePixmapFromBitmapData(display, DefaultRootWindow(display), log_bits, log_width, log_height, BlackPixel(display,DefaultScreen(display)), WhitePixel(display,DefaultScreen(display)), DefaultDepth(display,DefaultScreen(display))); argcount = 0; XtSetArg(args[argcount], XmNsubMenuId, flasher_pane); argcount++; XtSetArg(args[argcount], XmNmarginHeight, 0); argcount++; XtSetArg(args[argcount], XmNlabelType,XmPIXMAP); argcount++; XtSetArg(args[argcount], XmNlabelPixmap, cov); argcount++; flasher_button = XmCreateCascadeButton(parent,NULL, args, argcount); XtManageChild(flasher_button); }
void MSPixmap::create(MSDisplayServer *pServer_,const char *pName_,unsigned long fg_,unsigned long bg_,int depth_) { char buf[255]; char *bitmap; if ((unsigned long)(bitmap=(char *)_pPixmapHashTable->lookup(pName_))==_pPixmapHashTable->notFound()) { MSMessageLog::criticalMessage("MSPixmap error: Unable to create prdefined Pixmap `%s' - unknown name\n",pName_); applicationExit(); } else { int w=PredefinedPixmapWidth; int h=PredefinedPixmapHeight; sprintf(buf,"Predefined_%s_%d_%d_%d_%d",pName_,fg_,bg_,depth_,pServer_->display()); Pixmap p=XCreatePixmapFromBitmapData(pServer_->display(),pServer_->root(),(char *)bitmap, w,h,fg_,bg_,depth_); _pData=new MSPixmapData(pServer_,buf,p,w,h,depth_,fg_,bg_); addToHashTable(buf,(void *)_pData); addReference(); } }
void InitBitmapAndGCs() { BitmapGCData *BitmapGCDataTablePtr; XGCValues theGCValues; theGCValues.function = GXcopy; theGCValues.foreground = BlackPixel( theDisplay, theScreen ); theGCValues.background = WhitePixel( theDisplay, theScreen ); theGCValues.fill_style = FillTiled; for ( BitmapGCDataTablePtr = BitmapGCDataTable; BitmapGCDataTablePtr->GCCreatePtr != NULL; BitmapGCDataTablePtr++ ) { *(BitmapGCDataTablePtr->BitmapCreatePtr) = XCreatePixmapFromBitmapData( theDisplay, RootWindow( theDisplay, theScreen ), BitmapGCDataTablePtr->PixelPattern, BitmapGCDataTablePtr->PixelWidth, BitmapGCDataTablePtr->PixelHeight, BlackPixel( theDisplay, theScreen ), WhitePixel( theDisplay, theScreen ), DefaultDepth( theDisplay, theScreen ) ); theGCValues.tile = *(BitmapGCDataTablePtr->BitmapCreatePtr); *(BitmapGCDataTablePtr->GCCreatePtr) = XCreateGC( theDisplay, theWindow, GCFunction | GCForeground | GCBackground | GCTile | GCFillStyle, &theGCValues ); } XFlush( theDisplay ); }