void draw_led_element (char* cp) { _E_LED_t* p; uint8_t m; uint8_t s; p = (_E_LED_t*) cp; XRAM_SELECT_BLOCK(XRAM_PAGE_PAGE); /* binary or radio button function? */ if (p->parameter & LED_PARAMETER_RADIO) { s = p->repeat_radio_value == eib_get_object_8_value (p->eib_object_listen); } else { m = 1 << (p->parameter & LED_PARAMETER_BITPOS); s = eib_get_object_8_value (p->eib_object_listen) & m; } XRAM_SELECT_BLOCK(XRAM_PAGE_PAGE); if (s) { XRAM_SELECT_BLOCK(XRAM_PAGE_PAGE); if (p->parameter & LED_PARAMETER_WARNING) { draw_picture (p->picture_warning_index, p->x_pos, p->y_pos); set_backlight_on (); XRAM_SELECT_BLOCK(XRAM_PAGE_PAGE); sound_play_clip (p->sound_index_warning, p->repeat_radio_value); } else { draw_picture (p->picture_on_index, p->x_pos, p->y_pos); } } else { draw_picture (p->picture_off_index, p->x_pos, p->y_pos); } }
void down() { if (current_max_y+autodown_y+DRAW_BLOCK_SIZE > max_y || is_stop(VERRIFY_DOWN)) { //get_russian(); //printf("--------11111111111111-------------\n"); //get_current_block(); //printf("--------22222222222222-------------\n"); copy(); //printf("-------333333333333--------------\n"); //get_russian(); //sleep(5); free(block_entry_p->arr); free(block_entry_p); init_current_block(); draw_picture(ROW_CANVAS, 0x1a, IS_DRAW); //exit(1); return; } draw_picture(ROW_CANVAS, 0xfa, IS_DRAW); autodown_y+=DRAW_BLOCK_SIZE; draw_picture(ROW_CANVAS, 0x1a, IS_DRAW); }
static void serialize_and_compare_typeface(sk_sp<SkTypeface> typeface, const char* text, skiatest::Reporter* reporter) { // Create a paint with the typeface. SkPaint paint; paint.setColor(SK_ColorGRAY); paint.setTextSize(SkIntToScalar(30)); paint.setTypeface(std::move(typeface)); // Paint some text. SkPictureRecorder recorder; SkIRect canvasRect = SkIRect::MakeWH(kBitmapSize, kBitmapSize); SkCanvas* canvas = recorder.beginRecording(SkIntToScalar(canvasRect.width()), SkIntToScalar(canvasRect.height()), nullptr, 0); canvas->drawColor(SK_ColorWHITE); canvas->drawText(text, 2, 24, 32, paint); sk_sp<SkPicture> picture(recorder.finishRecordingAsPicture()); // Serlialize picture and create its clone from stream. SkDynamicMemoryWStream stream; picture->serialize(&stream); std::unique_ptr<SkStream> inputStream(stream.detachAsStream()); sk_sp<SkPicture> loadedPicture(SkPicture::MakeFromStream(inputStream.get())); // Draw both original and clone picture and compare bitmaps -- they should be identical. SkBitmap origBitmap = draw_picture(*picture); SkBitmap destBitmap = draw_picture(*loadedPicture); compare_bitmaps(reporter, origBitmap, destBitmap); }
void right() { if (current_max_x+autodown_x+DRAW_BLOCK_SIZE > max_x|| is_stop(VERRIFY_RIGHT)) { return; } draw_picture(ROW_CANVAS, 0xfa, IS_DRAW); autodown_x+=DRAW_BLOCK_SIZE; draw_picture(ROW_CANVAS, 0x1a, IS_DRAW); }
void left() { if (current_min_x+autodown_x-DRAW_BLOCK_SIZE < min_x || is_stop(VERRIFY_LEFT)) { return; } draw_picture(ROW_CANVAS, 0xfa, IS_DRAW); autodown_x-=DRAW_BLOCK_SIZE; draw_picture(ROW_CANVAS, 0x1a, IS_DRAW); }
void draw_picture_element (char* cp) { _E_PICTURE_t* p; p = (_E_PICTURE_t*) cp; draw_picture (p->picture_index, p->x_pos, p->y_pos); }
uint8_t check_led_warning_state (char* cp, uint8_t warning_toggle) { _E_LED_t* p; p = (_E_LED_t*) cp; /* warning function? */ if (p->parameter & LED_PARAMETER_WARNING) { if (eib_get_object_8_value (p->eib_object_listen)) { XRAM_SELECT_BLOCK(XRAM_PAGE_PAGE); if (warning_toggle) draw_picture (p->picture_warning_index, p->x_pos, p->y_pos); else draw_picture (p->picture_on_index, p->x_pos, p->y_pos); return 1; } } return 0; }
void change() { enum ALLOW_TYPE is_allow; enum POSITION next_pos = (block_entry_p->pos+1)%4; is_allow = verify(block_entry_p->type, next_pos,ROW_CANVAS); if(is_allow == ALLOW){ reset_block(); block_entry_p->pos = next_pos; draw_picture(ROW_CANVAS, BLUE, IS_DRAW); } }
void picture_move() { if (current != last_value) { draw_picture(); } if(current_beat) { move_back(true); } }
void picture_move() { if (changed) { draw_picture(); //Serial.println("dr"); } if(current_beat) { move_forward(true); } }
void picture_move() { if(beat()) { move = move +1; if (move > 2000) { move = 0; } draw_picture(move); } }
int main(int argc, const char *argv[]) { system("clear"); int ret,ch; ret = fb_open(); //draw_element(100, 100, 0x75); //draw_element(150, 100, PINK); //exit(1); struct termios tc, old_tc; tcgetattr(0, &tc);//0是输入 tcgetattr(0, &old_tc);//用于下面恢复 tc.c_lflag &= (~ICANON);//启动食品模式 tc.c_lflag &= (~ECHO);//ECHO 使用回显 &~(ECHO) 取消回显 tcsetattr(0, TCSANOW, &tc);//TCSANOW 立刻生效 init(); init_current_block(); draw_picture(ROW_CANVAS, 0x1a, IS_DRAW); signal(SIGALRM, sig_handler); alarm(1); while (1) { ch = getchar(); if (ch == 'q') {//exit break; } if (ch =='w') { change(); } if (ch =='a') { left(); } if (ch =='s') { down(); } if (ch =='d') { right(); } } tcsetattr(0, TCSANOW, &old_tc); fb_close(); return 0; }
void draw_player(int index, int moving) { PIC worm; if (index == 0) { if (moving) { worm = pic[WORM01]; } else { worm = pic[WORM00]; } } else { if (moving) { worm = pic[WORM11]; } else { worm = pic[WORM10]; } } draw_picture(worm, player[index].x - worm.mask->picwidth / 2, player[index].y - worm.mask->picheight); }
void draw_interface(int interface) { switch (interface) { case 0: //welcome interface draw_picture(pic[AWEL], 0, 0); break; case 1: //game interface draw_picture(pic[BGAME], 0, 0); draw_picture(pic[BMOUNT], 0, 0); break; case 2: //help interface draw_picture(pic[HELP], 0, 0); break; case 3: //pause interface draw_picture(pic[CPAUSE], 0, 0); break; case 4: //WIN1 interface draw_picture(pic[DWIN1], 0, 0); break; case 5: //WIN2 interface draw_picture(pic[DWIN2], 0, 0); break; } }
void draw_bullet() { draw_picture(pic[BULLET0], bullet.x, bullet.y); }
void draw_explode() { draw_picture(pic[EXPLO0 + explode_state], bullet.x, bullet.y); }
/*----------------------------------------------------------------------------------------------------------------------------*/ int main(int argcount, char** argvector) { // basic variables char file[1024]; char outfile[1024]; char buf[32]; int steps, counter; double perc; // check whether the right amount of arguments is given if (argcount != 2) { fprintf(stderr, "Please provide only a filename to read from, process will terminate.\n"); return EXIT_FAILURE; } // copy the filename, we will need it strncpy(file, argvector[1], 1024); // user output fprintf(stderr, "Reading file: %s\n", file); // read from the given file, check whether successful struct parameters *param = hdf5_init(file); if (param == NULL) { return EXIT_FAILURE; } // copy the number of steps we have steps = param->steps; // initiate the SDL libraries, check if successful if (initiate(param) != EXIT_SUCCESS) return EXIT_FAILURE; // user output fprintf(stderr, "Computing...\n"); // initiate counter counter = 0; // iterate over all 50 steps, compute filenames and make pictures for (int i=0; i<=steps; i+=3) { // compute percentage of completed iterations perc = 100.*i/steps; // output percentage to user fprintf(stderr, "Progress: \t\t["); for (int j=0; j<floor(perc); j++) { fprintf(stderr, "="); } if (perc != 100) fprintf(stderr, ">"); for (int j=floor(perc)+1; j<100; j++) { fprintf(stderr, "."); } fprintf(stderr, "] \t%.1lf%%\r", perc); // compute the next filename strncpy(outfile, "/home/ayra/.images/image_", 984); sprintf(buf, "%d", counter); strncat(outfile, buf, 32); strncat(outfile, ".bmp\0", 5); // update position and psi4 array to the next step hdf5_read(i); // build the picture draw_picture(i, outfile); // increase counter counter++; } // user output fprintf(stderr, "\nDone!\n\n"); // free memory used by SDL destroy(); // free struct, return to caller free(param->positions); free(param->psi4); free(param->psi6); free(param); return EXIT_SUCCESS; }
int main(int argc, char **argv) { uint8_t eeprom[0xFF]; int16_t ir_data[16][4]; struct mlx_conv_s conv_tbl; double temp[16][4]; uint16_t cfg, ptat, trim; int16_t v_cp; double ptat_f; SDL_Surface *screen; int fd; #ifdef TEST int i; #endif int quit = 0; assert(argc > 1); fd = open(argv[1], O_RDWR); assert(fd >= 0); read_eeprom(fd, eeprom); hexdump(eeprom, 255); #ifdef TEST eeprom[0xda] = 0x78; eeprom[0xdb] = 0x1a; eeprom[0xdc] = 0x33; eeprom[0xdd] = 0x5b; eeprom[0xde] = 0xcc; eeprom[0xdf] = 0xed; eeprom[0xd4] = 0xd0; eeprom[0xd5] = 0xca; eeprom[0xd6] = 0x00; eeprom[0xd7] = 0x00; eeprom[0xd8] = 0x23; eeprom[0xd9] = 0x08; eeprom[0xe0] = 0xe4; eeprom[0xe1] = 0xd5; eeprom[0xe2] = 0x2a; eeprom[0xe3] = 0x21; eeprom[0xe4] = 0x99; eeprom[0xe5] = 0x79; for (i = 0; i < 64; i++) { eeprom[i] = 0xd6; eeprom[i + 64] = 0xc1; eeprom[i + 128] = 0x8f; } #endif prepare_conv(eeprom, &conv_tbl); assert(ioctl(fd, I2C_SLAVE, 0x60) >= 0); do { config_mlx(fd, eeprom); mlx_read_ram(fd, MLX_RAM_CONFIG, &cfg, 1); #ifdef DEBUG printf("cfg: %04x\n", cfg); #endif } while (!(cfg & (1 << 10))); mlx_read_ram(fd, MLX_RAM_TRIM, &trim, 1); #ifdef DEBUG printf("osc: %04x\n", trim); #endif screen = sdl_init(); while (!quit) { SDL_Event evt; mlx_read_ram(fd, MLX_RAM_TGC, (uint16_t *) & v_cp, 1); #ifdef DEBUG printf("tgc: %04x\n", (uint16_t) v_cp); #endif mlx_read_ram(fd, MLX_RAM_PTAT, &ptat, 1); ptat_f = ptat_to_kelvin(ptat, &conv_tbl); #ifdef DEBUG printf("ptat: %04x (%.1f)\n", ptat, kelvin_to_celsius(ptat_f)); #endif mlx_read_ram(fd, MLX_RAM_IR, (uint16_t *) ir_data, 16 * 4); #ifdef TEST v_cp = 0xffd8; ptat_f = 28.16 + 273.15; ir_data[0][0] = 0x0090; #endif convert_ir(ir_data, temp, &conv_tbl, ptat_f, v_cp); #ifdef DEBUG dump_ir(ir_data); dump_temps(temp); #endif draw_picture(screen, temp, kelvin_to_celsius(ptat_f)); while (SDL_PollEvent(&evt)) { if (evt.type == SDL_KEYDOWN) { switch (evt.key.keysym.sym) { case SDLK_q: case SDLK_ESCAPE: quit = 1; break; default: break; } } } } close(fd); return 0; }
gint expose_event(GtkWidget *widget, GdkEventExpose *event) { draw_picture(widget->window); return FALSE; }
int main(int argc, char *argv[]) { int winid; struct Msg msg; struct Context context; //int shell_pid; //int finder_pid; short isRun = 1; // short isInit = 1; ClickableManager manager; winid = init_context(&context, 800, 600); fill_rect(context, 0, 0, context.width, context.height, 0xffff); // puts_str(context, "desktop: welcome", 0x0, 0, 0); PICNODE pic1, pic2, pic3/*, background*/; loadBitmap(&pic1, "music.bmp"); loadBitmap(&pic2, "setting.bmp"); loadBitmap(&pic3, "notes.bmp"); //loadBitmap(&background, "bg.bmp"); set_icon_alpha(&pic1); set_icon_alpha(&pic2); set_icon_alpha(&pic3); // set_icon_alpha(&pic4); // fill_rect(context, 160, 400, 500, 150, 0x0101); // //loadBitmap(&background, "bg.bmp"); //draw_picture(context, background, 0, 0); draw_picture(context, pic1, 225, 450); draw_picture(context, pic2, 367, 450); draw_picture(context, pic3, 500, 450); //draw_iconlist(context, iconlist, sizeof(iconlist) / sizeof(ICON)); manager = initClickManager(context); createClickable(&manager, initRect(225, 450, 75, 75), MSG_DOUBLECLICK, playmusic); createClickable(&manager, initRect(367, 450, 75, 75), MSG_DOUBLECLICK, shellinit); createClickable(&manager, initRect(500, 450, 75, 75), MSG_DOUBLECLICK, finderinit); while(isRun) { getMsg(&msg); switch(msg.msg_type) { case MSG_UPDATE: updateWindow(winid, context.addr); //printf(0, "desktop"); /*if (isInit) { finderinit((Point){0, 0}); //finderinit((Point){0, 0}); //shell_pid = shellinit((Point){context.width / 2, context.height / 2}); //shellinit((Point){context.width / 2, context.height / 2}); isInit = 0; }*/ break; case MSG_PARTIAL_UPDATE: updatePartialWindow(winid, context.addr, msg.concrete_msg.msg_partial_update.x1, msg.concrete_msg.msg_partial_update.y1, msg.concrete_msg.msg_partial_update.x2, msg.concrete_msg.msg_partial_update.y2); break; case MSG_DOUBLECLICK: executeHandler(manager.double_click, initPoint(msg.concrete_msg.msg_mouse.x, msg.concrete_msg.msg_mouse.y)); break; default: break; } } //int windowId; //int result; //windowId = createWindow(0, 0, 800, 600); //printf(0, "windowId: %d\n", windowId); //result = updateWindow(windowId, context.addr); //printf(0, "updateResult: %d\n", result); free_context(&context, winid); exit(); }