void test17() { bitmap_image image(1024,1024); double c1 = 0.9; double c2 = 0.5; double c3 = 0.3; double c4 = 0.7; plasma(image,0,0,image.width(),image.height(),c1,c2,c3,c4,3.0,jet_colormap); image_drawer draw(image); draw.pen_width(3); draw.pen_color(255,0,0); draw.circle(image.width() / 2 + 100, image.height() / 2, 100); draw.pen_width(2); draw.pen_color(0,255,255); draw.ellipse(image.width() / 2, image.height() / 2, 200,350); draw.pen_width(1); draw.pen_color(255,255,0); draw.rectangle(50,50,250,400); draw.pen_color(0,255,0); draw.rectangle(450,250,850,880); image.save_image("test17_image_drawer.bmp"); }
void plasma(struct fb *dst, int x0, int y0, int x1, int y1) { if(((x1 - x0) <= 1) && ((y1 - y0) <= 1)) return; putpixel(dst, iavg(x0, x1), y0, clavg(getpixel(dst, x0, y0), getpixel(dst, x1, y0))); putpixel(dst, iavg(x0, x1), y1, clavg(getpixel(dst, x0, y1), getpixel(dst, x1, y1))); putpixel(dst, x0, iavg(y0, y1), clavg(getpixel(dst, x0, y0), getpixel(dst, x0, y1))); putpixel(dst, x1, iavg(y0, y1), clavg(getpixel(dst, x1, y0), getpixel(dst, x1, y1))); putpixel(dst, iavg(x0, x1), iavg(y0, y1), clavgq(getpixel(dst, x0, y0), getpixel(dst, x1, y1), getpixel(dst, x1, y0), getpixel(dst, x0, y1))); plasma(dst, x0, y0, iavg(x0, x1), iavg(y0, y1)); plasma(dst, iavg(x0, x1), y0, x1, iavg(y0, y1)); plasma(dst, x0, iavg(y0, y1), iavg(x0, x1), y1); plasma(dst, iavg(x0, x1), iavg(y0, y1), x1, y1); }
void test16() { std::string file_name("image.bmp"); bitmap_image image(file_name); if (!image) { printf("test16() - Error - Failed to open '%s'\n",file_name.c_str()); return; } double c1 = 0.9; double c2 = 0.5; double c3 = 0.3; double c4 = 0.7; bitmap_image plasma_image(image.width(),image.height()); plasma(plasma_image,0,0,plasma_image.width(),plasma_image.height(),c1,c2,c3,c4,3.0,jet_colormap); bitmap_image temp_image(image); temp_image.alpha_blend(0.1, plasma_image); temp_image.save_image("test16_alpha_0.1.bmp"); temp_image = image; temp_image.alpha_blend(0.2, plasma_image); temp_image.save_image("test16_alpha_0.2.bmp"); temp_image = image; temp_image.alpha_blend(0.3, plasma_image); temp_image.save_image("test16_alpha_0.3.bmp"); temp_image = image; temp_image.alpha_blend(0.4, plasma_image); temp_image.save_image("test16_alpha_0.4.bmp"); temp_image = image; temp_image.alpha_blend(0.5, plasma_image); temp_image.save_image("test16_alpha_0.5.bmp"); temp_image = image; temp_image.alpha_blend(0.6, plasma_image); temp_image.save_image("test16_alpha_0.6.bmp"); temp_image = image; temp_image.alpha_blend(0.7, plasma_image); temp_image.save_image("test16_alpha_0.7.bmp"); temp_image = image; temp_image.alpha_blend(0.8, plasma_image); temp_image.save_image("test16_alpha_0.8.bmp"); temp_image = image; temp_image.alpha_blend(0.9, plasma_image); temp_image.save_image("test16_alpha_0.9.bmp"); }
void test15() { bitmap_image image(1024,1024); image.clear(); double c1 = 0.9; double c2 = 0.5; double c3 = 0.3; double c4 = 0.7; ::srand(0xA5AA5AA5); plasma(image,0,0,image.width(),image.height(),c1,c2,c3,c4,3.0,jet_colormap); image.save_image("test15_plasma.bmp"); }
inline void test15() { bitmap_image image("image.bmp"); double c1 = 0.9; double c2 = 0.5; double c3 = 0.3; double c4 = 0.7; bitmap_image plasma_image(image.width(),image.height()); plasma(plasma_image,0,0,plasma_image.width(),plasma_image.height(),c1,c2,c3,c4,3.0,jet_colormap); bitmap_image temp_image(image); temp_image.alpha_blend(0.1, plasma_image); temp_image.save_image("alpha_0.1.bmp"); temp_image = image; temp_image.alpha_blend(0.2, plasma_image); temp_image.save_image("alpha_0.2.bmp"); temp_image = image; temp_image.alpha_blend(0.3, plasma_image); temp_image.save_image("alpha_0.3.bmp"); temp_image = image; temp_image.alpha_blend(0.4, plasma_image); temp_image.save_image("alpha_0.4.bmp"); temp_image = image; temp_image.alpha_blend(0.5, plasma_image); temp_image.save_image("alpha_0.5.bmp"); temp_image = image; temp_image.alpha_blend(0.6, plasma_image); temp_image.save_image("alpha_0.6.bmp"); temp_image = image; temp_image.alpha_blend(0.7, plasma_image); temp_image.save_image("alpha_0.7.bmp"); temp_image = image; temp_image.alpha_blend(0.8, plasma_image); temp_image.save_image("alpha_0.8.bmp"); temp_image = image; temp_image.alpha_blend(0.9, plasma_image); temp_image.save_image("alpha_0.9.bmp"); }
DWORD LandScape::execV( LS_OPCODE _opcode, va_list _va ) { // reset the return status - individual functions will alter this if need be mExecStatus = EXEC_SUCCESS; mExecString[0] = '\0'; switch( _opcode ) { case LS_SEED: setSeed( va_arg(_va,DWORD) ); break; case LS_LOAD: return load( va_arg(_va,char*) ); case LS_LOADM: { char * tmpCh = va_arg(_va,char*); double tmpD = va_arg(_va,double); return load(tmpCh, float(tmpD)); } case LS_SAVE: return save( va_arg(_va,char*) ); case LS_CLEAR: clear(); break; case LS_PUSH: push( va_arg(_va,int)); break; case LS_POP: pop(); break; case LS_GET: return (DWORD)get( va_arg(_va,int) ); case LS_SWAP: swap(); break; case LS_DUP: dup(); break; case LS_ADD: add( float(va_arg(_va,double)) ); break; case LS_SUB: sub( float(va_arg(_va,double)) ); break; case LS_MUL: mul( float(va_arg(_va,double)) ); break; case LS_DIV: div( float(va_arg(_va,double)) ); break; case LS_EXP: exp( float(va_arg(_va,double)) ); break; case LS_NEG: neg(); break; case LS_CLR: clr( float(va_arg(_va,double)) ); break; case LS_DIFF: diff(); break; case LS_NORMALIZE: { double i = va_arg(_va,double); double j = va_arg(_va,double); normalize( float(i), float(j) ); } break; case LS_ADDS: addStack(); break; case LS_SUBS: subStack(); break; case LS_FLOOR: { double i = va_arg(_va,double); double j = va_arg(_va,double); double k = va_arg(_va,double); floor( float(i), float(j), float(k) ); } break; case LS_CEIL: { double i = va_arg(_va,double); double j = va_arg(_va,double); double k = va_arg(_va,double); ceil( i, j, k ); } break; case LS_CLIPMIN: clipMin( float(va_arg(_va,double)) ); break; case LS_CLIPMAX: clipMax( float(va_arg(_va,double)) ); break; case LS_ROT: rot(); break; case LS_FLIPX: flipX(); break; case LS_FLIPY: flipY(); break; case LS_TERRAIN: { int i = va_arg(_va,int); double j = va_arg(_va,double); if (i > 256) { terrain( 256, float(j) ); size(i); } else terrain( i, float(j) ); } break; case LS_PLASMA: { int i = va_arg(_va,int); double j = va_arg(_va,double); if (i > 256) { plasma( 256, float(j) ); size(i); } else plasma( i, float(j) ); } break; case LS_SIZE: size( va_arg(_va,int) ); break; case LS_SLOPE: { double i = va_arg(_va,double); int j = va_arg(_va,int); slope( i, float(j) ); } break; case LS_SHAVE: { double i = va_arg(_va,double); double j = va_arg(_va,double); double k = va_arg(_va,double); shaveArea( float(i), float(j), float(k) ); } break; case LS_CURVE: { double i = va_arg(_va,double); int j = va_arg(_va,int); curve( float(i), j ); } break; case LS_FFT: if (stack.size() > 1) fft( va_arg(_va,int) ); break; case LS_FILL_N: if (stack.size() > 1) fillNormal( float(va_arg(_va,double)) ); break; case LS_OVERLAY: { int i = va_arg(_va,int); double j = va_arg(_va,double); overlay( i, float(j) ); } break; case LS_ALPHABLEND: { int x = va_arg(_va, int); int y = va_arg(_va, int); alphablend(x, y); } break; case LS_BLEND: { int i = va_arg(_va,int); int j = va_arg(_va,int); blend( i, j ); } case LS_SMOOTH: { double i = va_arg(_va,double); double j = va_arg(_va,double); smooth( float(i), float(j) ); } break; case LS_TILE: tile(); break; case LS_WRAP: wrap(); break; case LS_CLAMP: { int i = va_arg(_va,int); double j = va_arg(_va,double); clamp(i, float(j)); } break; case LS_MASK: { int i = va_arg(_va,int); double j = va_arg(_va,double); mask(i, float(j)); } break; case LS_CRATER: case LS_PEAK: case LS_RING: case LS_FILLBASIN: case LS_LPFILTER: case LS_HPFILTER: case LS_BPFILTER: case LS_BRFILTER: case LS_FFLP: case LS_FFHP: case LS_FFBP: case LS_FFBR: default: break; } return NULL; }
void display_loop(){ // mcuf_serial_mode(); mode = setjmp(newmode_jmpbuf); #ifdef JOYSTICK_SUPPORT // in case we get here via mode jump, we (re)enable joystick queries waitForFire = 1; #endif oldOldmode = oldMode; #ifdef JOYSTICK_SUPPORT waitForFire = 1; #endif for(;;){ #ifndef MENU_SUPPORT clear_screen(0); #endif oldMode = mode; switch(mode++) { #ifdef ANIMATION_SCROLLTEXT case 1: scrolltext(scrolltext_text); #ifdef RANDOM_SUPPORT { char a[28]; sprintf(a,"</# counter == %lu ", (unsigned long)percnt_get(&g_reset_counter, &g_reset_counter_idx)); scrolltext(a); } #endif #endif #ifdef ANIMATION_TIME #ifndef ANIMATION_SCROLLTEXT case 1: #endif time_anim(); break; #else #ifdef ANIMATION_SCROLLTEXT break; #endif #endif #ifdef ANIMATION_SPIRAL # ifndef SPIRAL_DELAY # define SPIRAL_DELAY 5 # endif case 2: spiral(SPIRAL_DELAY); break; #endif #ifdef ANIMATION_JOERN1 case 3: joern1(); break; #endif #ifdef ANIMATION_SNAKE case 4: snake_animation(); break; #endif #ifdef ANIMATION_CHECKERBOARD case 5: checkerboard(20); break; #endif #ifdef ANIMATION_FIRE case 6: fire(); break; #endif #ifdef ANIMATION_TIME case 7: time_anim(); break; #endif #ifdef ANIMATION_MATRIX case 8: matrix(); break; #endif #ifdef ANIMATION_RANDOM_BRIGHT case 9: random_bright(30); break; #endif #ifdef ANIMATION_STONEFLY case 10: stonefly(); break; #endif #ifdef ANIMATION_GAMEOFLIFE case 11: gameoflife(); break; #endif #ifdef ANIMATION_FLYINGDOTS case 12: flyingdots(); break; #endif #ifdef ANIMATION_BREAKOUT case 13: breakout_demo(); break; #endif #ifdef ANIMATION_MHERWEG case 14: mherweg(); break; #endif #ifdef ANIMATION_MOIRE case 15: moire(); break; #endif #ifdef ANIMATION_TIME case 16: time_anim(); break; #endif #ifdef ANIMATION_LTN_ANT case 17: ltn_ant(); break; #endif #ifdef ANIMATION_LABORLOGO case 18: laborlogo(); break; #endif #ifdef ANIMATION_AMPHIBIAN case 19: amphibian(); break; #endif #ifdef ANIMATION_LOGO_OOS case 20: logo_OutOfSpec(); break; #endif #ifdef ANIMATION_FAIRYDUST case 21: fairydust(); break; #endif #ifdef ANIMATION_PLASMA case 22: plasma(); break; #endif #ifdef ANIMATION_PSYCHEDELIC case 23: psychedelic(); break; #endif #ifdef ANIMATION_BLACKHOLE case 24: blackhole(); break; #endif #ifdef ANIMATION_SQUARES case 25: squares(); break; #endif #ifdef ANIMATION_DNA case 26: dna(); break; #endif #ifdef ANIMATION_TESTS case 31: test_level(1, false); break; case 32: test_level(2, false); break; case 33: test_level(3, false); break; case 35: test_palette(false); test_palette2(false); break; #endif #ifdef SMALLANIMATION_ROWWALK case 36: rowwalk(SMALLANIMATION_ROWWALK_COUNT,SMALLANIMATION_ROWWALK_SPEED); break; #endif #ifdef SMALLANIMATION_COLWALK case 37: colwalk(SMALLANIMATION_COLWALK_COUNT,SMALLANIMATION_COLWALK_SPEED); break; #endif #ifdef SMALLANIMATION_COLBOUNCE case 38: colbounce(SMALLANIMATION_COLBOUNCE_COUNT,SMALLANIMATION_COLBOUNCE_SPEED); break; #endif #ifdef SMALLANIMATION_ROWBOUNCE case 39: rowbounce(SMALLANIMATION_ROWBOUNCE_COUNT,SMALLANIMATION_ROWBOUNCE_SPEED); break; #endif #ifdef MENU_SUPPORT case 0xFDu: mode = 1; break; case 0xFEu: menu(); mode = oldOldmode; break; #else case 0xFDu: #ifdef JOYSTICK_SUPPORT if (JOYISFIRE) mode = 0xFEu; else #endif mode = 1; break; case 0xFEu: #ifdef JOYSTICK_SUPPORT waitForFire = 0; // avoid circular jumps while (JOYISFIRE); // wait until user released the fire button #endif wait(25); // wait for button to settle # ifdef GAME_TETRIS tetris(); # endif # ifdef GAME_BASTET tetris_bastet(); # endif # ifdef GAME_TETRIS_FP tetris_fp(); # endif # ifdef GAME_SPACE_INVADERS borg_invaders(); # endif # ifdef GAME_SNAKE snake_game(); # endif # ifdef GAME_BREAKOUT borg_breakout(0); # endif #ifdef JOYSTICK_SUPPORT while (JOYISFIRE); // avoid an unwanted restart of the game loop #endif wait(25); // wait for button to settle mode = oldOldmode; // restore old animation mode #ifdef JOYSTICK_SUPPORT waitForFire = 1; // reenable joystick query of the wait() function #endif break; #endif #ifdef ANIMATION_OFF case 0xFFu: off(); break; #endif default: if (reverseMode) { if (reverseMode-- == (mode - 1)) { mode -= 2; } else { reverseMode = 0; } } break; } } }