Post

Dave W Plummer
Dave W Plummer@davepl1968·
I'm going to give you a computer science problem, covered by a software patent (US 4,197,590). Let's see if it's "obvious" to experts in the field. You're on a monochrome display. You want to draw a PLUS sign cursor, like in a paint program, leaving the pixel in the middle unchanged. How do you draw the vertical and horizontal lines without stomping on the center pixel? Do you save the center and put it back later? Or what's your solution? No sprites, of course, all done via Get/SetPixel(x,y) only. Assume something like bool GetPixel(uint x, uint y); void SetPixel(uint x, uint y, bool b);
Dave W Plummer tweet media
English
263
8
289
84.8K
daniel wigton
daniel wigton@codingfodder·
@davepl1968 for(i = 1; n; i++){ put_pixel(x-i,y); put_pixel(x+i,y); put_pixel(x,y-i); put_pixel(x,y+i); }
English
0
0
0
155
Paylaş