 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Johan Anderlund Guest
|
Posted: Mon Apr 19, 2004 1:59 am Post subject: TImage stretch |
|
|
I have some questions about TImage and how to use it as a coordinate system.
I have turned stretch on, so the objects I've drawn will be stretched
according to the size.
I was thinking that every time an object will be drawn on the image, I
resize the image to 1000 x 1000, draw the object and at last resize the
image back to what is was before I drew the object.
This way I dont have to bother with the pixelwidth of the pen, I can use one
size all the time. Furthermore I dont have to bother with width and height
ratio.
The problem is when I set the image size back, objects are not stretched, so
they may eventually lay outside of the image that is showed, if the current
image is smaller than 1000 x 1000.
Anyone have some tips and info about how to solve this kind of problem,
please tell me.
// Johan
|
|
| Back to top |
|
 |
Peter Below (TeamB) Guest
|
Posted: Mon Apr 19, 2004 5:37 pm Post subject: Re: TImage stretch |
|
|
In article <4083328c (AT) newsgroups (DOT) borland.com>, Johan Anderlund wrote:
| Quote: | I have some questions about TImage and how to use it as a coordinate system.
I have turned stretch on, so the objects I've drawn will be stretched
according to the size.
I was thinking that every time an object will be drawn on the image, I
resize the image to 1000 x 1000, draw the object and at last resize the
image back to what is was before I drew the object.
|
Heavens, no! What you do is size the image.picture.bitmap *once* to 1000*1000
pixels and then you draw on the image.picture.bitmap.canvas (which is in fact
the same as the image.canvas). The image will then display the bitmap
stretched to its own dimension. If you change the size of the image the size
of its bitmap will *not* automatically change as well.
--
Peter Below (TeamB)
Use the newsgroup archives :
http://www.mers.com/searchsite.html
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be
|
|
| Back to top |
|
 |
Johan Anderlund Guest
|
Posted: Tue Apr 20, 2004 3:28 am Post subject: Re: TImage stretch |
|
|
Ok, it worked well, but I got one problem. Every time I draw something on
the image I'm also creating a HRgn for it. For example if I draw an
rectangle with upperleft of 100,100 and downright of 200,120 then my region
will have the same points.
But when I check, in the MouseMove event, if PtInRegion the coordinates are
not stretched as the image. Are there any special region to use, or do I've
to recalculate X and Y every time in OnMouseMove?
// Johan
"Peter Below (TeamB)" <100113.1101 (AT) compuXXserve (DOT) com> wrote
| Quote: | In article <4083328c (AT) newsgroups (DOT) borland.com>, Johan Anderlund wrote:
I have some questions about TImage and how to use it as a coordinate
system.
I have turned stretch on, so the objects I've drawn will be stretched
according to the size.
I was thinking that every time an object will be drawn on the image, I
resize the image to 1000 x 1000, draw the object and at last resize the
image back to what is was before I drew the object.
Heavens, no! What you do is size the image.picture.bitmap *once* to
1000*1000
pixels and then you draw on the image.picture.bitmap.canvas (which is in
fact
the same as the image.canvas). The image will then display the bitmap
stretched to its own dimension. If you change the size of the image the
size
of its bitmap will *not* automatically change as well.
--
Peter Below (TeamB)
Use the newsgroup archives :
http://www.mers.com/searchsite.html
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be
|
|
|
| Back to top |
|
 |
Peter Below (TeamB) Guest
|
Posted: Tue Apr 20, 2004 6:31 pm Post subject: Re: TImage stretch |
|
|
In article <408498cf (AT) newsgroups (DOT) borland.com>, Johan Anderlund wrote:
| Quote: | Ok, it worked well, but I got one problem. Every time I draw something on
the image I'm also creating a HRgn for it. For example if I draw an
rectangle with upperleft of 100,100 and downright of 200,120 then my region
will have the same points.
|
You have to do all your drawing in the unstretched coordinate system of the
bitmap. If you use mouse coordinates you have to convert them from the image
(stretched) coordinate system to the bitmaps before using them.
--
Peter Below (TeamB)
Use the newsgroup archives :
http://www.mers.com/searchsite.html
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be
|
|
| Back to top |
|
 |
Johan Anderlund Guest
|
Posted: Tue Apr 20, 2004 9:28 pm Post subject: Re: TImage stretch |
|
|
Ok, thanks a lot.
// Johan
"Peter Below (TeamB)" <100113.1101 (AT) compuXXserve (DOT) com> wrote
| Quote: | In article <408498cf (AT) newsgroups (DOT) borland.com>, Johan Anderlund wrote:
Ok, it worked well, but I got one problem. Every time I draw something
on
the image I'm also creating a HRgn for it. For example if I draw an
rectangle with upperleft of 100,100 and downright of 200,120 then my
region
will have the same points.
You have to do all your drawing in the unstretched coordinate system of
the
bitmap. If you use mouse coordinates you have to convert them from the
image
(stretched) coordinate system to the bitmaps before using them.
--
Peter Below (TeamB)
Use the newsgroup archives :
http://www.mers.com/searchsite.html
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be
|
|
|
| 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
|
|