 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Bongo Guest
|
Posted: Fri May 20, 2005 9:48 am Post subject: What is the best way to draw onto an image? |
|
|
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 |
|
 |
|
|
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
|
|