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 

TImage and Ellipse isn't drawing right

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





PostPosted: Wed Oct 22, 2003 7:51 pm    Post subject: TImage and Ellipse isn't drawing right Reply with 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





PostPosted: Wed Oct 22, 2003 10:31 pm    Post subject: Re: TImage and Ellipse isn't drawing right Reply with quote



"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 Smile
pBitmap->Canvas->Ellipse( X -5, Y -5, X +5, Y +5 );

Todd



Back to top
Joe Bonavita
Guest





PostPosted: Thu Oct 23, 2003 4:08 pm    Post subject: Re: TImage and Ellipse isn't drawing right Reply with quote



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 Smile
pBitmap->Canvas->Ellipse( X -5, Y -5, X +5, Y +5 );

Todd





Back to top
Joe Bonavita
Guest





PostPosted: Thu Oct 23, 2003 4:16 pm    Post subject: Re: TImage and Ellipse isn't drawing right Reply with quote

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





PostPosted: Fri Oct 24, 2003 4:32 pm    Post subject: Re: TImage and Ellipse isn't drawing right Reply with quote

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





PostPosted: Sat Oct 25, 2003 12:09 am    Post subject: Re: TImage and Ellipse isn't drawing right Reply with quote

"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
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.