//-------------------------------------------- void drawMainWindow(Window win, GC gc, XFontStruct *fontInfo, unsigned int winWidth, unsigned int winHeight) { char text[100] ; int len; int textWidth; int fontHeight; if (UnikeyOn) sprintf(text, "%s: %s", UkMethodList[UkActiveMethod], UkModeList[UkActiveMode]); else strcpy(text, UkOffText); XSetForeground(display, gc, WhitePixel(display, ScreenNum)); XFillRectangle(display, win, gc, 0, 0, winWidth, winHeight); // XSetLineAttributes(display, gc, 2, LineSolid, CapNotLast, JoinMiter); XSetForeground(display, gc, BlueXColor); //BlackPixel(display, ScreenNum)); XDrawRectangle(display, win, gc, 0, 0, winWidth-1, winHeight-1); XDrawRectangle(display, win, gc, 3, 3, winWidth-7, winHeight-7); XSetForeground(display, gc, RedXColor); len = strlen(text); textWidth = XTextWidth(fontInfo, text, len); fontHeight = fontInfo->ascent + fontInfo->descent; /* output text, centered on each line */ XDrawString(display, win, gc, (winWidth - textWidth)/2, (winHeight+fontHeight)/2-2, text, len); }
void paint_combobox(GUI* g,Window win,WIDGET* w) { int i; struct combobox_data_t* data=w->widget_data; if(w->width==0){ for(i=0;i<data->max_length;i++) w->string[i]=' '; w->string[i]='\0'; w->width=XTextWidth(g->font,w->string,strlen(w->string))+20; w->height=g->font->ascent*2; for(i=0;i<data->max_length;i++) w->string[i]='\0'; } XSetForeground(g->dsp,g->draw,g->whiteColor); XFillRectangle(g->dsp,win,g->draw,w->x,w->y,w->width-20,w->height); XSetForeground(g->dsp,g->draw,0x00AAAAAA); XFillRectangle(g->dsp,win,g->draw,w->width-10,w->y,20,w->height); XSetForeground(g->dsp,g->draw,g->blackColor); XDrawRectangle(g->dsp,win,g->draw,w->x,w->y,w->width-20,w->height); XDrawRectangle(g->dsp,win,g->draw,w->width-10,w->y,20,w->height); //Draw Arrow XDrawLine(g->dsp,win,g->draw,w->width-6,w->y+4,w->width+6,w->y+4); XDrawLine(g->dsp,win,g->draw,w->width-6,w->y+4,w->width,w->y+18); XDrawLine(g->dsp,win,g->draw,w->width,w->y+18,w->width+6,w->y+4); }
/*++++++++++++++++++++++++ draw_remote_history() ++++++++++++++++++++++++*/ void draw_remote_history(int pos, int type, int x, int y) { int i, x_offset, y_offset; XGCValues gc_values; x_offset = x + x_offset_log_history; y_offset = y + SPACE_ABOVE_LINE; for (i = (MAX_LOG_HISTORY - his_log_set); i < MAX_LOG_HISTORY; i++) { gc_values.foreground = color_pool[(int)connect_data[pos].log_history[type][i]]; XChangeGC(display, color_gc, GCForeground, &gc_values); XFillRectangle(display, line_window, color_gc, x_offset, y_offset, bar_thickness_3, bar_thickness_3); XDrawRectangle(display, line_window, default_bg_gc, x_offset, y_offset, bar_thickness_3, bar_thickness_3); XFillRectangle(display, line_pixmap, color_gc, x_offset, y_offset, bar_thickness_3, bar_thickness_3); XDrawRectangle(display, line_pixmap, default_bg_gc, x_offset, y_offset, bar_thickness_3, bar_thickness_3); x_offset += bar_thickness_3; } return; }
static inline bool display_X11_process_events(GC gc, int start_x, int start_y, struct Area *area) { XEvent ev; while (XPending(disp)) { XNextEvent(disp, &ev); switch (ev.type) { case MotionNotify: XDrawRectangle(disp, scr->root, gc, area->x, area->y, area->width, area->height); area->x = min(start_x, ev.xmotion.x); area->y = min(start_y, ev.xmotion.y); area->width = abs(ev.xmotion.x - start_x); area->height = abs(ev.xmotion.y - start_y); XDrawRectangle(disp, scr->root, gc, area->x, area->y, area->width, area->height); XFlush(disp); break; case ButtonRelease: if (area->width > 5 || area->height > 5) { XDrawRectangle(disp, scr->root, gc, area->x, area->y, area->width, area->height); area->x += 1; area->y += 1; area->width -= 2; area->height -= 2; return false; } } } return true; }
void draw_score_board(PANE_TYPE which_pane) { int i, y; const char *string; PANE pane = all_panes[which_pane]; XSetForeground(disp, gc, cm_pixels[bkgr_colour]); XFillRectangle(disp, pane, gc, ScoreX-5, ScoreY-5, ScoreWidth+10, ScoreHeight+10); XSetForeground(disp, gc, cm_pixels[score_colour]); XDrawRectangle(disp, pane, gc, ScoreX-5, ScoreY-5, ScoreWidth+10, ScoreHeight+10); XDrawRectangle(disp, pane, gc, ScoreX-3, ScoreY-3, ScoreWidth+6, ScoreHeight+6); if (ConsFont == 0) { XSetBackground(disp, gc, cm_pixels[bkgr_colour]); XSetFont(disp, gc, FontId[FT_FIXED]); } for (i=0; i< ScoreLines; i++) { string = ScoreLineText[i]; y = ScoreLineY[i]; if (ConsFont == 0) XDrawImageString (disp, pane, gc, ScoreLineX, y, string, strlen(string)); else show_shadow_text(which_pane, FT_FIXED, string, ScoreLineX, y-FixedFontAscent, 1, 1, 0, 0, score_colour, bkgr_colour, ST_NO_STIPPLE); } flush_pane(which_pane, ScoreX-5, ScoreY-5, ScoreWidth+10, ScoreHeight+10); }
static void update_sel_disp(Select_Info *reg) { int i,j,x,y; /* clear all the selection marks */ for (i = 0;i<reg->num_col;i++) { x = i*reg->hor_size+gsr_boarh; for (j = 0;j<reg->num_row && (j+i*reg->num_row)<reg->num_wind;j++) { /* find upper right corner of rectangle */ /* draw blanking rectangle there */ y = j*reg->ver_size+gsr_boarv; XDrawRectangle(theDisp,reg->wind,glob_colour_gc[num_glob_gc],x+1,y+1,reg->hor_size-1,reg->ver_size-1); } } /* draw the selection marks */ for (i = 0;i<reg->num_sel;i++) { int s; /* find upper right corner of rectangle */ /* draw selection rectangle there */ s = update_glob_line_at(i); x = (int)floor(reg->sel_reg[i]/reg->num_row); x = x*reg->hor_size+gsr_boarh; y = (int)reg->sel_reg[i]%reg->num_row; y = y*reg->ver_size+gsr_boarv; XDrawRectangle(theDisp,reg->wind,glob_colour_gc[s],x+1,y+1,reg->hor_size-1,reg->ver_size-1); } if (reg->num_sel>num_glob_gc) {reset_glob_line_at();} XFlush(theDisp); }
void paint_titled_border(GUI* g,Window win, WIDGET* w) { int width; struct titled_border_data_t* data=w->widget_data; width=XTextWidth(g->font,w->string,strlen(w->string))+2; XSetForeground(g->dsp,g->draw,g->bgColor); XFillRectangle(g->dsp,win,g->draw,w->x,w->y-g->font->ascent/2,w->width,g->font->ascent); if((w->status&STATUS_VISIBLE)==0){ XSetLineAttributes(g->dsp,g->draw,data->thickness,LineSolid,CapButt,JoinMiter); XDrawRectangle(g->dsp,win,g->draw,w->x,w->y,w->width,w->height); XSetLineAttributes(g->dsp,g->draw,0,LineSolid,CapButt,JoinMiter); return; } if(data->border_color>0) XSetForeground(g->dsp,g->draw,data->border_color); else XSetForeground(g->dsp,g->draw,g->blackColor); XSetLineAttributes(g->dsp,g->draw,data->thickness,LineSolid,CapButt,JoinMiter); XDrawRectangle(g->dsp,win,g->draw,w->x,w->y,w->width,w->height); XSetLineAttributes(g->dsp,g->draw,0,LineSolid,CapButt,JoinMiter); XSetForeground(g->dsp,g->draw,g->bgColor); XFillRectangle(g->dsp,win,g->draw,w->x+5,w->y-data->thickness,width,data->thickness*2); if(data->text_color>0){ XSetForeground(g->dsp,g->text,data->text_color); XDrawString(g->dsp,win,g->text,w->x+6,w->y+(g->font->ascent/2),(char*)w->string,strlen((char*)w->string)); XSetForeground(g->dsp,g->text,g->blackColor); } else { XDrawString(g->dsp,win,g->text,w->x+6,w->y+(g->font->ascent/2),(char*)w->string,strlen((char*)w->string)); } }
void aux_XDrawRectangle(GUI *gui, int x1, int y1, int x2, int y2) { X11Stuff *xstuff = gui->xstuff; XDrawRectangle(xstuff->disp, xstuff->xwin, gcxor, x1, y1, x2, y2); if (xstuff->bufpixmap != (Pixmap) NULL) { XDrawRectangle(xstuff->disp, xstuff->bufpixmap, gcxor, x1, y1, x2, y2); } }
//COLUMN METHODS void Column::paint(XInfo& info){ int currentHeight = y; if(missiles != NULL && !(missiles->empty())){ //check to see if it's time to fire off a missile if(((y - blockey->height) - missiles->back()->getY()) > (info.missileFrequency * blockey->height)){ fireMissile(); } std::list<Missile*>::iterator missile = missiles->begin(); //silo and silo tip positions int siloX = x + (blockey->width / 3); int siloY = y - (3 * (blockey->height / 4)); int siloTipX = siloX + (blockey->width / 9); int siloTipY = y - blockey->height; //loop through and draw all missiles currently deployed for(int i = 0; i < missiles->size(); i++, missile++){ (*missile)->paint(info); } //draw the silo XDrawRectangle(info.display, info.pixie, info.gc, siloX, siloY, blockey->width / 3, 3 * (blockey->height / 4)); XDrawRectangle(info.display, info.pixie, info.gc, siloTipX, siloTipY, blockey->width / 9, blockey->height / 4); } //draw the column for(int i = 0; i < numberOfBlocks; i++){ XDrawRectangle(info.display, info.pixie, info.gc, x, currentHeight, blockey->width, blockey->height); currentHeight += blockey->height; } if(orbo != NULL){ //draw the orb orbo->paint(info); } if(killTrophy != NULL){ killTrophy->paint(info); } }
void drawDecorations(Display *display, Drawable window, GC gc, const char *title, XWindowAttributes attr) { if (!white || !black) { white = XWhitePixel(display, DefaultScreen(display)); black = XBlackPixel(display, DefaultScreen(display)); } // Draw bounding box whiteOutTitleBar(display, window, gc, attr); XSetForeground(display, gc, black); XDrawRectangle(display, window, gc, RECT_TITLEBAR); // Draw texture for (int y = TITLEBAR_TEXTURE_START; y < TITLEBAR_TEXTURE_START + TITLEBAR_CONTROL_SIZE; y += TITLEBAR_TEXTURE_SPACE) { XDrawLine(display, window, gc, 2, y, attr.width - 4, y); } // White out areas for buttons and title XSetForeground(display, gc, white); // Subwindow box XFillRectangle(display, window, gc, 1, TITLEBAR_THICKNESS, attr.width - 3, attr.height - (TITLEBAR_THICKNESS + 3)); // Draw buttons and title XSetForeground(display, gc, black); // Subwindow box XDrawRectangle(display, window, gc, 0, TITLEBAR_THICKNESS - 1, attr.width - 2, attr.height - 20); // Shadow XDrawLine(display, window, gc, 1, attr.height - 1, attr.width, attr.height - 1); XDrawLine(display, window, gc, attr.width - 1, attr.height - 1, attr.width - 1, 1); // White out the shadow ends XSetForeground(display, gc, white); XDrawPoint(display, window, gc, 0, attr.height - 1); XDrawPoint(display, window, gc, attr.width - 1, 0); XSetForeground(display, gc, black); // Draw Title drawTitle(display, window, gc, title, attr); // Draw Close Button drawCloseButton(display, window, gc, RECT_CLOSE_BTN); // Draw Maximize Button drawMaximizeButton(display, window, gc, RECT_MAX_BTN); #ifdef COLLAPSE_BUTTON_ENABLED // Draw Collapse Button drawCollapseButton(display, window, gc, RECT_COLLAPSE_BTN); #endif }
void drawCollapseButton(Display *display, Drawable window, GC gc, int x, int y, int w, int h) { whiteOutUnderButton(display, window, gc, x, y, w, h); // Draw Border XSetForeground(display, gc, black); XDrawRectangle(display, window, gc, x, y, w, h); XDrawRectangle(display, window, gc, x, y + w / 2 - 1, w, 2); }
void drawMaximizeButton(Display *display, Drawable window, GC gc, int x, int y, int w, int h) { whiteOutUnderButton(display, window, gc, x, y, w, h); // Draw Border XSetForeground(display, gc, black); XDrawRectangle(display, window, gc, x, y, w, h); // Draw Inside XDrawRectangle(display, window, gc, x, y, w / 2, h / 2); }
static void do_draw_boxy(EX_Drawable dr, GC gc, int a, int b, int c, int d, int bl, int br, int bt, int bb) { if (c < 3) c = 3; if (d < 3) d = 3; XDrawRectangle(disp, dr, gc, a, b, c + bl + br - 1, d + bt + bb - 1); XDrawRectangle(disp, dr, gc, a + bl + 1, b + bt + 1, c - 3, d - 3); }
void square(XEvent ev,Window *layer_expose,Window *layer,Window *mask,int num){ int xs,ys,xe,ye; XShapeCombineMask( dis, layer[num], ShapeClip, 0, 0, None, ShapeSet);//いったんマスクを解除 XShapeCombineMask( dis, layer[num], ShapeBounding, 0, 0, None, ShapeSet); XCopyArea( dis, layer[num], copy_pix[0], gc, 0, 0, CANV_WIDTH, CANV_HEIGHT, 0, 0 ); xs=ev.xbutton.x; ys=ev.xbutton.y; while( !(ev.type == ButtonRelease && ev.xbutton.button == 1) ){ if(ev.type == MotionNotify){ XCopyArea( dis, copy_pix[0], copy_pix[1], gc, 0, 0, CANV_WIDTH, CANV_HEIGHT, 0, 0 ); xe=ev.xbutton.x; ye=ev.xbutton.y; if(sub_state==0){ XDrawRectangle(dis, copy_pix[1], gc, (xs<xe)?xs:xe, (ys<ye)?ys:ye, abs(xe-xs), abs(ye-ys)); }else{ XFillRectangle(dis, copy_pix[1], gc, (xs<xe)?xs:xe, (ys<ye)?ys:ye, abs(xe-xs), abs(ye-ys)); } XCopyArea( dis, copy_pix[1], layer[num], gc, 0, 0, CANV_WIDTH, CANV_HEIGHT, 0, 0 ); XFlush(dis); } XNextEvent( dis, &ev ); } if(sub_state==0){ XDrawRectangle(dis, mask[num], mask_gc, (xs<xe)?xs:xe, (ys<ye)?ys:ye, abs(xe-xs), abs(ye-ys)); XDrawRectangle(dis, layer_expose[num], gc, (xs<xe)?xs:xe, (ys<ye)?ys:ye, abs(xe-xs), abs(ye-ys)); }else{ XFillRectangle(dis, mask[num], mask_gc, (xs<xe)?xs:xe, (ys<ye)?ys:ye, abs(xe-xs), abs(ye-ys)); XFillRectangle(dis, layer_expose[num], gc, (xs<xe)?xs:xe, (ys<ye)?ys:ye, abs(xe-xs), abs(ye-ys)); } XShapeCombineMask( dis, layer[num], ShapeBounding, 0, 0, mask[num], ShapeSet); XShapeCombineMask( dis, layer[num], ShapeClip, 0, 0, mask[num], ShapeSet); addHistory(layer_expose,mask,num);//履歴に追加 }
void DrawViewSeg(int x1, int y_1, int x2, int y2) { if (x1 < 0) { DrawViewSeg(0, y_1, x2 + x1, y2); DrawViewSeg(smlmap_width + x1, y_1, (0 - x1), y2); return; } if (y_1 < 0) { DrawViewSeg(x1, 0, x2, y2 + y_1); DrawViewSeg(x1, smlmap_height + y_1, x2, (0 - y_1)); return; } if ((x1 + x2) > smlmap_width) { DrawViewSeg(x1, y_1, smlmap_width - x1, y2); DrawViewSeg(0, y_1, x1 + x2 - smlmap_width, y2); return; } if ((y_1 + y2) > smlmap_height) { DrawViewSeg(x1, y_1, x2, smlmap_height - y_1); DrawViewSeg(x1, 0, x2, y_1 + y2 - smlmap_height); return; } XDrawRectangle(display, mapwin, xorgc, x1 + smlmap_x, y_1 + smlmap_y + TOOLSHEIGHT - TOOLSWIDTH, x2, y2); }
void UpdateSquare(int x, int y) { if(x%2 != y%2) { if(square[y][x].state) { SetColor(square[y][x].col); XFillArc(dpy,XtWindow(square[y][x].widget),gc, circle1,circle1,circle2,circle2,0,360*64); SetColor(Black); XDrawArc(dpy,XtWindow(square[y][x].widget),gc, circle1,circle1,circle2,circle2,0,360*64); if(square[y][x].state == King) { SetColor(square[y][x].col); XFillArc(dpy,XtWindow(square[y][x].widget),gc, circle1+4,circle1+4,circle2,circle2,0,360*64); SetColor(Black); XDrawArc(dpy,XtWindow(square[y][x].widget),gc, circle1+4,circle1+4,circle2,circle2,0,360*64); } } else { SetColor(Green); XFillArc(dpy,XtWindow(square[y][x].widget),gc, circle1-2,circle1-2,circle2+8,circle2+8,0,360*64); } SetColor(square[y][x].hilite); XDrawRectangle(dpy,XtWindow(square[y][x].widget),gc,0,0,squaresize,squaresize); } XSync(dpy,False); }
void Painter::specialScreen(XInfo& xinfo, screenType special){ //clear screen XDrawRectangle(xinfo.display, xinfo.window, xinfo.reverseGC, 0, 0, xinfo.pixWidth, xinfo.pixHeight); if(special == GAMEOVER){ //display game over screen XFillRectangle(xinfo.display, xinfo.window, xinfo.gc, xinfo.windowWidth / 4, xinfo.windowHeight / 4, xinfo.windowWidth / 2, xinfo.windowHeight / 6); XDrawImageString(xinfo.display, xinfo.window, xinfo.gc, xinfo.windowWidth / 4, xinfo.windowHeight / 4, "GAME OVER", 9); std::string gameOverText("The terrorists won. North America was destroyed."); //get point total std::string stringPoints; int points = xinfo.pointTotal; std::stringstream ss(stringPoints); ss << points; ss >> stringPoints; std::string pointText("Point Total: "); pointText.append(stringPoints); XDrawImageString(xinfo.display, xinfo.window, xinfo.reverseGC, xinfo.windowWidth / 4, xinfo.windowHeight / 3, gameOverText.c_str(), gameOverText.size()); XDrawImageString(xinfo.display, xinfo.window, xinfo.reverseGC, xinfo.windowWidth / 4, (xinfo.windowHeight / 3) + 15, pointText.c_str(), pointText.size()); XFlush(xinfo.display); sleep(5); exit(0); }
int HandleQuitButton(XEvent* event) { int must_exit = 0; int width, center; switch(event->type) { case Expose: case LeaveNotify: XClearWindow(dis, button_quit); width = XTextWidth(font_info, quitLabel, strlen(quitLabel)); center = (BUTTON_WIDTH - width) / 2; XDrawString(dis, button_quit, gc, center, font_info->ascent/*BUTTON_HEIGHT / 2*/, quitLabel, strlen(quitLabel)); XFlush(dis); break; case EnterNotify: case ButtonPress: XDrawRectangle(dis, button_quit, gc, 1, 1, BUTTON_WIDTH - 3, BUTTON_HEIGHT - 3); break; case ButtonRelease: must_exit = 1; break; default: break; } return must_exit; }
static void draw_boxes (state *st) { int i; for (i = 0; i < st->nboxes; i++) { box *b = &st->boxes[i]; if (b->flags & UNDEAD) continue; if (! (b->flags & CHANGED)) continue; b->flags &= ~CHANGED; if (!st->growing_p) { /* When shrinking, black out an area outside of the border before re-drawing the box. */ int margin = st->inc + st->border_size; XSetForeground (st->dpy, st->gc, st->bg_color); if (st->circles_p) XFillArc (st->dpy, st->window, st->gc, b->x - margin, b->y - margin, b->w + (margin*2), b->h + (margin*2), 0, 360*64); else XFillRectangle (st->dpy, st->window, st->gc, b->x - margin, b->y - margin, b->w + (margin*2), b->h + (margin*2)); if (b->w <= 0 || b->h <= 0) b->flags |= UNDEAD; /* really very dead now */ } if (b->w <= 0 || b->h <= 0) continue; XSetForeground (st->dpy, st->gc, b->fill_color); if (st->circles_p) XFillArc (st->dpy, st->window, st->gc, b->x, b->y, b->w, b->h, 0, 360*64); else XFillRectangle (st->dpy, st->window, st->gc, b->x, b->y, b->w, b->h); if (st->border_size > 0) { unsigned int bd = (st->image ? st->fg_color : st->colors [(b->fill_color + st->ncolors/2) % st->ncolors].pixel); XSetForeground (st->dpy, st->gc, bd); if (st->circles_p) XDrawArc (st->dpy, st->window, st->gc, b->x, b->y, b->w, b->h, 0, 360*64); else XDrawRectangle (st->dpy, st->window, st->gc, b->x, b->y, b->w, b->h); } } }
static void BorderElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { BorderElement *bd = elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, bd->borderObj); XColor *borderColor = Tk_GetColorFromObj(tkwin, bd->borderColorObj); int borderWidth = 2; int relief = TK_RELIEF_FLAT; int defaultState = TTK_BUTTON_DEFAULT_DISABLED; /* * Get option values. */ Tcl_GetIntFromObj(NULL, bd->borderWidthObj, &borderWidth); Tk_GetReliefFromObj(NULL, bd->reliefObj, &relief); Ttk_GetButtonDefaultStateFromObj(NULL, bd->defaultStateObj, &defaultState); if (defaultState == TTK_BUTTON_DEFAULT_ACTIVE) { GC gc = Tk_GCForColor(borderColor, d); XDrawRectangle(Tk_Display(tkwin), d, gc, b.x, b.y, b.width-1, b.height-1); } if (defaultState != TTK_BUTTON_DEFAULT_DISABLED) { /* Space for default ring: */ b = Ttk_PadBox(b, Ttk_UniformPadding(1)); } DrawBorder(tkwin, d, border, borderColor, b, borderWidth, relief); }
static void ImageDisplay( ClientData clientData, /* Pointer to TImageInstance for image. */ Display *display, /* Display to use for drawing. */ Drawable drawable, /* Where to redraw image. */ int imageX, int imageY, /* Origin of area to redraw, relative to * origin of image. */ int width, int height, /* Dimensions of area to redraw. */ int drawableX, int drawableY) /* Coordinates in drawable corresponding to * imageX and imageY. */ { TImageInstance *instPtr = clientData; char buffer[200 + TCL_INTEGER_SPACE * 6]; sprintf(buffer, "%s display %d %d %d %d %d %d", instPtr->masterPtr->imageName, imageX, imageY, width, height, drawableX, drawableY); Tcl_SetVar(instPtr->masterPtr->interp, instPtr->masterPtr->varName, buffer, TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT); if (width > (instPtr->masterPtr->width - imageX)) { width = instPtr->masterPtr->width - imageX; } if (height > (instPtr->masterPtr->height - imageY)) { height = instPtr->masterPtr->height - imageY; } XDrawRectangle(display, drawable, instPtr->gc, drawableX, drawableY, (unsigned) (width-1), (unsigned) (height-1)); XDrawLine(display, drawable, instPtr->gc, drawableX, drawableY, (int) (drawableX + width - 1), (int) (drawableY + height - 1)); XDrawLine(display, drawable, instPtr->gc, drawableX, (int) (drawableY + height - 1), (int) (drawableX + width - 1), drawableY); }
void GFX_Box(struct Tracker_Windows *tvisual,int color,int x,int y,int x2,int y2){ GC gc=tvisual->os_visual->gcs[color]; Window window=tvisual->os_visual->window; XDrawRectangle(x11_display, window, gc, x, y, x2-x, y2-y); F }
static void TreeitemIndicatorDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { TreeitemIndicator *indicator = elementRecord; XColor *color = Tk_GetColorFromObj(tkwin, indicator->colorObj); GC gc = Tk_GCForColor(color, d); Ttk_Padding padding = Ttk_UniformPadding(0); int w = WIN32_XDRAWLINE_HACK; int cx, cy; if (state & TTK_STATE_LEAF) { /* don't draw anything ... */ return; } Ttk_GetPaddingFromObj(NULL,tkwin,indicator->marginObj,&padding); b = Ttk_PadBox(b, padding); XDrawRectangle(Tk_Display(tkwin), d, gc, b.x, b.y, b.width - 1, b.height - 1); cx = b.x + (b.width - 1) / 2; cy = b.y + (b.height - 1) / 2; XDrawLine(Tk_Display(tkwin), d, gc, b.x+2, cy, b.x+b.width-3+w, cy); if (!(state & TTK_STATE_OPEN)) { /* turn '-' into a '+' */ XDrawLine(Tk_Display(tkwin), d, gc, cx, b.y+2, cx, b.y+b.height-3+w); } }
void GFX_P_Box(struct Tracker_Windows *tvisual,int color,int x,int y,int x2,int y2){ GC gc=tvisual->os_visual->gcs[X11_GetLegalColor(color)]; Pixmap pixmap=tvisual->os_visual->pixmap; XDrawRectangle(x11_display, pixmap, gc, x, y, x2-x, y2-y); F }
/* * Draws the saucer section of the spaceship. */ void Spaceship::drawSaucer(XPoint ref, int shipw, int shiph, GC gc, Display *display, Pixmap &buffer) { palette->setColor(ColorHandler::LIGHT_GREY, gc); XFillRectangle(display, buffer, gc, ref.x, ref.y, (shipw/2), (shiph/10)); palette->setColor(ColorHandler::GREY, gc); XDrawRectangle(display, buffer, gc, ref.x, ref.y, (shipw/2), (shiph/10)); XPoint points[4] = { ref, {ref.x+shipw/6, ref.y-shiph/12}, {ref.x+shipw/6+shipw/7, ref.y-shiph/12}, {ref.x+shipw/2,ref.y} }; palette->setColor(ColorHandler::LIGHT_GREY, gc); XFillPolygon(display, buffer, gc, points, 4, Convex, CoordModeOrigin); palette->setColor(ColorHandler::GREY, gc); XDrawLines(display, buffer, gc, points, 4, CoordModeOrigin); XPoint bPoints[5] = { {ref.x, ref.y+shiph/10}, {ref.x+shipw/6, ref.y+shiph/10+shiph/11}, {ref.x+shipw/6+shipw/4, ref.y+shiph/10+shiph/11}, {ref.x+shipw/2, ref.y+shiph/10}, {ref.x, ref.y+shiph/10} }; palette->setColor(ColorHandler::LIGHT_GREY, gc); XFillPolygon(display, buffer, gc, bPoints, 5, Convex, CoordModeOrigin); palette->setColor(ColorHandler::GREY, gc); XDrawLines(display, buffer, gc, bPoints, 5, CoordModeOrigin); }
void draw() { XClearArea(dis, win, 0, 0, 0, 0, False); XDrawRectangle(dis, win, gc, x, 50, 50, 50); XFlush(dis); }
void redraw() { XClearWindow(display, window); XSetForeground(display,gc,chartreuse); //XDrawArc(display,window,gc,45,1, 17,17,0,23040); XDrawRectangle(display, window, gc, 10, 10, 100, 100); };
void XuiDrawRect(int x, int y, enum rect_type_t type) { GC gc; int x0, y0; switch (type) { case TYPE_BLOCK: gc = Blockgc; break; case TYPE_FULL: gc = Fullgc; break; case TYPE_EMPTY: gc = Emptygc; break; default: fatal("unknown rect type\n"); break; } x0 = X0 + Rectw * x; y0 = Y0 + Rectw * y; XDrawRectangle(Dsp, Win, Linegc, x0, y0, Rectw, Rectw); #ifdef VIEW3D XFillRectangle(Dsp, Win, gc, x0 + Border, y0 + Border, Rectw - 2 * Border, Rectw - 2 * Border); #else XFillRectangle(Dsp, Win, gc, x0 + Border, y0 + Border, Rectw - Border, Rectw - Border); #endif XFlush(Dsp); }
void do_draw_technical(EX_Drawable dr, GC gc, int a, int b, int c, int d, int bl, int br, int bt, int bb) { if (!font) font = XLoadFont(disp, "-*-helvetica-medium-r-*-*-10-*-*-*-*-*-*-*"); XSetFont(disp, gc, font); if (c < 3) c = 3; if (d < 3) d = 3; draw_h_arrow(dr, gc, a + bl, a + bl + c - 1, b + bt + d - 16); draw_h_arrow(dr, gc, 0, a - 1, b + bt + (d / 2)); draw_h_arrow(dr, gc, a + c + bl + br, WinGetW(VROOT) - 1, b + bt + (d / 2)); draw_v_arrow(dr, gc, b + bt, b + bt + d - 1, a + bl + 16); draw_v_arrow(dr, gc, 0, b - 1, a + bl + (c / 2)); draw_v_arrow(dr, gc, b + d + bt + bb, WinGetH(VROOT) - 1, a + bl + (c / 2)); XDrawLine(disp, dr, gc, a, 0, a, WinGetH(VROOT)); XDrawLine(disp, dr, gc, a + c + bl + br - 1, 0, a + c + bl + br - 1, WinGetH(VROOT)); XDrawLine(disp, dr, gc, 0, b, WinGetW(VROOT), b); XDrawLine(disp, dr, gc, 0, b + d + bt + bb - 1, WinGetW(VROOT), b + d + bt + bb - 1); XDrawRectangle(disp, dr, gc, a + bl + 1, b + bt + 1, c - 3, d - 3); }
void drawrect (float x1, float y1, float x2, float y2) { /* (x1,y1) and (x2,y2) are diagonally opposed corners, in world coords. */ unsigned int width, height; int xw1, yw1, xw2, yw2, xl, yt; if (rect_off_screen(x1,y1,x2,y2)) return; if (disp_type == SCREEN) { /* translate to X Windows calling convention. */ xw1 = xcoord(x1); xw2 = xcoord(x2); yw1 = ycoord(y1); yw2 = ycoord(y2); xl = min(xw1,xw2); yt = min(yw1,yw2); width = abs (xw1-xw2); height = abs (yw1-yw2); XDrawRectangle(display, toplevel, gc, xl, yt, width, height); } else { fprintf(ps,"%.2f %.2f %.2f %.2f drawrect\n",XPOST(x1),YPOST(y1), XPOST(x2),YPOST(y2)); } }