| View previous topic :: View next topic |
| Author |
Message |
Claude Tadonki Guest
|
Posted: Wed Apr 06, 2005 3:05 pm Post subject: Proportional Image |
|
|
Hello,
I ave a TImage component (Image1) with the property Proportionnal set to
TRUE.
How can I save this image with its proportional size ?
When I just do Image1->Picture->SaveToFile("MyFile"); I get the image
with its original size. Where can I get the sizes of the new
proportional(ized) image ?
Many thanks.
Claude
|
|
| Back to top |
|
 |
Hans Galema Guest
|
Posted: Wed Apr 06, 2005 3:14 pm Post subject: Re: Proportional Image |
|
|
Claude Tadonki wrote:
| Quote: | I ave a TImage component (Image1) with the property Proportionnal set to
TRUE.
|
Is that bcb6 ? Don't see that property with bcb5.
Hans.
|
|
| Back to top |
|
 |
Claude Tadonki Guest
|
Posted: Wed Apr 06, 2005 4:02 pm Post subject: Re: Proportional Image |
|
|
YES, IT IS BCB6. I think the problem would be the same with the STRECH
property.
Hans Galema wrote:
| Quote: | Claude Tadonki wrote:
I ave a TImage component (Image1) with the property Proportionnal set
to TRUE.
Is that bcb6 ? Don't see that property with bcb5.
Hans.
|
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Wed Apr 06, 2005 5:28 pm Post subject: Re: Proportional Image |
|
|
"Claude Tadonki" <claude.tadonki (AT) bluewin (DOT) ch> wrote
| Quote: | YES, IT IS BCB6. I think the problem would be the
same with the STRECH property.
|
Proportional and Stretch only affect the *display* of a graphic. They do
not alter the graphic data itself.
Gambit
|
|
| Back to top |
|
 |
Claude Tadonki Guest
|
Posted: Wed Apr 06, 2005 6:30 pm Post subject: Re: Proportional Image |
|
|
Remy Lebeau (TeamB) wrote:
| Quote: | Proportional and Stretch only affect the *display* of a graphic. They do
not alter the graphic data itself.
Gambit
Yes, but I need to save the image as it is displayed. Means that I am |
interested in the resized image and its property ( width and height).
How can I do ?
Regards,
Claude
|
|
| Back to top |
|
 |
Jonathan Benedicto Guest
|
Posted: Wed Apr 06, 2005 6:52 pm Post subject: Re: Proportional Image |
|
|
"Claude Tadonki" <claude.tadonki (AT) bluewin (DOT) ch> wrote
| Quote: | Yes, but I need to save the image as it is displayed. Means that I
am interested in the resized image and its property ( width and
height). How can I do ?
|
// Untested
Graphics::TBitmap* Bitmap = new Graphics::TBitmap();
Bitmap->Width = Image1->Width;
Bitmap->Height = Image1->Height;
Bitmap->Canvas->StretchDraw(TRect(0, 0, Bitmap->Width,
Bitmap->Height), Image1->Picture->Graphic);
Bitmap->SaveToFile("mypic.bmp");
delete Bitmap;
|
|
| Back to top |
|
 |
Claude Tadonki Guest
|
Posted: Wed Apr 06, 2005 7:47 pm Post subject: Re: Proportional Image |
|
|
| Quote: | Graphics::TBitmap* Bitmap = new Graphics::TBitmap();
Bitmap->Width = Image1->Width;
Bitmap->Height = Image1->Height;
Bitmap->Canvas->StretchDraw(TRect(0, 0, Bitmap->Width,
Bitmap->Height), Image1->Picture->Graphic);
Bitmap->SaveToFile("mypic.bmp");
delete Bitmap;
Thanks for the sugestion. The problem with this code is that |
Image1->Width and Image1->Height still related to the original image.
May be I can
use the StrechDraw routine with the Width and Height of the
proportional(ized) image, but I need to know how to calculated the Width
and Height of the proportional(ized) image from that of the original image.
|
|
| Back to top |
|
 |
Jonathan Benedicto Guest
|
Posted: Wed Apr 06, 2005 8:06 pm Post subject: Re: Proportional Image |
|
|
"Claude Tadonki" <claude.tadonki (AT) bluewin (DOT) ch> wrote
| Quote: | Thanks for the sugestion. The problem with this code is that
Image1->Width and Image1->Height still related to the original
image. May be I can
use the StrechDraw routine with the Width and Height of the
proportional(ized) image, but I need to know how to calculated the
Width and Height of the proportional(ized) image from that of the
original image.
|
I don't have BCB6, but I think that the Image1->Width / Height should
be the size of the scaled image.
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Wed Apr 06, 2005 8:18 pm Post subject: Re: Proportional Image |
|
|
"Claude Tadonki" <claude.tadonki (AT) bluewin (DOT) ch> wrote
| Quote: | Yes, but I need to save the image as it is displayed.
|
Why?
| Quote: | Means that I am interested in the resized image and its property ( width
and height). |
The VCL does not provide that. You will have to create a secondary bitmap,
copy/stretch the original over to the secondary bitmap as needed, and then
save the secondary bitmap rather than the original.
Gambit
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Wed Apr 06, 2005 8:19 pm Post subject: Re: Proportional Image |
|
|
"Claude Tadonki" <claude.tadonki (AT) bluewin (DOT) ch> wrote
| Quote: | The problem with this code is that Image1->Width and
Image1->Height still related to the original image.
|
Image1->Width/Height are the actual display sizes, not the physical data
sizes.
Gambit
|
|
| Back to top |
|
 |
Claude Tadonki Guest
|
Posted: Thu Apr 07, 2005 12:27 am Post subject: Re: Proportional Image |
|
|
Remy Lebeau (TeamB) wrote:
| Quote: | Image1->Width/Height are the actual display sizes, not the physical data
sizes.
Yes, but the values are always that used at the the design time. For |
instance, if thw resized image is 200x500
and Image1 is 400x600, I will always get 400 and 600 with
Image->Width/Height.
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Thu Apr 07, 2005 6:41 am Post subject: Re: Proportional Image |
|
|
"Claude Tadonki" <claude.tadonki (AT) bluewin (DOT) ch> wrote
| Quote: | Yes, but the values are always that used at the the design time.
For instance, if thw resized image is 200x500 and Image1 is
400x600, I will always get 400 and 600 with Image->Width/Height.
|
The only way to get access to the proportional dimensions that TImage
calculates is to derive a new component from TImage so that you can then
access the protected DestRect() method. That is the same method that
TImage::Paint() uses to know where to draw.
Gambit
|
|
| Back to top |
|
 |
|