Register
Site Login
Site Search
Forums
Advertisement
Welcome to PocketMatrix. PocketMatrix is dedicated to providing the best online community for mobile device developers and enthusiests. What's new?

How to draw a circle


How to draw a circle

Postby GapiNewb » Nov 27, 2002 @ 3:40am

Ok, i'm totally new to Gapidraw and don't know anything about MFC. I was wondering how i can draw a circle on a CGapiSurface.
GapiNewb
 


Postby okku » Nov 27, 2002 @ 9:01pm

GapiDraw dosen't have any drawing capabilities what i am aware of. You have to do it by yourself. Simply by setting the pixels by hand.

Search for "circle drawing algorithm" on google and you will find code and examples.
okku
pm Member
 
Posts: 58
Joined: Nov 11, 2002 @ 8:51am
Location: Sweden


Postby Kzinti » Nov 27, 2002 @ 9:09pm

PocketFrog has the circle drawing algorithm implemented (and many others). Take a look at the available source code.
Kzinti
pm Member
 
Posts: 3238
Joined: Jan 13, 2002 @ 5:23am


LOOK

Postby Eicke » Nov 28, 2002 @ 3:52am

void DrawCircle(int nX, int nY, int nR, COLORREF Color)
{
int x,y,dt,dt1,dt2,dr;
x=0;y=nR;dt=2-nR-nR;
while(y>=0)
{
//SetPixelColor is a draw point fun
SetPixelColor(nX+x,nY+y,Color);
SetPixelColor(nX+x,nY-y,Color);
SetPixelColor(nX-x,nY+y,Color);
SetPixelColor(nX-x,nY-y,Color);
if(dt<0)
{
dt1=dt+dt+y+y-1;
if(dt1<=0)dr=1;
else dr=2;
}
else if(dt>0)
{
dt2=dt+dt-x-x-1;
if(dt2<=0)dr=2;
else dr=3;
}else dr=2;
switch(dr)
{
case 1: x++;dt+=x+x+1;
break;
case 2: x++;y--;dt+=x+x-y-y-1;
break;
case 3: y--;dt+=1-y-y;
break;
}
}
}
Eicke
pm Member
 
Posts: 2
Joined: Nov 21, 2002 @ 4:19pm


Postby GapiNewb » Nov 28, 2002 @ 5:19am

thank you so much :D :D
GapiNewb
 


Re: How to draw a circle

Postby sarafreelancer » Jul 3, 2012 @ 10:40pm

Hi,

Thanks for posting circle drawing logic. If i wanted to draw a circle in CGapiSurface, how can i call the method DrawCircle? and how to associate with CGapiSurface

and there are some method call like SetPixelColor, what is that? where is the definition of that

simply i need a complete example, how circle can be drawn on the CGapiSurface

Thanks
sarafreelancer
pm Member
 
Posts: 1
Joined: Jul 3, 2012 @ 10:35pm


Return to GapiDraw


Sort


Forum Description

The Cross-platform Graphics SDK for Palms, Pocket PCs, Symbian Devices, and Stationary PCs.

Moderators:

sponge, Johan

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

cron