static int showpage(fz_context *ctx, pdf_document *doc, fz_output *out, int page) { pdf_obj *pageref; int failed = 0; fz_printf(ctx, out, "<page pagenum=\"%d\">\n", page); fz_try(ctx) { pageref = pdf_lookup_page_obj(ctx, doc, page-1); if (!pageref) fz_throw(ctx, FZ_ERROR_GENERIC, "cannot retrieve info from page %d", page); } fz_catch(ctx) { fz_printf(ctx, out, "Failed to gather information for page %d\n", page); failed = 1; } if (!failed) { failed |= showbox(ctx, out, pageref, "MediaBox", PDF_NAME_MediaBox); failed |= showbox(ctx, out, pageref, "CropBox", PDF_NAME_CropBox); failed |= showbox(ctx, out, pageref, "ArtBox", PDF_NAME_ArtBox); failed |= showbox(ctx, out, pageref, "BleedBox", PDF_NAME_BleedBox); failed |= showbox(ctx, out, pageref, "TrimBox", PDF_NAME_TrimBox); failed |= shownum(ctx, out, pageref, "Rotate", PDF_NAME_Rotate); failed |= shownum(ctx, out, pageref, "UserUnit", PDF_NAME_UserUnit); } fz_printf(ctx, out, "</page>\n"); return failed; }
void drawplayer(player& pl) { setcolor(YELLOW); //circle(px(pl), py(pl), 3); showbox(pl); showhead(pl); }
void JRCSInitThread::process() { MeshBundle<DefaultMesh>::PtrList::iterator iter; uint32_t index = 0; for(iter=inputs_.begin();iter!=inputs_.end();++iter) { QString msg; msg = msg.sprintf("JRCSInitThread::process(%u)",index); emit message(msg,0); MeshBundle<DefaultMesh>& mesh = **iter; seg_.compute(mesh.mesh_); // std::cerr<<"getting label"<<std::endl; seg_.getBBoxLabel(labels_[index]); // seg_.getPlaneLabel(labels_[index]); MeshBundle<DefaultMesh>::Ptr boxptr(new MeshBundle<DefaultMesh>); seg_.getObjectBox(boxptr->mesh_); emit showbox(index,boxptr); mesh.custom_color_.fromlabel(labels_[index]); ++ index; } emit finished(); }
void main() { if(InitGraphics() == -1) return; initialisedata(); clearviewport(); rectangle(0,0,(maxx+1)*width+2, (maxy+1)*width+2); sx = (maxx+1)*width+6; sy = (maxy+1)*width+2; int loop = 0; while(!endgame) { loop++; for (int i = 0; i < NUM_PLAYERS; i++) { drawplayer(plist[i]); } showscoreboard(); delay(DELAY_INTERVAL); for (i = 0; i < NUM_PLAYERS; i++) { showbox(plist[i]); } if (kbhit()) { handlekeypress(); } if (endgame) break; // 1 to n is computer plaer, 0 is me for (i = 1; i < NUM_PLAYERS; i++) { decidemove(plist[i]); } for (i = 0; i < NUM_PLAYERS; i++) { adjustdir(plist[i]); moveit(plist[i]); } for (i = 0; i < NUM_PLAYERS; i++) { updatescore(plist[i]); if (plist[i].score >= WINNING_SCORE) { endgame = true; setfillstyle(1, BLUE); bar(200,120,439,300); outtextxy(250,200,"GAME OVER"); if (i == 0) { outtextxy(250,250,"YOU WIN"); } else { outtextxy(250,250,"YOU LOSE"); } showscoreboard(); char tr = getch(); } } } }
/*struct txtfld { int x; int y; int r; char *feild_name; }; struct txtfld t1;*/ void draw_txtbox(int leftx,int lefty,int rightx,char *fname) { int pos=0,insflg=0,tempflg=0; int i=-1,row,j=0,temp,col,maxsize; char c[1]; ch[0]=(char*)calloc(sizeof(char),20); row=lefty+7; col=leftx+5; maxsize=(rightx-leftx)/8 - 2; settextstyle(0,0,1); setcolor(15); // outtextxy(leftx,lefty-10,fname); showbox(leftx,lefty,rightx,fname); do { i=i+1; cursor(ch[j],col,row,pos); ch[j][i]=temp=bioskey(0); // printf("%c",ch[j][i]); ch[j][i+1]='\0'; if(temp == HOME||temp == END||temp ==LEFT||temp ==RIGHT||temp ==DEL||temp ==INSERT) { specialkey(ch[j],col,row,temp,&pos,&i,&insflg); continue; } if(ch[j][i]=='\x1B' || ch[j][i]=='\x0D') //escape { ch[j][i]='\0'; // hidebox(leftx,lefty,rightx); // hidebox(leftx,lefty,rightx,fname); break; } if(ch[j][i]!='\t' && ch[j][i]!='\x1B' && ch[j][i]!='\b') { if(i==maxsize) { ch[j][i]='\0'; i=i-1; continue; } keycheck(ch[j],&i,5,&tempflg); if(tempflg==1) { tempflg=0; continue; } } if(ch[j][i]=='.') //.(full stop) { ch[j][i]='.'; } setcolor(15); outtextxy((strlen(ch[j])-1)*8+col,row+2,"_"); setcolor(0); if(ch[j][i]=='\b') //backspace { backspace(ch[j],&i,pos,row,col); continue; } if(insflg%2==1) { insert(ch[j],&i,pos,row,col); continue; } // if(ch[j][i]!='\b') // { if(pos>0) { setfillstyle(1,15); bar(strlen(ch[j])*8+col-pos*8-8,row,strlen(ch[j])*8+col-pos*8-1,row+7); ch[j][i-pos]=ch[j][i]; ch[j][i]='\x0'; sprintf(c,"%c",ch[j][i-pos]); setcolor(0); outtextxy(strlen(ch[j])*8+col-pos*8,row,c); pos=pos-1; i=i-1; } else { sprintf(c,"%c",ch[j][i]); setcolor(0); outtextxy(strlen(ch[j])*8+col-8-pos*8,row,c); } // } }while(ch[j][i]!='\x1B' || ch[j][i]!='\x0D'); }