BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

What is the best way to draw onto an image?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Graphics)
View previous topic :: View next topic  
Author Message
Bongo
Guest





PostPosted: Fri May 20, 2005 9:48 am    Post subject: What is the best way to draw onto an image? Reply with quote



I am trying to draw a circle on an image, but it seems to be very slow.
Here is a snippet of my code:

/*
Size, XCoord and YCoord are passed into the function. They represent
the number of pixels required in the circle, and its position in the
image
*/

double rad = sqrt(Size/M_PI);
float deg = 0;
int X, Y;
do {
for (int i = 0; i <= rad; i++)
for (int j = 0; j <= rad; j++){
X = floor(i * cos(deg));
Y = floor(j * sin(deg));
if (Form1->Image1->Canvas->Pixels[X+XCoord][Y+YCoord]!= clBlue)
Form1->Image1->Canvas->Pixels[X+XCoord][Y+YCoord] = clBlue;
}deg += 0.005;
}
while (deg <= 6.4);

Is using 'Image1->Canvas->Pixels[x][y]' the correct way to go about
doing this, or is there a better way?

Any suggestions are appreciated,
Thanks

Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Graphics) All times are GMT
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.