int main( const int argc, const char **argv) { int function = atoi( argv[1]), i; char buff[200]; FILE *ifile = fopen( "loneos.phot", "rb"); double limits[12] = { -.4, 3.9, -.4, 2., /* V-I to B-V */ -.5, 4.2, -.4, 2.1, /* V-I to V-R */ -.3, 2., -.4, 2.2 }; /* V-R to B-V */ double *lim = limits + function * 4; int xcolumns[3] = { 75, 75, 69 }; int ycolumns[3] = { 63, 69, 63 }; _setvideomode( _VRES16COLOR); _setcolor( 2); for( i = 0; i < 640; i++) { double ocolor, icolor = lim[0] + (lim[1] - lim[0]) * (double)i / 640.; if( function == 0) ocolor = v_minus_i_to_b_minus_v( icolor); else if( function == 1) ocolor = v_minus_i_to_v_minus_r( icolor); else ocolor = v_minus_r_to_b_minus_v( icolor); _setpixel( (short)i, (short)( 480. * (ocolor-lim[3]) / (lim[2]-lim[3]))); } _setcolor( 3); while( fgets( buff, sizeof( buff), ifile)) { if( buff[xcolumns[function]] == '.' && buff[ycolumns[function]] == '.') { double icolor = atof( buff + xcolumns[function] - 2); double ocolor = atof( buff + ycolumns[function] - 2); int xpixel = (int)( 640. * (icolor-lim[0]) / (lim[1]-lim[0])); int ypixel = (int)( 480. * (ocolor-lim[3]) / (lim[2]-lim[3])); short ix, iy; short deltas[9 * 2] = { 0,0, 1,0, 0,1, -1,0, 0,-1, 1,1, 1,-1, -1,-1, -1,1 }; for( i = 0; i < 18; i += 2) { ix = (short)( xpixel + deltas[i]); iy = (short)( ypixel + deltas[i + 1]); if( !_getpixel( ix, iy)) i = 99; } if( i != 18) _setpixel( ix, iy); } buff[xcolumns[function]] = buff[ycolumns[function]] = ' '; } fclose( ifile); getch( ); _setvideomode( _DEFAULTMODE); return( 0); }
void Org1D::plotAt(int X, int Y) { // plots generations at X, Y int gen, at; for (gen = 0; gen < numOfGen; gen++) for (at = 0; at < size[gen]; at++) { // draw the indicated pixel _setcolor((vc.numcolors-1)*cells[gen][at]/maxState); _setpixel(X-size[gen]/2+at, Y+numOfGen/2-gen); }; // for }; // Org1D::plotAt()
main(int argc,char *argv[]) { int a; FILE *f1; if(argc==1) { printf("usage: FONT <srclbm> <desttmpfont>"); return(0); } _setvideomode(_VRES16COLOR); for(a=0;a<256;a++) { f_off[a]=0; f_wid[a]=0; f_hig[a]=0; } avercnt=0; averwid=0; out=fopen(argv[2],"wb"); putw(0x1a1a,out); putw(tablep,out); fwrite(tablex,1,256,out); fwrite(tabley,1,256,out); f1=fopen(argv[1],"rb"); readlbm(f1); { char buf[64]; int x0,y0,x,y,a; for(y0=2;y0<7*8-2;y0+=8) for(x0=0;x0<56*8;x0+=8) { for(a=x=0;x<8;x++) for(y=0;y<8;y++) { if((buf[x+y*8]=_getpixel(x0+x,y0+y))==0) a=1; } if(a) { tablex[tablep]=x0/8; tabley[tablep++]=(y0-2)/8; for(y=0;y<8;y++) { for(a=x=0;x<8;x++) { if(!buf[x+y*8]) a+=128>>x; } putc(a,out); } _setcolor(15); } else _setcolor(8); _setpixel(x0,y0); } }
main() { int x, y; _setvideomode( _VRES16COLOR ); while( _grstatus() == _GROK ) { x = rand() % 700; y = rand() % 500; _setpixel( x, y ); } getch(); _setvideomode( _DEFAULTMODE ); }
void main(void) { int x, y, color, index; _setvideomode(_VRES16COLOR); //draw 10,000 points for(index = 0; index < 10000; index++) { x = rand() % 640; y = rand() % 480; color = rand() % 16; _setcolor(color); _setpixel(x,y); } while(!kbhit()) {} _setvideomode(_DEFAULTMODE); }