本文整理汇总了C++中BlackPixelOfScreen函数的典型用法代码示例。如果您正苦于以下问题:C++ BlackPixelOfScreen函数的具体用法?C++ BlackPixelOfScreen怎么用?C++ BlackPixelOfScreen使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了BlackPixelOfScreen函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: lcdscrub_init
static void *
lcdscrub_init (Display *dpy, Window window)
{
struct state *st = (struct state *) calloc (1, sizeof(*st));
XGCValues gcv;
st->dpy = dpy;
st->window = window;
st->delay = get_integer_resource (st->dpy, "delay", "Integer");
st->spread = get_integer_resource (st->dpy, "spread", "Integer");
st->cycles = get_integer_resource (st->dpy, "cycles", "Integer");
XGetWindowAttributes (st->dpy, st->window, &st->xgwa);
gcv.foreground = BlackPixelOfScreen (st->xgwa.screen);
gcv.background = WhitePixelOfScreen (st->xgwa.screen);
st->bg = XCreateGC (st->dpy, st->window, GCForeground, &gcv);
gcv.foreground = WhitePixelOfScreen (st->xgwa.screen);
gcv.background = BlackPixelOfScreen (st->xgwa.screen);
st->fg = XCreateGC (st->dpy, st->window, GCForeground, &gcv);
#ifdef HAVE_COCOA
jwxyz_XSetAntiAliasing (st->dpy, st->fg, False);
jwxyz_XSetAntiAliasing (st->dpy, st->bg, False);
#endif
return st;
}
示例2: lcdscrub_init
static void *
lcdscrub_init (Display *dpy, Window window)
{
struct state *st = (struct state *) calloc (1, sizeof(*st));
XGCValues gcv;
st->dpy = dpy;
st->window = window;
//st->delay = get_integer_resource (st->dpy, "delay", "Integer");
//st->spread = get_integer_resource (st->dpy, "spread", "Integer");
//st->cycles = get_integer_resource (st->dpy, "cycles", "Integer");
st->delay = delay;
st->spread = spread;
st->cycles = cycles;
XGetWindowAttributes (st->dpy, st->window, &st->xgwa);
gcv.foreground = BlackPixelOfScreen (st->xgwa.screen);
gcv.background = WhitePixelOfScreen (st->xgwa.screen);
st->bg = XCreateGC (st->dpy, st->window, GCForeground, &gcv);
st->bg2 = XCreateGC (st->dpy, st->window, GCForeground, &gcv);
gcv.foreground = WhitePixelOfScreen (st->xgwa.screen);
gcv.background = BlackPixelOfScreen (st->xgwa.screen);
st->fg = XCreateGC (st->dpy, st->window, GCForeground, &gcv);
#ifdef HAVE_COCOA
jwxyz_XSetAntiAliasing (st->dpy, st->fg, False);
jwxyz_XSetAntiAliasing (st->dpy, st->bg, False);
jwxyz_XSetAntiAliasing (st->dpy, st->bg2, False);
#endif
st->enabled_mask = 0;
#if 1
# define PREF(R,F) \
if (R) st->enabled_mask |= (1 << F)
#else
# define PREF(R,F) \
if (get_boolean_resource (st->dpy, R, "Mode")) st->enabled_mask |= (1 << F)
#endif
PREF("modeHW", HORIZ_W);
PREF("modeHB", HORIZ_B);
PREF("modeVW", VERT_W);
PREF("modeVB", VERT_B);
PREF("modeDW", DIAG_W);
PREF("modeDB", DIAG_B);
PREF("modeW", WHITE);
PREF("modeB", BLACK);
PREF("modeRGB", RGB);
# undef PREF
if (! st->enabled_mask)
{
fprintf (stderr, "%s: no modes enabled\n", progname);
exit (1);
}
pick_mode (st);
return st;
}
示例3: XInternAtom
bool KXMessages::sendMessageX( Display* disp, WId w_P, const char* msg_type_P,
const QString& message_P, bool obsolete_P )
{
if( disp == NULL )
return false;
Atom a2 = XInternAtom( disp, msg_type_P, false );
Atom a1 = obsolete_P ? a2 : XInternAtom( disp, QByteArray(QByteArray( msg_type_P ) + "_BEGIN").constData(), false );
Window win = XCreateSimpleWindow( disp, DefaultRootWindow( disp ), 0, 0, 1, 1,
0, BlackPixelOfScreen( DefaultScreenOfDisplay( disp )),
BlackPixelOfScreen( DefaultScreenOfDisplay( disp )));
send_message_internal( w_P, message_P, 0, disp, a1, a2, win );
XDestroyWindow( disp, win );
return true;
}
示例4: printf
IMAGE_CONTEXT *new_window( char *wnd_name, int x, int y, int width, int height )
{
IMAGE_CONTEXT *img_ctx;
img_ctx = new IMAGE_CONTEXT;
g_width = width;
g_height = height;
// First we are creating the window
if ( ( img_ctx->display = XOpenDisplay(NULL) ) == NULL )
{
printf("Error: XOpenDisplay failed.\n");
exit(1);
}
img_ctx->screenNumber = DefaultScreen( img_ctx->display );
img_ctx->screen = XScreenOfDisplay( img_ctx->display, img_ctx->screenNumber );
img_ctx->window = XCreateSimpleWindow (
img_ctx->display,
RootWindowOfScreen( img_ctx->screen ),
0,
0,
g_width,
g_height,
0,
BlackPixelOfScreen( img_ctx->screen ),
BlackPixelOfScreen( img_ctx->screen )
);
img_ctx->xImage = NULL;
if( image_create( img_ctx, g_width, g_height ) < 0 )
{
printf("Error: image_create() failed\n");
exit(1);
}
XSelectInput( img_ctx->display, img_ctx->window, ButtonPressMask | KeyPressMask );
XMapRaised( img_ctx->display, img_ctx->window );
XStoreName( img_ctx->display, img_ctx->window, wnd_name );
XGetWindowAttributes( img_ctx->display, img_ctx->window, &(img_ctx->windowAttributes ) );
XMoveWindow( img_ctx->display, img_ctx->window, x, y );
return img_ctx;
}
示例5: _game
HelloWorld::HelloWorld(Display* display) :
_game() {
_display = display;
_screen = XDefaultScreenOfDisplay(display);
_blackColor = BlackPixelOfScreen(_screen);
_whiteColor = WhitePixelOfScreen(_screen);
_font = XLoadFont(_display, WINDOW_FONT);
int screenWidth = XWidthOfScreen(_screen);
int screenHeight = XHeightOfScreen(_screen);
int windowWidth = MIN_CELL_SIZE * 3;
int windowHeight = MIN_CELL_SIZE * 3 + STRING_HEIGHT * 3;
int windowX = (screenWidth + windowWidth) / 2;
int windowY = (screenHeight + windowHeight) / 2;
_window = XCreateSimpleWindow(_display, XRootWindowOfScreen(_screen),
windowX, windowY, windowWidth, windowHeight, 1, _blackColor,
_whiteColor);
long eventMask = ButtonPressMask | ExposureMask | KeyPressMask;
XSelectInput(_display, _window, eventMask);
draw();
}
示例6: drawimage
void
drawimage(perwindow *pwin)
{
imagestruct *ip;
int i;
ip = (imagestruct *)pwin->data;
XSetForeground(dsp, pwin->gc, BlackPixelOfScreen(pwin->perscreen->screen));
for (i = 0; i < ip->iconcount; i++) {
if (!ip->iconmode)
XFillRectangle(dsp, pwin->w, pwin->gc,
ip->xb + xlogo_width * ip->icons[i].x,
ip->yb + xlogo_height * ip->icons[i].y,
xlogo_width, xlogo_height);
ip->icons[i].x = random() % ip->ncols;
ip->icons[i].y = random() % ip->nrows;
}
if (pwin->perscreen->npixels == 2)
XSetForeground(dsp, pwin->gc, WhitePixelOfScreen(pwin->perscreen->screen));
for (i = 0; i < ip->iconcount; i++) {
if (pwin->perscreen->npixels > 2)
XSetForeground(dsp, pwin->gc,
pwin->perscreen->pixels[random() % pwin->perscreen->npixels]);
XPutImage(dsp, pwin->w, pwin->gc, &logo,
0, 0,
ip->xb + xlogo_width * ip->icons[i].x,
ip->yb + xlogo_height * ip->icons[i].y,
xlogo_width, xlogo_height);
}
}
示例7: initimage
void
initimage(perwindow *pwin)
{
XWindowAttributes xgwa;
imagestruct *ip;
if (pwin->data) free(pwin->data);
pwin->data = (void *)malloc(sizeof(imagestruct));
memset(pwin->data, '\0', sizeof(imagestruct));
ip = (imagestruct *)pwin->data;
ip->startTime = seconds();
logo.data = (char *) xlogo_bits;
logo.width = xlogo_width;
logo.height = xlogo_height;
logo.bytes_per_line = (xlogo_width + 7) / 8;
XGetWindowAttributes(dsp, pwin->w, &xgwa);
ip->width = xgwa.width;
ip->height = xgwa.height;
ip->ncols = ip->width / xlogo_width;
ip->nrows = ip->height / xlogo_height;
ip->iconmode = (ip->ncols < 2 || ip->nrows < 2);
if (ip->iconmode) {
ip->xb = 0;
ip->yb = 0;
ip->iconcount = 1; /* icon mode */
} else {
ip->xb = (ip->width - xlogo_width * ip->ncols) / 2;
ip->yb = (ip->height - xlogo_height * ip->nrows) / 2;
ip->iconcount = batchcount;
}
XSetForeground(dsp, pwin->gc, BlackPixelOfScreen(pwin->perscreen->screen));
XFillRectangle(dsp, pwin->w, pwin->gc, 0, 0, ip->width, ip->height);
}
示例8: BeginWait
/*
** BeginWait/EndWait
**
** Display/Remove a watch cursor over topCursorWidget and its descendents
*/
void BeginWait(Widget topCursorWidget)
{
Display *display = XtDisplay(topCursorWidget);
Pixmap pixmap;
Pixmap maskPixmap;
XColor xcolors[2];
static Cursor waitCursor = 0;
/* if the watch cursor hasn't been created yet, create it */
if (!waitCursor) {
pixmap = XCreateBitmapFromData(display, DefaultRootWindow(display),
(char *)watch_bits, watch_width, watch_height);
maskPixmap = XCreateBitmapFromData(display, DefaultRootWindow(display),
(char *)watch_mask_bits, watch_width, watch_height);
xcolors[0].pixel = BlackPixelOfScreen(DefaultScreenOfDisplay(display));
xcolors[1].pixel = WhitePixelOfScreen(DefaultScreenOfDisplay(display));
XQueryColors(display, DefaultColormapOfScreen(
DefaultScreenOfDisplay(display)), xcolors, 2);
waitCursor = XCreatePixmapCursor(display, pixmap, maskPixmap,
&xcolors[0], &xcolors[1], watch_x_hot, watch_y_hot);
XFreePixmap(display, pixmap);
XFreePixmap(display, maskPixmap);
}
/* display the cursor */
XDefineCursor(display, XtWindow(topCursorWidget), waitCursor);
}
示例9: create_window
Window create_window(Display *dsp, Screen *screen) {
Window window;
int x, y;
int width, height;
int depth;
XSetWindowAttributes winAttrib;
XWindowAttributes window_attributes;
x = 30;
y = 60;
width = 200;
height = 300;
winAttrib.background_pixel = BlackPixelOfScreen(screen);
winAttrib.border_pixel = WhitePixelOfScreen(screen);
winAttrib.backing_store = Always/*NotUseful*/;
winAttrib.override_redirect = False;
winAttrib.bit_gravity = NorthWestGravity;
winAttrib.win_gravity = NorthWestGravity;
depth = DefaultDepthOfScreen(screen);
if (XGetWindowAttributes(dsp, RootWindowOfScreen(screen), &window_attributes) == 0)
{
fprintf(stderr, "xf_get_pixmap_info: XGetWindowAttributes failed\n");
return 1;
}
window = XCreateWindow(dsp, RootWindowOfScreen(screen),
x, y,
width, height,
0,
depth,
InputOutput, /*window_attributes.visual*/DefaultVisual(dsp, 0),
0, &winAttrib);
setWindowDecorations(dsp, window, 0); //设置后没有Ubuntu自带的关闭、最小和最大这三个键
return window;
}
示例10: t3d_init
static void *
t3d_init (Display *dpy, Window window)
{
struct state *st = (struct state *) calloc (1, sizeof(*st));
st->dpy = dpy;
st->window = window;
st->dpy = dpy;
st->window = window;
initialize(st);
initColor(st,st->r,st->g,st->b);
init_3d(st);
st->zeit=(struct tm *)malloc(sizeof(struct tm));
init_kugel(st);
st->startx=st->scrnWidth/2;
st->starty=st->scrnHeight/2;
st->scrnH2=st->startx;
st->scrnW2=st->starty;
st->vspeed=0;
vektorprodukt(st->x,st->y,st->v);
viewpoint(st/*m,v*/);
setink (BlackPixelOfScreen(st->xgwa.screen));
XFillRectangle (st->dpy, st->window, st->gc, 0, 0, st->scrnWidth, st->scrnHeight);
XQueryPointer (st->dpy, st->window, &st->junk_win, &st->junk_win, &st->junk, &st->junk,
&st->px, &st->py, &st->kb);
return st;
}
示例11: detectorToSegment
static void detectorToSegment(SpaceWindow *window, SpinSegment *segdt,
SpinSegment *seg)
{
int i,j;
Pixel black;
Screen *screen;
screen = XtScreen(window->shell);
black = BlackPixelOfScreen(screen);
seg->pixel = black;
seg->x1 = window->currentLongToTr * segdt->x1;
seg->y1 = window->currentLongToTr * segdt->y1;
seg->z1 = segdt->z1;
seg->x2 = window->currentLongToTr * segdt->x2;
seg->y2 = window->currentLongToTr * segdt->y2;
seg->z2 = segdt->z2;
/*
** Now translate
*/
seg->x1 = seg->x1 +
window->currentLongToTr * window->currentTransl[0];
seg->y1 = seg->y1 +
window->currentLongToTr * window->currentTransl[1];
seg->z1 = seg->z1 +
window->currentTransl[2];
seg->x2 = seg->x2 +
window->currentLongToTr * window->currentTransl[0];
seg->y2 = seg->y2 +
window->currentLongToTr * window->currentTransl[1];
seg->z2 = seg->z2 +
window->currentTransl[2];
return;
}
示例12: distort_init
static void *
distort_init (Display *dpy, Window window)
{
struct state *st = (struct state *) calloc (1, sizeof(*st));
XGCValues gcv;
long gcflags;
st->dpy = dpy;
st->window = window;
distort_reset (st);
st->black_pixel = BlackPixelOfScreen( st->xgwa.screen );
gcv.function = GXcopy;
gcv.subwindow_mode = IncludeInferiors;
gcflags = GCFunction;
if (use_subwindow_mode_p(st->xgwa.screen, st->window)) /* see grabscreen.c */
gcflags |= GCSubwindowMode;
st->gc = XCreateGC (st->dpy, st->window, gcflags, &gcv);
/* On MacOS X11, XGetImage on a Window often gets an inexplicable BadMatch,
possibly due to the window manager having occluded something? It seems
nondeterministic. Loading the image into a pixmap instead fixes it. */
if (st->pm) XFreePixmap (st->dpy, st->pm);
st->pm = XCreatePixmap (st->dpy, st->window,
st->xgwa.width, st->xgwa.height, st->xgwa.depth);
st->img_loader = load_image_async_simple (0, st->xgwa.screen, st->window,
st->pm, 0, 0);
st->start_time = time ((time_t *) 0);
return st;
}
示例13: ConvertPixmap
static Pixmap
ConvertPixmap(char *file_name, int depth)
#endif
{
XrmValue fg_from,
fg_to,
bg_from,
bg_to;
Pixel fg,
bg;
fg_from.size = strlen(XtDefaultForeground);
fg_from.addr = XtDefaultForeground;
fg_to.addr = (XPointer) & fg;
bg_from.size = strlen(XtDefaultBackground);
bg_from.addr = XtDefaultBackground;
bg_to.addr = (XPointer) & bg;
if (!XtConvertAndStore
(UxTopLevel, XtRString, &bg_from, XtRPixel, &bg_to)
|| !XtConvertAndStore
(UxTopLevel, XtRString, &fg_from, XtRPixel, &fg_to)
|| (fg == bg)) {
fg = WhitePixelOfScreen(XtScreen(UxTopLevel));
bg = BlackPixelOfScreen(XtScreen(UxTopLevel));
}
if (depth)
return (XmGetPixmapByDepth
(XtScreen(UxTopLevel), file_name, fg, bg, depth));
else
return (XmGetPixmap(XtScreen(UxTopLevel), file_name, fg, bg));
}
示例14: create_popup_menu
/**
@pre display is valid, themes is valid, cursors is valid.
@pre all widgets are zero'd.
@pre themes is valid and has loaded at least a background for the popup_menu_parent.
@post Menu with borders and background but no items is created but not mapped.
@brief This function is used to create a blank and generic menu. Items must be added by caller.
@return void
**/
void
create_popup_menu(Display *display, struct Popup_menu *menu, struct Themes *themes, struct Cursors *cursors) {
XSetWindowAttributes set_attributes;
Window root = DefaultRootWindow(display);
Screen* screen = DefaultScreenOfDisplay(display);
int black = BlackPixelOfScreen(screen);
const int width = menu->inner_width + themes->popup_menu[popup_l_edge].w + themes->popup_menu[popup_r_edge].w;
const int height = menu->inner_height + themes->popup_menu[popup_t_edge].h + themes->popup_menu[popup_b_edge].h;
menu->widgets[popup_menu_parent].widget = XCreateSimpleWindow(display, root
, 0, 0
, width, height, 0, black, black);
XDefineCursor(display, menu->widgets[popup_menu_parent].widget, cursors->normal);
XSetWindowBackgroundPixmap(display, menu->widgets[popup_menu_parent].widget
, themes->popup_menu[popup_menu_parent].state_p[normal]);
//Currently, this is the "base" of the popup menu.
//A similar loop will be needed for the actual menu items but not in this function
for(int i = popup_t_edge; i < popup_menu_parent; i++) { //popup_menu_parent already done
int x = themes->popup_menu[i].x;
int y = themes->popup_menu[i].y;
int w = themes->popup_menu[i].w;
int h = themes->popup_menu[i].h;
if(x < 0) x += width;
if(y < 0) y += height;
if(w <= 0) w += width;
if(h <= 0) h += height;
menu->widgets[i].widget = XCreateSimpleWindow(display
, menu->widgets[popup_menu_parent].widget
, x, y, w, h, 0, black, black);
if(themes->popup_menu[i].w <= 0) w = XWidthOfScreen(screen);
if(themes->popup_menu[i].h <= 0) h = XWidthOfScreen(screen);
for(int j = 0; j <= inactive; j++) {
if(themes->popup_menu[i].state_p[j]) {
menu->widgets[i].state[j] = XCreateSimpleWindow(display, menu->widgets[i].widget
, 0, 0, w, h, 0, black, black);
XSetWindowBackgroundPixmap(display, menu->widgets[i].state[j]
, themes->popup_menu[i].state_p[j]);
if(j == normal) XMapWindow(display, menu->widgets[i].state[j]);
}
}
XMapWindow(display, menu->widgets[i].widget);
}
set_attributes.override_redirect = True;
XChangeWindowAttributes(display, menu->widgets[popup_menu_parent].widget, CWOverrideRedirect, &set_attributes);
// XMapWindow(display, menu->widgets[popup_menu_parent].widget);
XFlush(display);
}
示例15: XbrGfxLoadBitmap
Pixmap XbrGfxLoadBitmap(Widget w, char *bits, int width, int height, int inherit)
{
XGCValues vals;
Pixmap pixmap;
GC gc;
Display *display = XtDisplay(w);
Screen *screen = XtScreen(w);
Window root = RootWindowOfScreen(screen);
/* Get the foreground and background colours of the widget */
if(inherit) {
XtVaGetValues(w, XmNforeground, &vals.foreground, XmNbackground,
&vals.background, NULL);
} else {
vals.foreground = BlackPixelOfScreen(screen);
vals.background = WhitePixelOfScreen(screen);
}
/* Create a GC for drawing the pixmap */
gc = XCreateGC(display, root, GCForeground|GCBackground, &vals);
/* Change the bitmap to a pixmap */
pixmap = XbrGfxReadBitmap(display, screen, gc, bits, width, height);
/* Free GC we have finished with */
XFreeGC(display, gc);
/* Return the pixmap */
return(pixmap);
}