 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Joe Bonavita Guest
|
Posted: Wed Oct 22, 2003 7:51 pm Post subject: TImage and Ellipse isn't drawing right |
|
|
I want to draw a circle on the Bitmaps canvas using the OnMouseDown like
this:
pBitmap->Canvas->Brush->Color = clRed;
pBitmap->Canvas->Ellipse(X,
Y,
X + 10,
Y + 10);
For some reason the circle appears about 20 pixels over and 40 too high.
Am I missing something here?
|
|
| Back to top |
|
 |
Todd Brylski Guest
|
Posted: Wed Oct 22, 2003 10:31 pm Post subject: Re: TImage and Ellipse isn't drawing right |
|
|
"Joe Bonavita" <JBonavita_NO_SPAN (AT) Caminus (DOT) com> wrote
| Quote: | I want to draw a circle on the Bitmaps canvas using the OnMouseDown like
this:
pBitmap->Canvas->Brush->Color = clRed;
pBitmap->Canvas->Ellipse(X,
Y,
X + 10,
Y + 10);
For some reason the circle appears about 20 pixels over and 40 too high.
Am I missing something here?
|
You need to center the ellipse on the X and Y coordinates:
pBitmap->Canvas->Brush->Color = clTeal; // Teal is better color than red
pBitmap->Canvas->Ellipse( X -5, Y -5, X +5, Y +5 );
Todd
|
|
| Back to top |
|
 |
Joe Bonavita Guest
|
Posted: Thu Oct 23, 2003 4:08 pm Post subject: Re: TImage and Ellipse isn't drawing right |
|
|
Actually the problem was because the image was "zoomed". If I try and draw @
X, Y on the Bitmap->Canvas the dot will go to the location on the bitmap
that doesn't match the images' location.
When an image is increased or decreased, just the image changes and not the
unlaying bitmap therefor using the X, Y doesn't match the bitmap.
I'm getting closer but still can't nail it down just right...
"Todd Brylski" <tbrylski (AT) yahoo (DOT) com> wrote
| Quote: | "Joe Bonavita" <JBonavita_NO_SPAN (AT) Caminus (DOT) com> wrote
I want to draw a circle on the Bitmaps canvas using the OnMouseDown like
this:
pBitmap->Canvas->Brush->Color = clRed;
pBitmap->Canvas->Ellipse(X,
Y,
X + 10,
Y + 10);
For some reason the circle appears about 20 pixels over and 40 too high.
Am I missing something here?
You need to center the ellipse on the X and Y coordinates:
pBitmap->Canvas->Brush->Color = clTeal; // Teal is better color than
red
pBitmap->Canvas->Ellipse( X -5, Y -5, X +5, Y +5 );
Todd
|
|
|
| Back to top |
|
 |
Joe Bonavita Guest
|
Posted: Thu Oct 23, 2003 4:16 pm Post subject: Re: TImage and Ellipse isn't drawing right |
|
|
Here's the solution when trying to draw on a image that is "zoomed".
X1 = X / (double(Image1->Width) / double(Image1->Picture->Width) );
Y1 = Y / (double(Image1->Height) / double(Image1->Picture->Height) );
Image1->Picture->Bitmap->Canvas->Ellipse(X1 - 5, Y1 - 5, X1 + 5, Y1 + 5);
this will draw a circle in the location a user clicked the mouse when an
image has been stretched.
"Joe Bonavita" <JBonavita_NO_SPAN (AT) Caminus (DOT) com> wrote
| Quote: | I want to draw a circle on the Bitmaps canvas using the OnMouseDown like
this:
pBitmap->Canvas->Brush->Color = clRed;
pBitmap->Canvas->Ellipse(X,
Y,
X + 10,
Y + 10);
For some reason the circle appears about 20 pixels over and 40 too high.
Am I missing something here?
|
|
|
| Back to top |
|
 |
Frank Guest
|
Posted: Fri Oct 24, 2003 4:32 pm Post subject: Re: TImage and Ellipse isn't drawing right |
|
|
Hi Joe,
Maybe use Arc in stead of Ellipse
Good luck
Frank
"Joe Bonavita" <JBonavita_NO_SPAN (AT) Caminus (DOT) com> escribió en el mensaje
news:3f96dfb9 (AT) newsgroups (DOT) borland.com...
| Quote: | I want to draw a circle on the Bitmaps canvas using the OnMouseDown like
this:
pBitmap->Canvas->Brush->Color = clRed;
pBitmap->Canvas->Ellipse(X,
Y,
X + 10,
Y + 10);
For some reason the circle appears about 20 pixels over and 40 too high.
Am I missing something here?
|
|
|
| Back to top |
|
 |
Todd Brylski Guest
|
Posted: Sat Oct 25, 2003 12:09 am Post subject: Re: TImage and Ellipse isn't drawing right |
|
|
"Frank" <aplicon (AT) terra (DOT) es> wrote
| Quote: | Maybe use Arc in stead of Ellipse
|
Why would he want to use an arc when he wants to draw an ellipse?
Todd
|
|
| 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
|
|