void drow_inner_circle( int x_center, int y_center, int radius, struct color color) // 꽉찬원 draw (x, y, radius, color) { int x_coor; int y_coor; int p_value; fb_mmap_temp = (unsigned short *)malloc(myfb->fbvar.xres*myfb->fbvar.yres*2); // 더블버퍼링 임시변수에 screen size 할당 memset(fb_mmap_temp, 0, myfb->fbvar.xres*myfb->fbvar.yres*2); // 더블버퍼 클리어 x_coor = 0; y_coor = radius; p_value = 3 - 2 * radius; while ( x_coor < y_coor) { inner_circle( x_center, y_center, x_coor, y_coor, &color); if ( p_value < 0) { p_value += 4 * x_coor +6; } else { p_value += 4 * ( x_coor -y_coor) +10; y_coor--; } x_coor++; } if ( x_coor == y_coor) inner_circle( x_center, y_center, x_coor, y_coor, &color); memcpy(myfb->fb, fb_mmap_temp, fbvar.xres*fbvar.yres*2); // mmap에 memory copy (더블 버퍼링) }
static AbstractMask* create_doughnut( const DictionaryDatum& d ) { // The doughnut (actually an annulus) is created using a DifferenceMask Position< 2 > center( 0, 0 ); if ( d->known( names::anchor ) ) center = getValue< std::vector< double > >( d, names::anchor ); const double outer = getValue< double >( d, names::outer_radius ); const double inner = getValue< double >( d, names::inner_radius ); if ( inner >= outer ) throw BadProperty( "topology::create_doughnut: " "inner_radius < outer_radius required." ); BallMask< 2 > outer_circle( center, outer ); BallMask< 2 > inner_circle( center, inner ); return new DifferenceMask< 2 >( outer_circle, inner_circle ); }