grab(AtlasTesting) AtlasTesting::create(const g2d::Sizei &size) { grab(AtlasTesting) object = new AtlasTesting(size); return object; }
int menuhit(XButtonEvent *e, Menu *m) { XEvent ev; int i, n, cur, old, wide, high, status, drawn, warp; int x, y, dx, dy, xmax, ymax; ScreenInfo *s; if(font == 0) return -1; s = getscreen(e->root); if(s == 0 || e->window == s->menuwin) /* ugly event mangling */ return -1; dx = 0; for(n = 0; m->item[n]; n++){ wide = XTextWidth(font, m->item[n], strlen(m->item[n])) + 4; if(wide > dx) dx = wide; } wide = dx; cur = m->lasthit; if(cur >= n) cur = n - 1; high = font->ascent + font->descent + 1; dy = n*high; x = e->x - wide/2; y = e->y - cur*high - high/2; warp = 0; xmax = DisplayWidth(dpy, s->num); ymax = DisplayHeight(dpy, s->num); if(x < 0){ e->x -= x; x = 0; warp++; } if(x+wide >= xmax){ e->x -= x+wide-xmax; x = xmax-wide; warp++; } if(y < 0){ e->y -= y; y = 0; warp++; } if(y+dy >= ymax){ e->y -= y+dy-ymax; y = ymax-dy; warp++; } if(warp) setmouse(e->x, e->y, s); XMoveResizeWindow(dpy, s->menuwin, x, y, dx, dy); XSelectInput(dpy, s->menuwin, MenuMask); XMapRaised(dpy, s->menuwin); status = grab(s->menuwin, None, MenuGrabMask, None, e->time); if(status != GrabSuccess){ /* graberror("menuhit", status); */ XUnmapWindow(dpy, s->menuwin); return -1; } drawn = 0; for(;;){ XMaskEvent(dpy, MenuMask, &ev); switch (ev.type){ default: fprintf(stderr, "rio: menuhit: unknown ev.type %d\n", ev.type); break; case ButtonPress: break; case ButtonRelease: if(ev.xbutton.button != e->button) break; x = ev.xbutton.x; y = ev.xbutton.y; i = y/high; if(cur >= 0 && y >= cur*high-3 && y < (cur+1)*high+3) i = cur; if(x < 0 || x > wide || y < -3) i = -1; else if(i < 0 || i >= n) i = -1; else m->lasthit = i; if(!nobuttons(&ev.xbutton)) i = -1; ungrab(&ev.xbutton); XUnmapWindow(dpy, s->menuwin); return i; case MotionNotify: if(!drawn) break; x = ev.xbutton.x; y = ev.xbutton.y; old = cur; cur = y/high; if(old >= 0 && y >= old*high-3 && y < (old+1)*high+3) cur = old; if(x < 0 || x > wide || y < -3) cur = -1; else if(cur < 0 || cur >= n) cur = -1; if(cur == old) break; if(old >= 0 && old < n) drawstring(dpy, s, m, wide, high, old, 0); if(cur >= 0 && cur < n) drawstring(dpy, s, m, wide, high, cur, 1); break; case Expose: XClearWindow(dpy, s->menuwin); for(i = 0; i < n; i++) drawstring(dpy, s, m, wide, high, i, cur==i); drawn = 1; } } }
void DoExecuteCommand(struct Kommando *cmd) { switch(cmd->nummer) { case 201: Cmd_GoConf(); break; // ga(argument); case 210: Cmd_NextText(); break; case 211: Cmd_NextReply(); break; case 221: Cmd_NextConf(); break; case 222: GoConf(MAILBOX_CONFID); break; case 301: Cmd_Logout(); break; case 101: listmot(argument); break; case 102: Cmd_ListUsers(); break; case 103: listmed(); break; case 104: sendfile("NiKom:Texter/ListaKommandon.txt"); break; case 105: listratt(); break; case 106: listasenaste(); break; case 107: listnyheter(); break; case 108: listaarende(); break; case 109: listflagg(); break; case 111: listarea(); break; case 112: listnyckel(); break; case 113: listfiler(); break; case 114: listagrupper(); break; case 115: listgruppmed(); break; case 116: listabrev(); break; case 202: skriv(); break; case 203: Cmd_Reply(); break; case 204: personlig(); break; case 205: skickabrev(); break; case 206: igen(); break; case 207: atersekom(); break; case 208: medlem(argument); break; case 209: uttrad(argument); break; case 212: Cmd_Read(); break; case 213: endast(); break; case 214: Cmd_SkipReplies(); break; case 215: addratt(); break; case 216: subratt(); break; case 217: radtext(); break; case 218: skapmot(); break; case 219: radmot(); break; case 220: var(mote2); break; case 223: andmot(); break; case 224: radbrev(); break; case 225: rensatexter(); break; case 226: rensabrev(); break; case 227: gamlatexter(); break; case 228: gamlabrev(); break; case 229: dumpatext(); break; case 231: movetext(); break; case 232: motesstatus(); break; case 233: hoppaarende(); break; case 234: flyttagren(); break; case 235: Cmd_FootNote(); break; case 236: Cmd_Search(); break; case 237: Cmd_Like(); break; case 238: Cmd_Dislike(); break; case 302: sendfile("NiKom:Texter/Help.txt"); break; case 303: Cmd_ChangeUser(); break; case 304: slaav(); break; case 305: slapa(); break; case 306: tiden(); break; case 307: ropa(); break; case 308: Cmd_Status(); break; case 309: Cmd_DeleteUser(); break; case 310: vilka(); break; case 311: visainfo(); break; case 312: getconfig(); break; case 313: writeinfo(); break; case 314: sag(); break; case 315: skrivlapp(); break; case 316: radlapp(); break; case 317: grab(); break; case 318: skapagrupp(); break; case 319: andragrupp(); break; case 320: raderagrupp(); break; case 321: adderagruppmedlem(); break; case 322: subtraheragruppmedlem(); break; case 323: DisplayVersionInfo(); break; case 324: alias(); break; case 325: Cmd_ReLogin(); break; case 326: bytnodtyp(); break; case 327: bytteckenset(); break; case 328: SaveCurrentUser(inloggad, nodnr); break; case 329: Cmd_ChangeLanguage(); break; case 401: bytarea(); break; case 402: filinfo(); break; case 403: upload(); break; case 404: download(); break; case 405: Cmd_CreateArea(); break; case 406: radarea(); break; case 407: andraarea(); break; case 408: skapafil(); break; case 409: radfil(); break; case 410: andrafil(); break; case 411: lagrafil(); break; case 412: flyttafil(); break; case 413: sokfil(); break; case 414: filstatus(); break; case 415: typefil(); break; case 416: nyafiler(); break; case 417: validerafil(); break; default: if(cmd->nummer >= 500) { sendrexx(cmd->nummer); } else { LogEvent(SYSTEM_LOG, ERROR, "Trying to execute undefined command %d", cmd->nummer); DisplayInternalError(); } } }
screenshot::screenshot (QWidget *parent, OPTIONS *op, MISC *mi, NV_INT32 ct): QDialog (parent, (Qt::WindowFlags) Qt::WA_DeleteOnClose) { options = op; misc = mi; current_feature = ct; QString feature_id; feature_id.sprintf ("%05d", misc->feature[current_feature].record_number); setWindowTitle (tr ("pfmView Screenshot ") + feature_id); QVBoxLayout *vbox = new QVBoxLayout (this); vbox->setMargin (5); vbox->setSpacing (5); screenshotLabel = new QLabel; screenshotLabel->setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Expanding); screenshotLabel->setAlignment (Qt::AlignCenter); screenshotLabel->setMinimumSize (480, 240); vbox->addWidget (screenshotLabel, 1); QGroupBox *tbox = new QGroupBox (tr ("Time delay"), this); QHBoxLayout *tboxLayout = new QHBoxLayout; tbox->setLayout (tboxLayout); timeDelay = new QSpinBox (this); timeDelay->setRange (0, 60); timeDelay->setSingleStep (5); timeDelay->setToolTip (tr ("Screenshot time delay in seconds")); timeDelay->setWhatsThis (timeDelayText); timeDelay->setValue (options->screenshot_delay); tboxLayout->addWidget (timeDelay); vbox->addWidget (tbox); QHBoxLayout *actions = new QHBoxLayout (); vbox->addLayout (actions); QPushButton *bHelp = new QPushButton (this); bHelp->setIcon (QIcon (":/icons/contextHelp.xpm")); bHelp->setToolTip (tr ("Enter What's This mode for help")); connect (bHelp, SIGNAL (clicked ()), this, SLOT (slotHelp ())); actions->addWidget (bHelp); actions->addStretch (10); QPushButton *bNewScreenshot = new QPushButton (tr ("New Screenshot"), this); bNewScreenshot->setToolTip (tr ("Grab a new copy of the screen")); bNewScreenshot->setWhatsThis (newScreenshotText); connect (bNewScreenshot, SIGNAL (clicked ()), this, SLOT (slotNewScreenshot ())); actions->addWidget (bNewScreenshot); QPushButton *bSaveScreenshot = new QPushButton (tr ("Save Screenshot"), this); bSaveScreenshot->setToolTip (tr ("Save the screenshot to the BFD file")); bSaveScreenshot->setWhatsThis (saveScreenshotText); connect (bSaveScreenshot, SIGNAL (clicked ()), this, SLOT (slotSaveScreenshot ())); actions->addWidget (bSaveScreenshot); QPushButton *bQuit = new QPushButton (tr ("Quit"), this); bQuit->setToolTip (tr ("Discard screenshot and close this dialog")); bQuit->setWhatsThis (quitText); connect (bQuit, SIGNAL (clicked ()), this, SLOT (slotQuit ())); actions->addWidget (bQuit); // Wait the requested time and then grab the screen QTimer::singleShot (options->screenshot_delay * 1000, this, SLOT (grab ())); }
int main(int argc, char *argv[]){ initList(&idList); //printf("here\n"); struct stat info; char* inputData; inputData = malloc ((LINE_MAX* sizeof(char))+1); char* units; units = malloc ((LINE_MAX* sizeof(char))+1); char* mompid; mompid = malloc ((LINE_MAX* sizeof(char))+1); char* sleepTime; sleepTime = malloc ((LINE_MAX* sizeof(char))+1); //grab file names //int end = 0; //use fgetc to grab file names to output to stdout //make sure stdout doesn't have newlines and is separated by whitespace int e = 0; char oneLet; oneLet = fgetc(stdin); while (oneLet != EOF){ if (oneLet != '\n'){ inputData[e] = oneLet; e++; } else{ inputData[e] = ' '; e++; } oneLet = fgetc(stdin); } int j; int charCount = 0; for (j=0; inputData[j] != '\0'; j++){ charCount++; } //while loop to separate file names on white space int i = 0; long totalBytes = 0; while(i<charCount){ char* fileName; fileName = malloc ((LINE_MAX* sizeof(char))+1); sleepTime = getenv("TSTALL"); if (sleepTime != NULL){ int validInt = 1; //check if valid integer int c; int tStallCount = 0; //count chars in sleepTime for (c=0; sleepTime[c] !='\0'; c++){ tStallCount++; } if (!sleepTime){ validInt = 0; break; } //Check for non-digit chars in the rest of the stirng. //loop through sleep time to make sure each char is a digit int v = 0; while (v<tStallCount) { if (!isdigit(sleepTime[v])){ validInt = 0; break; } else v++; } //if it is a positive integer, sleep for tha tmany seconds if (validInt == 1){ //printf("here\n"); int sleepInt = atoi(sleepTime); sleep(sleepInt); } //dont sleep else{} } int q; for (q=0; !isspace(inputData[i]) && i<charCount; q++, i++){ fileName[q] = inputData[i]; } i++; //Calculate Times if (stat(fileName, &info) != 0) { } if (S_ISREG(info.st_mode)){ char* deviceID; deviceID = malloc ((LINE_MAX* sizeof(char))+1); sprintf(deviceID, "%d/%d/%ld", major(info.st_dev),minor(info.st_dev),info.st_ino); //calculate how long ago in days hte file was accessed long bytes = info.st_size; //create flag to know whether or not you should add to totalbytes int addFlag = 1; //run through linked list, make sure id's aren't the same //as the current file you're checking int g = 0; if (first!=1){ //pop off zero if (once == 0){ pop(&idList); once++;} while (g<idListSize){ if (strcmp(deviceID, grab(&idList))==0){ addFlag = 0; } push(&idList, grab(&idList)); pop(&idList); g++; } if (addFlag == 1){ totalBytes += bytes; } } //if its the first file add it to the bytes if(first==1){ totalBytes += bytes; } //push next file onto list, increase list size, first flag set to 0 push(&idList, deviceID); idListSize++; first = 0; } } //check the units to be outputted units = getenv("UNITS"); //set process ID to TMOM and grab it mompid = getenv("TMOM"); if (mompid != NULL){ int intpid = atoi(mompid); //if tmom is a positive int then send kill signal if (intpid>0){ //wait(); //fprintf(stderr, "here\n"); sleep(3); kill(intpid,SIGUSR1); } } if (units != NULL){ if((strcmp(units, "k") == 0) || (strcmp(units, "K") == 0)){ totalBytes = totalBytes/1000; printf("%ldkB\n", totalBytes); } else{ printf("%ld\n", totalBytes); } } else{ printf("%ld\n", totalBytes); } return 0; }
static THREAD_FUNC grab1(void *p) { grab(p, 1); return 0; }
void get01() { grab(10,zero,&zn); grab(19000,one,&on); printf("zero: %d\n",zn); printf("one: %d\n",on); }
void BuckyBalls::simulate(float deltaTime, const HandData* handData) { // First, update the grab behavior from the hand controllers for (size_t i = 0; i < handData->getNumPalms(); ++i) { PalmData palm = handData->getPalms()[i]; grab(palm, deltaTime); } // Look for collisions for (int i = 0; i < NUM_BBALLS; i++) { if (_bballElement[i] != 1) { // For 'interacting' elements, look for other balls to interact with for (int j = 0; j < NUM_BBALLS; j++) { if (i != j) { glm::vec3 diff = _bballPosition[i] - _bballPosition[j]; float diffLength = glm::length(diff); float penetration = diffLength - (_bballRadius[i] + _bballRadius[j]); if (diffLength != 0) { if (penetration < 0.f) { // Colliding - move away and transfer velocity _bballPosition[i] -= glm::normalize(diff) * penetration * COLLISION_BLEND_RATE; if (glm::dot(_bballVelocity[i], diff) < 0.f) { _bballVelocity[i] = _bballVelocity[i] * (1.f - COLLISION_BLEND_RATE) + glm::reflect(_bballVelocity[i], glm::normalize(diff)) * COLLISION_BLEND_RATE; } } else if ((penetration > EPSILON) && (penetration < BBALLS_ATTRACTION_DISTANCE)) { // If they get close to each other, bring them together with magnetic force _bballPosition[i] -= glm::normalize(diff) * penetration * ATTRACTION_BLEND_RATE; // Also make their velocities more similar _bballVelocity[i] = _bballVelocity[i] * (1.f - ATTRACTION_VELOCITY_BLEND_RATE) + _bballVelocity[j] * ATTRACTION_VELOCITY_BLEND_RATE; } } } } } } // Update position and bounce on walls const float BBALL_CONTINUOUS_DAMPING = 0.00f; const float BBALL_WALL_COLLISION_DAMPING = 0.2f; const float COLLISION_DECAY_RATE = 0.8f; for (int i = 0; i < NUM_BBALLS; i++) { _bballPosition[i] += _bballVelocity[i] * deltaTime; if (_bballElement[i] != 1) { _bballVelocity[i].y += GRAVITY_BBALLS * deltaTime; } _bballVelocity[i] -= _bballVelocity[i] * BBALL_CONTINUOUS_DAMPING * deltaTime; for (int j = 0; j < 3; j++) { if ((_bballPosition[i][j] + _bballRadius[i]) > (CORNER_BBALLS + RANGE_BBALLS)) { _bballPosition[i][j] = (CORNER_BBALLS + RANGE_BBALLS) - _bballRadius[i]; _bballVelocity[i][j] *= -(1.f - BBALL_WALL_COLLISION_DAMPING); } if ((_bballPosition[i][j] - _bballRadius[i]) < (CORNER_BBALLS -RANGE_BBALLS)) { _bballPosition[i][j] = (CORNER_BBALLS -RANGE_BBALLS) + _bballRadius[i]; _bballVelocity[i][j] *= -(1.f - BBALL_WALL_COLLISION_DAMPING); } } _bballColliding[i] *= COLLISION_DECAY_RATE; if (_bballColliding[i] < 0.1f) { _bballColliding[i] = 0.f; } } }
void proxy_copy(const char *tag, char *sequence, char *name, int myrights, int usinguid, struct backend *s) { char mytag[128]; struct d { char *idate; char *flags; unsigned int seqno, uid; struct d *next; } *head, *p, *q; int c; /* find out what the flags & internaldate for this message are */ proxy_gentag(mytag, sizeof(mytag)); prot_printf(backend_current->out, "%s %s %s (Flags Internaldate)\r\n", tag, usinguid ? "Uid Fetch" : "Fetch", sequence); head = (struct d *) xmalloc(sizeof(struct d)); head->flags = NULL; head->idate = NULL; head->seqno = head->uid = 0; head->next = NULL; p = head; /* read all the responses into the linked list */ for (/* each FETCH response */;;) { unsigned int seqno = 0, uidno = 0; char *flags = NULL, *idate = NULL; /* read a line */ c = prot_getc(backend_current->in); if (c != '*') break; c = prot_getc(backend_current->in); if (c != ' ') { /* protocol error */ c = EOF; break; } /* check for OK/NO/BAD/BYE response */ if (!isdigit(c = prot_getc(backend_current->in))) { prot_printf(imapd_out, "* %c", c); pipe_to_end_of_response(backend_current, 0); continue; } /* read seqno */ prot_ungetc(c, backend_current->in); c = getuint32(backend_current->in, &seqno); if (seqno == 0 || c != ' ') { /* we suck and won't handle this case */ c = EOF; break; } c = chomp(backend_current->in, "fetch ("); if (c == EOF) { c = chomp(backend_current->in, "exists\r"); if (c == '\n') { /* got EXISTS response */ prot_printf(imapd_out, "* %d EXISTS\r\n", seqno); continue; } } if (c == EOF) { /* XXX the "exists" check above will eat "ex" */ c = chomp(backend_current->in, "punge\r"); if (c == '\n') { /* got EXPUNGE response */ prot_printf(imapd_out, "* %d EXPUNGE\r\n", seqno); continue; } } if (c == EOF) { c = chomp(backend_current->in, "recent\r"); if (c == '\n') { /* got RECENT response */ prot_printf(imapd_out, "* %d RECENT\r\n", seqno); continue; } } /* huh, don't get this response */ if (c == EOF) break; for (/* each fetch item */;;) { /* looking at the first character in an item */ switch (c) { case 'f': case 'F': /* flags? */ c = chomp(backend_current->in, "lags"); if (c != ' ') { c = EOF; } else c = prot_getc(backend_current->in); if (c != '(') { c = EOF; } else { flags = grab(backend_current->in, ')'); c = prot_getc(backend_current->in); } break; case 'i': case 'I': /* internaldate? */ c = chomp(backend_current->in, "nternaldate"); if (c != ' ') { c = EOF; } else c = prot_getc(backend_current->in); if (c != '"') { c = EOF; } else { idate = grab(backend_current->in, '"'); c = prot_getc(backend_current->in); } break; case 'u': case 'U': /* uid */ c = chomp(backend_current->in, "id"); if (c != ' ') { c = EOF; } else c = getuint32(backend_current->in, &uidno); break; default: /* hmm, don't like the smell of it */ c = EOF; break; } /* looking at either SP seperating items or a RPAREN */ if (c == ' ') { c = prot_getc(backend_current->in); } else if (c == ')') break; else { c = EOF; break; } } /* if c == EOF we have either a protocol error or a situation we can't handle, and we should die. */ if (c == ')') c = prot_getc(backend_current->in); if (c == '\r') c = prot_getc(backend_current->in); if (c != '\n') { c = EOF; free(flags); free(idate); break; } /* if we're missing something, we should echo */ if (!flags || !idate) { char sep = '('; prot_printf(imapd_out, "* %d FETCH ", seqno); if (uidno) { prot_printf(imapd_out, "%cUID %d", sep, uidno); sep = ' '; } if (flags) { prot_printf(imapd_out, "%cFLAGS %s", sep, flags); sep = ' '; } if (idate) { prot_printf(imapd_out, "%cINTERNALDATE %s", sep, flags); sep = ' '; } prot_printf(imapd_out, ")\r\n"); if (flags) free(flags); if (idate) free(idate); continue; } /* add to p->next */ p->next = xmalloc(sizeof(struct d)); p = p->next; p->idate = idate; p->flags = editflags(flags); p->uid = uidno; p->seqno = seqno; p->next = NULL; } if (c != EOF) { prot_ungetc(c, backend_current->in); /* we should be looking at the tag now */ pipe_until_tag(backend_current, tag, 0); } if (c == EOF) { /* uh oh, we're not happy */ fatal("Lost connection to selected backend", EC_UNAVAILABLE); } /* start the append */ prot_printf(s->out, "%s Append {" SIZE_T_FMT "+}\r\n%s", tag, strlen(name), name); prot_printf(backend_current->out, "%s %s %s (Rfc822.peek)\r\n", mytag, usinguid ? "Uid Fetch" : "Fetch", sequence); for (/* each FETCH response */;;) { unsigned int seqno = 0, uidno = 0; /* read a line */ c = prot_getc(backend_current->in); if (c != '*') break; c = prot_getc(backend_current->in); if (c != ' ') { /* protocol error */ c = EOF; break; } /* check for OK/NO/BAD/BYE response */ if (!isdigit(c = prot_getc(backend_current->in))) { prot_printf(imapd_out, "* %c", c); pipe_to_end_of_response(backend_current, 0); continue; } /* read seqno */ prot_ungetc(c, backend_current->in); c = getuint32(backend_current->in, &seqno); if (seqno == 0 || c != ' ') { /* we suck and won't handle this case */ c = EOF; break; } c = chomp(backend_current->in, "fetch ("); if (c == EOF) { /* not a fetch response */ c = chomp(backend_current->in, "exists\r"); if (c == '\n') { /* got EXISTS response */ prot_printf(imapd_out, "* %d EXISTS\r\n", seqno); continue; } } if (c == EOF) { /* not an exists response */ /* XXX the "exists" check above will eat "ex" */ c = chomp(backend_current->in, "punge\r"); if (c == '\n') { /* got EXPUNGE response */ prot_printf(imapd_out, "* %d EXPUNGE\r\n", seqno); continue; } } if (c == EOF) { /* not an exists response */ c = chomp(backend_current->in, "recent\r"); if (c == '\n') { /* got RECENT response */ prot_printf(imapd_out, "* %d RECENT\r\n", seqno); continue; } } if (c == EOF) { /* huh, don't get this response */ break; } /* find seqno in the list */ p = head; while (p->next && seqno != p->next->seqno) p = p->next; if (!p->next) break; q = p->next; p->next = q->next; for (/* each fetch item */;;) { int sz = 0; switch (c) { case 'u': case 'U': c = chomp(backend_current->in, "id"); if (c != ' ') { c = EOF; } else c = getuint32(backend_current->in, &uidno); break; case 'r': case 'R': c = chomp(backend_current->in, "fc822"); if (c == ' ') c = prot_getc(backend_current->in); if (c != '{') { /* NIL? */ eatline(backend_current->in, c); c = EOF; } else c = getint32(backend_current->in, &sz); if (c == '}') c = prot_getc(backend_current->in); if (c == '\r') c = prot_getc(backend_current->in); if (c != '\n') c = EOF; if (c != EOF) { /* append p to s->out */ prot_printf(s->out, " (%s) \"%s\" {%d+}\r\n", q->flags, q->idate, sz); while (sz) { char buf[2048]; int j = (sz > (int) sizeof(buf) ? (int) sizeof(buf) : sz); j = prot_read(backend_current->in, buf, j); if(!j) break; prot_write(s->out, buf, j); sz -= j; } c = prot_getc(backend_current->in); } break; /* end of case */ default: c = EOF; break; } /* looking at either SP seperating items or a RPAREN */ if (c == ' ') { c = prot_getc(backend_current->in); } else if (c == ')') break; else { c = EOF; break; } } /* if c == EOF we have either a protocol error or a situation we can't handle, and we should die. */ if (c == ')') c = prot_getc(backend_current->in); if (c == '\r') c = prot_getc(backend_current->in); if (c != '\n') { c = EOF; break; } /* free q */ free(q->idate); free(q->flags); free(q); } if (c != EOF) { char *appenduid, *b; int res; /* pushback the first character of the tag we're looking at */ prot_ungetc(c, backend_current->in); /* nothing should be left in the linked list */ assert(head->next == NULL); /* ok, finish the append; we need the UIDVALIDITY and UIDs to return as part of our COPYUID response code */ prot_printf(s->out, "\r\n"); /* should be looking at 'mytag' on 'backend_current', 'tag' on 's' */ pipe_until_tag(backend_current, mytag, 0); res = pipe_until_tag(s, tag, 0); if (res == PROXY_OK) { if (myrights & ACL_READ) { appenduid = strchr(s->last_result.s, '['); /* skip over APPENDUID */ if (appenduid) { appenduid += strlen("[appenduid "); b = strchr(appenduid, ']'); if (b) *b = '\0'; prot_printf(imapd_out, "%s OK [COPYUID %s] %s\r\n", tag, appenduid, error_message(IMAP_OK_COMPLETED)); } else prot_printf(imapd_out, "%s OK %s\r\n", tag, s->last_result.s); } else { prot_printf(imapd_out, "%s OK %s\r\n", tag, error_message(IMAP_OK_COMPLETED)); } } else { prot_printf(imapd_out, "%s %s", tag, s->last_result.s); } } else { /* abort the append */ prot_printf(s->out, " {0+}\r\n\r\n"); pipe_until_tag(backend_current, mytag, 0); pipe_until_tag(s, tag, 0); /* report failure */ prot_printf(imapd_out, "%s NO inter-server COPY failed\r\n", tag); } /* free dynamic memory */ while (head) { p = head; head = head->next; if (p->idate) free(p->idate); if (p->flags) free(p->flags); free(p); } }
int openFile(){ //define a file that was previously opened and future file char* prevFile; prevFile = malloc(2408* sizeof(char)+1); char* prevLineNum; prevLineNum = malloc(2408* sizeof(char)+1); int lineCounter = 0; int count = 1; //while my linked list ain't empty while(emptyCheck(&fileList) == 0){ char* futureFileToOpen; futureFileToOpen = malloc((LINE_MAX* sizeof(char))+1); char* futureListEntry; futureListEntry = malloc(2408* sizeof(char)+1); char* listEntry; listEntry = malloc(2408* sizeof(char)+1); listEntry = grab(&fileList); //determine size to malloc these strings DONT NEED int b = 0; int fileCount = 0; for(b = 0; listEntry[b] != ':'; b++) { fileCount++; } //move past first : b++; int z = 0; int lineCount = 0; for(z = 0; listEntry[b] != '\0'; z++) { lineCount++; b++; } //declare variables for files and line numbers allocated correctly! char* fileToOpen; fileToOpen = malloc((LINE_MAX* sizeof(char))+1); char* lineNumber; lineNumber = malloc((LINE_MAX* sizeof(char))+1); //copy filetoopen int i = 0; while (listEntry[i]!= ':'){ fileToOpen[i] = listEntry[i]; i++; } //skip over the first : i++; //copy lineentry int j=0; while (listEntry[i]!= '\0'){ lineNumber[j] = listEntry[i]; i++; j++; } //declare file variables char* oneLine; oneLine = malloc((LINE_MAX* sizeof(char))+1); FILE *file; //if we're working with a new file, open it //and set line counter to the appropriate line number if(strcmp(fileToOpen, prevFile) != 0){ //if the previous file isn't empty, close it if (strlen(prevFile) != 0) fclose(file); file = fopen(fileToOpen, "r"); //firstEntry = 0; lineCounter = atoi(lineNumber); printf("\n=========================%s\n", fileToOpen); count = 1; } //if its anotehr instance in teh same file, //set linecounter to teh linenumber minus the linenumber from the last instance else{ lineCounter = atoi(lineNumber) - atoi(prevLineNum); //printf("line counter is %d\n", lineCounter); } //set a variable g to linecounter to print all lines before the match int g = lineCounter; //print all lines before the match while (g>1){ fgets(oneLine, LINE_MAX, file); if(numberedMode == 1) printf(" %d: %s", count, oneLine); else printf(" %s", oneLine); g--; count++; } //print the match fgets(oneLine, LINE_MAX, file); //Count how many instances of the word on the matching line for -w if (wordMode == 1){ int countPerLine = 0; char* wordString; wordString = malloc((LINE_MAX* sizeof(char))+1); wordString = strcasestr(oneLine, wordModeWord); while ((wordString = strcasestr(wordString, wordModeWord))){ wordString += strlen(wordModeWord); countPerLine++; } char* testString; testString = malloc((LINE_MAX* sizeof(char))+1); testString = strcasestr(oneLine, wordModeWord); while (countPerLine > 0){ char* copyString; copyString = malloc((LINE_MAX* sizeof(char))+1); //test string is the string starting with first match testString = strcasestr(testString, wordModeWord); //define length of full line minus area up to first match int x= strlen(oneLine) - strlen(testString); //copy oneline up to first match strncpy(copyString, oneLine, x); //add flag strcat(copyString, "\e[7m"); //copy the word strncat(copyString, oneLine+x,strlen(wordModeWord)); //add ending flag strcat(copyString, "\e[0m"); //copy the rest strcat(copyString, oneLine + x+strlen(wordModeWord)); strcpy(oneLine, copyString); testString += 4+strlen(wordModeWord); countPerLine--; } } if(numberedMode == 1) printf("MATCH!! %d: %s", count, oneLine); else printf("MATCH!! %s", oneLine); count++; //copy file to prevFile and prev line num strcpy(prevFile, fileToOpen); strcpy(prevLineNum, lineNumber); //pop the entry off my linked list pop(&fileList); //find future file that will be opened if(emptyCheck(&fileList) == 0){ futureListEntry = grab(&fileList); int v = 0; while (futureListEntry[v]!= ':'){ futureFileToOpen[v] = futureListEntry[v]; v++; } //printf("future file is %s\n", futureFileToOpen); } //if we're moving to a new file or our filelist is empty print rest of current file if(strcmp(fileToOpen, futureFileToOpen) != 0){ while (fgets(oneLine, LINE_MAX, file)){ if (numberedMode == 1) printf(" %d: %s", count, oneLine); else printf(" %s", oneLine); count++; } printf("\n"); } }
void SingleCellViewGraphPanelPlotWidget::on_actionCopyToClipboard_triggered() { // Copy our contents to the clipboard QApplication::clipboard()->setPixmap(grab()); }
//! called if an event happened. bool CGUIContextMenu::OnEvent(const SEvent& event) { if (IsEnabled) { switch(event.EventType) { case EET_GUI_EVENT: switch(event.GUIEvent.EventType) { case EGET_ELEMENT_FOCUS_LOST: if (event.GUIEvent.Caller == this && !isMyChild(event.GUIEvent.Element) && AllowFocus) { // set event parent of submenus setEventParent(EventParent ? EventParent : Parent); if ( CloseHandling & ECMC_HIDE ) { setVisible(false); } if ( CloseHandling & ECMC_REMOVE ) { remove(); } return false; } break; case EGET_ELEMENT_FOCUSED: if (event.GUIEvent.Caller == this && !AllowFocus) { return true; } break; default: break; } break; case EET_MOUSE_INPUT_EVENT: switch(event.MouseInput.Event) { case EMIE_LMOUSE_LEFT_UP: { // menu might be removed if it loses focus in sendClick, so grab a reference grab(); const u32 t = sendClick(core::position2d<s32>(event.MouseInput.X, event.MouseInput.Y)); if ((t==0 || t==1) && Environment->hasFocus(this)) Environment->removeFocus(this); drop(); } return true; case EMIE_LMOUSE_PRESSED_DOWN: return true; case EMIE_MOUSE_MOVED: if (Environment->hasFocus(this)) highlight(core::position2d<s32>(event.MouseInput.X, event.MouseInput.Y), true); return true; default: break; } break; default: break; } } return IGUIElement::OnEvent(event); }
bool VirtualKinectCapture::grab() { return grab(-1); }
VfsPosix::VfsPosix (const char *root_path) : root_path (grab (new String (root_path))) { }
/** Creates a font from a bitmap. @param bmp bitmap. @param ranges ranges. */ Font(const Bitmap &bmp, const std::vector<std::tuple<int, int>> &ranges) { grab(bmp, ranges); }
void ps_include( const char *name, /* file name */ FILE *fin, FILE *fout, /* input and output files */ int page_no, /* physical page number from *fin */ int whiteout, /* erase picture area */ int outline, /* draw a box around it and */ int scaleboth, /* scale both dimensions - if not zero */ double cx, double cy, /* center of the picture and */ double sx, double sy, /* its size - in current coordinates */ double ax, double ay, /* left-right, up-down adjustment */ double rot /* rotation - in clockwise degrees */ ) { static int gotinclude; int foundpage = 0; /* found the page when non zero */ int nglobal = 0; /* number of global defs so far */ int maxglobal = 0; /* and the number we've got room for */ Section prolog, page, trailer; /* prologue, page, and trailer offsets */ Section *global = 0; /* offsets for all global definitions */ double llx, lly; /* lower left and */ double urx, ury; /* upper right corners - default coords */ double w = whiteout != 0; /* mostly for the var() macro */ double o = outline != 0; double s = scaleboth != 0; int i; /* loop index */ int lineno = 0; int epsf = 0; int hires = 0; int state = 0; int indoc = 0; char *bp, *cp; enum { NORMAL, DOCUMENTFONTS, DOCUMENTNEEDEDRESOURCES, } cont = NORMAL; /* * * Reads a PostScript file (*fin), and uses structuring comments to locate the * prologue, trailer, global definitions, and the requested page. After the whole * file is scanned, the special ps_include PostScript definitions are copied to * *fout, followed by the prologue, global definitions, the requested page, and * the trailer. Before returning the initial environment (saved in PS_head) is * restored. * * By default we assume the picture is 8.5 by 11 inches, but the BoundingBox * comment, if found, takes precedence. * */ if (gotinclude == 0 && access(PSINCLUDEFILE, 04) == 0) { doglobal(PSINCLUDEFILE); gotinclude++; } llx = lly = 0; /* default BoundingBox - 8.5x11 inches */ urx = 72 * 8.5; ury = 72 * 11.0; /* section boundaries and bounding box */ prolog.start = prolog.end = 0; page.start = page.end = 0; trailer.start = 0; fseek(fin, 0L, SEEK_SET); while ( psgetline(&buf, &bufsize, NULL, fin) != NULL ) { if (++lineno == 1 && strncmp(buf, "%!PS-", 5) == 0) { for (bp = buf; !spacechar(*bp&0377); bp++); while (*bp && *bp != '\n' && *bp != '\r' && spacechar(*bp&0377)) bp++; if (strncmp(bp, "EPSF-", 5) == 0) epsf++; } if (state == 0 && (*buf == '\n' || has("%%EndComments") || buf[0] != '%' || buf[1] == ' ' || buf[1] == '\t' || buf[1] == '\r' || buf[1] == '\n')) { state = 1; continue; } if (buf[0] != '%' || buf[1] != '%') continue; if (state != 1 && (bp = has("%%+")) != NULL) { switch (cont) { case DOCUMENTFONTS: addfonts(bp); break; case DOCUMENTNEEDEDRESOURCES: goto needres; } continue; } else cont = NORMAL; if (has("%%Page: ")) { if (!foundpage) page.start = ftell(fin); sscanf(buf, "%*s %*s %d", &i); if (i == page_no) foundpage = 1; else if (foundpage && page.end <= page.start) page.end = ftell(fin); } else if (has("%%EndPage: ")) { sscanf(buf, "%*s %*s %d", &i); if (i == page_no) { foundpage = 1; page.end = ftell(fin); } if (!foundpage) page.start = ftell(fin); } else if (state != 1 && !indoc && has("%%BoundingBox:") && !hires) { sscanf(buf, "%%%%BoundingBox: %lf %lf %lf %lf", &llx, &lly, &urx, &ury); if (epsf) epsf++; } else if (state != 1 && !indoc && has("%%HiResBoundingBox:")) { sscanf(buf, "%%%%HiResBoundingBox: %lf %lf %lf %lf", &llx, &lly, &urx, &ury); hires++; if (epsf) epsf++; } else if (has("%%LanguageLevel:")) { int n; sscanf(buf, "%%%%LanguageLevel: %d", &n); LanguageLevel = MAX(LanguageLevel, n); } else if ((bp = has("%%DocumentNeededFonts:")) != NULL || (bp = has("%%DocumentFonts:")) != NULL) { cont = DOCUMENTFONTS; addfonts(bp); } else if ((bp = has("%%DocumentNeededResources:")) != NULL) { needres: if ((cp = _has(bp, "font"))) addfonts(cp); else { for (cp = bp; *cp && *cp != '\n' && *cp != '\r'; cp++); *cp = '\0'; needresource("%s", bp); } cont = DOCUMENTNEEDEDRESOURCES; } else if (indoc == 0 && (has("%%EndProlog") || has("%%EndSetup") || has("%%EndDocumentSetup"))) prolog.end = page.start = ftell(fin); else if (indoc == 0 && has("%%EOF")) break; else if (state == 1 && indoc == 0 && has("%%Trailer")) { trailer.start = ftell(fin); state = 2; } else if (state == 1 && has("%%BeginDocument:")) indoc++; else if (state == 1 && indoc > 0 && has("%%EndDocument")) indoc--; else if (state == 1 && (cp = has("%%BeginBinary:")) != NULL) { if ((i = strtol(cp, &cp, 10)) > 0) psskip(i, fin); } else if (state == 1 && (cp = has("%%BeginData:")) != NULL) { if ((i = strtol(cp, &cp, 10)) > 0) { while (*cp == ' ' || *cp == '\t') cp++; while (*cp && *cp != ' ' && *cp != '\t') cp++; while (*cp == ' ' || *cp == '\t') cp++; if (strncmp(cp, "Bytes", 5) == 0) psskip(i, fin); else if (strncmp(cp, "Lines", 5) == 0) { while (i-- && psgetline(&buf, &bufsize, NULL, fin) != NULL); } } } else if (has("%%BeginGlobal")) { if (page.end <= page.start) { if (nglobal >= maxglobal) { maxglobal += 20; global = grab(maxglobal); } global[nglobal].start = ftell(fin); } } else if (has("%%EndGlobal")) if (page.end <= page.start) global[nglobal++].end = ftell(fin); } fseek(fin, 0L, SEEK_END); if (trailer.start == 0) trailer.start = ftell(fin); trailer.end = ftell(fin); if (page.end <= page.start) page.end = trailer.start; /* fprintf(stderr, "prolog=(%d,%d)\n", prolog.start, prolog.end); fprintf(stderr, "page=(%d,%d)\n", page.start, page.end); for(i = 0; i < nglobal; i++) fprintf(stderr, "global[%d]=(%d,%d)\n", i, global[i].start, global[i].end); fprintf(stderr, "trailer=(%d,%d)\n", trailer.start, trailer.end); */ /* all output here */ fprintf(fout, "_ps_include_head\n"); var(llx); var(lly); var(urx); var(ury); var(w); var(o); var(s); var(cx); var(cy); var(sx); var(sy); var(ax); var(ay); var(rot); fprintf(fout, "_ps_include_setup\n"); if (epsf >= 2) { size_t len; rewind(fin); fprintf(fout, "%%%%BeginDocument: %s\n", name); while (psgetline(&buf, &bufsize, &len, fin) != NULL) { if (has("%%BeginPreview:")) { while (psgetline(&buf, &bufsize, &len, fin) != NULL && !has("%%EndPreview")); continue; } fwrite(buf, 1, len, fout); } fprintf(fout, "%%%%EndDocument\n"); } else { copy(fin, fout, &prolog); for(i = 0; i < nglobal; i++) copy(fin, fout, &global[i]); copy(fin, fout, &page); copy(fin, fout, &trailer); } fprintf(fout, "_ps_include_tail\n"); if(nglobal) free(global); }
void ps_include(FILE *fin, FILE *fout, int page_no, int whiteout, int outline, int scaleboth, double cx, double cy, double sx, double sy, double ax, double ay, double rot) /* fin, fout - input and output files */ /* page_no physical page number from *fin */ /* whiteout - erase picture area */ /* outline - draw a box around it and */ /* scaleboth - scale both dimensions - if not zero */ /* cx, cy - center of the picture and */ /* sx, sy - its size - in current coordinates */ /* ax, ay - left-right, up-down adjustment */ /* rot - rotation - in clockwise degrees */ { int foundpage = 0; /* found the page when non zero */ int nglobal = 0; /* number of global defs so far */ int maxglobal = 0; /* and the number we've got room for */ Section prolog, page, trailer; /* prologue, page, and trailer offsets */ Section *global; /* offsets for all global definitions */ double llx, lly; /* lower left and */ double urx, ury; /* upper right corners - default coords */ double w = whiteout != 0; /* mostly for the var() macro */ double o = outline != 0; double s = scaleboth != 0; int i; /* loop index */ /* * * Reads a PostScript file (*fin), and uses structuring comments to locate the * prologue, trailer, global definitions, and the requested page. After the whole * file is scanned, the special ps_include PostScript definitions are copied to * *fout, followed by the prologue, global definitions, the requested page, and * the trailer. Before returning the initial environment (saved in PS_head) is * restored. * * By default we assume the picture is 8.5 by 11 inches, but the BoundingBox * comment, if found, takes precedence. * */ llx = lly = 0; /* default BoundingBox - 8.5x11 inches */ urx = 72 * 8.5; ury = 72 * 11.0; /* section boundaries and bounding box */ prolog.start = prolog.end = 0; page.start = page.end = 0; trailer.start = 0; fseek(fin, 0L, 0); while ( fgets(buf, sizeof(buf), fin) != NULL ) if (!has("%%")) continue; else if (has("%%Page: ")) { if (!foundpage) page.start = ftell(fin); sscanf(buf, "%*s %*s %d", &i); if (i == page_no) foundpage = 1; else if (foundpage && page.end <= page.start) page.end = ftell(fin); } else if (has("%%EndPage: ")) { sscanf(buf, "%*s %*s %d", &i); if (i == page_no) { foundpage = 1; page.end = ftell(fin); } if (!foundpage) page.start = ftell(fin); } else if (has("%%BoundingBox:")) sscanf(buf, "%%%%BoundingBox: %lf %lf %lf %lf", &llx, &lly, &urx, &ury); else if (has("%%EndProlog") || has("%%EndSetup") || has("%%EndDocumentSetup")) prolog.end = page.start = ftell(fin); else if (has("%%Trailer")) trailer.start = ftell(fin); else if (has("%%BeginGlobal")) { if (page.end <= page.start) { if (nglobal >= maxglobal) { maxglobal += 20; global = grab(maxglobal); } global[nglobal].start = ftell(fin); } } else if (has("%%EndGlobal")) if (page.end <= page.start) global[nglobal++].end = ftell(fin); fseek(fin, 0L, 2); if (trailer.start == 0) trailer.start = ftell(fin); trailer.end = ftell(fin); if (page.end <= page.start) page.end = trailer.start; /* fprintf(stderr, "prolog=(%d,%d)\n", prolog.start, prolog.end); fprintf(stderr, "page=(%d,%d)\n", page.start, page.end); for(i = 0; i < nglobal; i++) fprintf(stderr, "global[%d]=(%d,%d)\n", i, global[i].start, global[i].end); fprintf(stderr, "trailer=(%d,%d)\n", trailer.start, trailer.end); */ /* all output here */ print(fout, PS_head); var(llx); var(lly); var(urx); var(ury); var(w); var(o); var(s); var(cx); var(cy); var(sx); var(sy); var(ax); var(ay); var(rot); print(fout, PS_setup); copy(fin, fout, &prolog); for(i = 0; i < nglobal; i++) copy(fin, fout, &global[i]); copy(fin, fout, &page); copy(fin, fout, &trailer); print(fout, PS_tail); if(nglobal) free(global); }
int main(int argc, char* argv[]) { int disp_size = 64; const int bits = 8; if (argc >= 2) { disp_size = atoi(argv[1]); } // init zed cam auto cap = new sl::zed::Camera(sl::zed::ZEDResolution_mode::VGA); sl::zed::ERRCODE err = cap->init(sl::zed::MODE::PERFORMANCE, 0, true); if (err != sl::zed::ERRCODE::SUCCESS) { std::cout << sl::zed::errcode2str(err) << std::endl; exit(EXIT_FAILURE); } int width = cap->getImageSize().width; int height = cap->getImageSize().height; sgm::StereoSGM ssgm(width, height, disp_size, 8, 16, sgm::EXECUTE_INOUT_CUDA2CUDA); SGMDemo demo(width, height); if (demo.init()) { printf("fail to init SGM Demo\n"); std::exit(EXIT_FAILURE); } Renderer renderer(width, height); uint16_t* d_output_buffer = NULL; uint8_t* d_input_left = NULL; uint8_t* d_input_right = NULL; cudaMalloc((void**)&d_input_left, width * height); cudaMalloc((void**)&d_input_right, width * height); const NppiSize roi = { width, height }; cv::Mat h_input_left(height, width, CV_8UC1); while (!demo.should_close()) { cap->grab(sl::zed::SENSING_MODE::FULL, false, false); sl::zed::Mat left_zm = cap->retrieveImage_gpu(sl::zed::SIDE::LEFT); sl::zed::Mat right_zm = cap->retrieveImage_gpu(sl::zed::SIDE::RIGHT); nppiRGBToGray_8u_AC4C1R(left_zm.data, width * 4, d_input_left, width, roi); nppiRGBToGray_8u_AC4C1R(right_zm.data, width * 4, d_input_right, width, roi); ssgm.execute(d_input_left, d_input_right, (void**)&d_output_buffer); switch (demo.get_flag()) { case 0: cudaMemcpy(h_input_left.data, d_input_left, width * height, cudaMemcpyDeviceToHost); renderer.render_input((uint8_t*)h_input_left.data); break; case 1: renderer.render_disparity(d_output_buffer, disp_size); break; case 2: renderer.render_disparity_color(d_output_buffer, disp_size); break; } demo.swap_buffer(); } cudaFree(d_input_left); cudaFree(d_input_right); delete cap; }
void run(void) { data='w'; while(1) { while(data == 'w') //waiting for signal { } while(data == '\0' ) { stop(); _delay_ms(4000); comintersection(); _delay_ms(100); } if(data=='f') // forward { data='\0'; } if(data=='r') // right { data='\0'; turn_right(); } if(data=='l') // left { data='\0'; turn_left(); } if(data == 'h') // halt { data='\0'; stop(); _delay_ms(100); continue; } if(data == 'o') // origin { data='w'; stop(); _delay_ms(100); continue; } if(data == 'c') //collect item data -> i when the bot is trying to pick up an rfid { data='w'; arm_down(); _delay_ms(2700); stop_arm(); _delay_ms(2000); grab(); arm_up(); _delay_ms(3100); stop_arm(); _delay_ms(2000); lcd_cursor(2,1); lcd_string("Collecting"); _delay_ms(3500); readrfidtag(); clearrfid(); continue; } if(data == 'd') //drop_item { data='w'; go_down(); release(); go_up(); lcd_cursor(2,1); lcd_string("Dropping"); _delay_ms(3500); senddroppedsig(); continue; } while(1) { if(move_bot() == 1) { continue; } else { break; } } } }
task usercontrol() { while (true) { if(getI2C == true) { IMESetEncoder(port2, 0); IMESetEncoder(port3, 0); IMESetEncoder(port6, 0); IMESetEncoder(port7, 0); wait1Msec(500);//wait .5 sec for IME system to reset } else { float x1 = vexRT[Ch4]; float y1 = vexRT[Ch3]; float x2 = vexRT[Ch1]; float y2 = vexRT[Ch2]; //Left Joystick Arcade Drive// motor [left] = y1 + x1; // motor [right] = y2 - x2; // ////////////////////////////// //Arm Control///////////////// if (vexRT[Btn6U] == 1) // { // arm(127); // } // else if (vexRT[Btn6D] == 1 )// { // arm(-127); // } // else // { // arm(0); // } // ////////////////////////////// //Grabber Control///////////// if (vexRT[Btn8U] == 1) // { // grab(127); // } // else if (vexRT[Btn8D] == 1) // { // grab(-127); // } // else // { // grab(0); // } // ////////////////////////////// //LCD Display///////////////// string mainBattery, PEBattery; clearLCDLine(0); // Clear line 1 (0) of the LCD clearLCDLine(1); // Clear line 2 (1) of the LCD //Display the Primary Robot battery voltage displayLCDString(0, 0, "Primary: "); sprintf(mainBattery, "%1.2f%c", nImmediateBatteryLevel/1000.0,'V'); displayNextLCDString(mainBattery); //Display the Backup battery voltage displayLCDString(1, 0, "Count: "); sprintf(PEBattery, "%1.2f%c", BackupBatteryLevel/1000.0, 'V'); displayNextLCDString(PEBattery); //Deadband//////////////////// int deadBand = 10; if(x1 > deadBand || x1 < -deadBand) { x1 = x1; } else { x1 = 0; } if(y1 > deadBand || y1 < -deadBand) { y1 = y1; } else { y1 = 0; } if(x2 > deadBand || x2 < -deadBand) { x2 = x2; } else { x2 = 0; } if(y2 > deadBand || y2 < -deadBand) { y2 = y2; } else { y2 = 0; } } } }
setOrderDirty(); } void AtlasMerge::setOrderDirty() { mOrderedImages = NULL; setMergeDirty(); } void AtlasMerge::setMergeDirty() { mMergeDirty = true; mBlockBelongs.drop(); } void AtlasMerge::setImage(c_str name, grab(Image) img) { assert(img->getWidth() > 0 && img->getHeight() > 0); String sName(name); int index = indexOfName(sName); if (index < 0){ AtlasImageData *data = new AtlasImageData(sName, img); mImages.append(data); setImageDirty(); } } void AtlasMerge::removeImage(c_str name) { String sName(name); int index = indexOfName(sName);
static THREAD_FUNC grab2(void *p) { grab(p, 2); return 0; }
grab(FillTesting) FillTesting::create(const g2d::Sizei &size) { grab(FillTesting) object = new FillTesting(size); return object; }