perfect circle

Posted By: flits

perfect circle - 01/20/09 14:01

i want to create a bmap white a circle
the problem is that the circle isnt 100% full
there are missing pixel

Code:

BMAP* circle; circle = bmap_createblack(sz[0],sz[0],24);
	
	var format;
	var i = 0;
	var pixel;
	
	var x;
	var y;
	var a;
	
	format = bmap_lock(circle,0);
	pixel = pixel_for_vec(clr[0],100,format);
	while(i < 100)
	{
		a = 0;
		while(a < 360)
		{
		x = sinv(a)*(sz[0]/2-i) + sz[0]/2;
		y = cosv(a)*(sz[0]/2-i) + sz[0]/2;
		pixel_to_bmap(circle,x,y,pixel);
		a += 1;	
		}
	i += 1;
	}
	
	
	bmap_unlock(circle);
	

Posted By: Quad

Re: perfect circle - 01/20/09 15:54

didnt tried but maybe it would be a<=360 ?
Posted By: flits

Re: perfect circle - 01/20/09 17:15

i got it i just rezided the angle

Code:
{
BMAP* circle; circle = bmap_createblack(sz[0],sz[0],32);
	
	var format;
	var i = 0;
	var pixel;
	
	var x;
	var y;
	var a;
	
	format = bmap_lock(circle,0);
	pixel = pixel_for_vec(clr[0],100,format);
	while(i < sz[0]/2 + 1)
	{
		a = 0;
		while(a < 360)
		{
		x = sinv(a)*(sz[0]/2-i) + sz[0]/2;
		y = cosv(a)*(sz[0]/2-i) + sz[0]/2;
		pixel_to_bmap(circle,x,y,pixel);
		
		a += 0.1;	
		}
	i += 1;
	}
	
	bmap_unlock(circle);
	

© 2024 lite-C Forums