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 Transparent

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage)
View previous topic :: View next topic  
Author Message
Alain
Guest





PostPosted: Mon Sep 11, 2006 8:10 am    Post subject: Timage Transparent Reply with quote



Hello All,

I placed several TImage components over each other each containing the
JPEG image of a T-Shirt of a different color.
The last TImage component is the design that is to be printed on the
chest position of the tshirt and it's property is set transparent.
The quality of the transparent image deteriorates.

Which format must I use to get a good quality because if tranparent of the
TImage is set true I get the limits of the TImage


Thanks

Alain
Back to top
Clayton Arends
Guest





PostPosted: Mon Sep 11, 2006 9:52 pm    Post subject: Re: Timage Transparent Reply with quote



JPEG is a lossy compression which uses a resonably close colors to the
original image but it won't necessarily be the same. Because of this you
get artifacts all over the place (as you have found out). BMP is probably
the easiest for you to use to correct this scenario.

However, GIF is a little better since it offers image compression.
Personally, I use nothing but PNG since it offers multiple levels of
transparency with true-color images. To download a good PNG component for
the VCL head to: http://sourceforge.net/projects/pngdelphi

- Clayton
Back to top
Alain
Guest





PostPosted: Tue Sep 12, 2006 8:11 am    Post subject: Re: Timage Transparent Reply with quote



Quote:
To download a good PNG component for
the VCL head to: http://sourceforge.net/projects/pngdelphi


Getting EInvalidGraphic when I

DESIGN->Picture->LoadFromFile(FileListBox1->FileName);

for image file with .png extension
Back to top
Alain
Guest





PostPosted: Tue Sep 12, 2006 8:11 am    Post subject: Re: Timage Transparent Reply with quote

I have been able to install the PNG package

But still can't remove the JPEG error.
How can I identify which components need to be register so that I may remove
them safely ?

Thanks
Back to top
Alain
Guest





PostPosted: Tue Sep 12, 2006 8:11 am    Post subject: Re: Timage Transparent Reply with quote

Quote:
To download a good PNG component for
the VCL head to: http://sourceforge.net/projects/pngdelphi

- Clayton
How to use Delphi *.pas codes under C++Builder 4 ?


Thanks
Back to top
Clayton Arends
Guest





PostPosted: Tue Sep 12, 2006 9:00 pm    Post subject: Re: Timage Transparent Reply with quote

You need to have the following line in one of your CPP files:

#pragma link "PNGImage"

- Clayton
Back to top
Clayton Arends
Guest





PostPosted: Tue Sep 12, 2006 9:05 pm    Post subject: Re: Timage Transparent Reply with quote

"Alain" <alainbastien (AT) gmail (DOT) com> wrote in message
news:45063fb8 (AT) newsgroups (DOT) borland.com...

Quote:
But still can't remove the JPEG error.

What error? Are you referring to the transparent quality of the JPEGs? If
so, did you convert to PNG from the JPEG or from an original clear source
(such as BMP or TIFF)?

Can you post to the "attachments" group an example of one of the images that
is giving you a problem? It also wouldn't hurt to post a screen shot of the
problem you are having.

- Clayton
Back to top
Alain
Guest





PostPosted: Wed Sep 13, 2006 8:11 am    Post subject: Re: Timage Transparent Reply with quote

Quote:
#pragma link "PNGImage"

- Clayton

Done ..My *.png files open
And the transparency is GREAT as expected
Now I must work out the proportion resizing

Thanks again

Alain
Back to top
Alain
Guest





PostPosted: Wed Sep 13, 2006 8:11 am    Post subject: Re: Timage Transparent Reply with quote

To Clayton:

The PNG works great !!

I wonder How can such application can be done for the WEB ?

My I sent it (the compile or source) to you as attachement so that you can
redirect me to

the appropriate group to get it web based? at least a starting point

Thanks

Alain
Back to top
Clayton Arends
Guest





PostPosted: Wed Sep 13, 2006 10:30 pm    Post subject: Re: Timage Transparent Reply with quote

I haven't yet made any of my applications run from within a web browser so I
cannot help you there. Most likely you will need to make an ActiveX control
but that will limit those who use your product to Internet Explorer users
(and a few other various browsers) on the Windows platform. You can try
asking your question in the "vcl.components.writing" newsgroup or ask a
general question in the "non-technical" group.

Good luck,

- Clayton
Back to top
Alain
Guest





PostPosted: Wed Oct 11, 2006 12:45 pm    Post subject: Re: Timage Transparent Reply with quote

Hello All,

Is it possible to control the transparency of a PNG image loaded on a TImage
using a Trackbar component ?

Thanks

Alain
Back to top
Alain
Guest





PostPosted: Mon Oct 16, 2006 1:41 pm    Post subject: Re: Timage Transparent Reply with quote

"Alain" <alainbastien (AT) gmail (DOT) com> wrote in message
news:452caf32 (AT) newsgroups (DOT) borland.com...
Quote:
Hello All,

Is it possible to control the transparency of a PNG image loaded on a
TImage using a Trackbar component ?

Thanks

Alain

This is from Michel Leunen

Here is how to change the amount of transparency of an image and draw it
on a TImage. All the work is done in a TButton event handler here. I
leave to you the part with the trackbar. You just have to slightly
change the code to be used in the OnChange event of the trackbar.

void __fastcall TForm1::Button1Click(TObject *Sender)
{
Graphics::TBitmap* SourceBmp = new Graphics::TBitmap();
Graphics::TBitmap* DestBmp = new Graphics::TBitmap();
SourceBmp->LoadFromFile("your_image.bmp");
DestBmp->PixelFormat = pf24bit;
DestBmp->Width = SourceBmp->Width;
DestBmp->Height = SourceBmp->Height;

/* alpha gives the amount of transparency.
* 1.0 completely transparent
* 0.0 no transparency
*/
const float alpha = 0.8;

for(int row = 0; row < SourceBmp->Height; row++)
{
RGBTRIPLE* source = static_cast<RGBTRIPLE*>(SourceBmp->ScanLine[row]);
RGBTRIPLE* dest = static_cast<RGBTRIPLE*>(DestBmp->ScanLine[row]);

for(int col = 0; col < SourceBmp->Width; col++)
{
dest->rgbtRed = alpha * dest->rgbtRed + (1-alpha) * source->rgbtRed;
dest->rgbtGreen = alpha * dest->rgbtGreen + (1-alpha) *
source->rgbtGreen;
dest->rgbtBlue = alpha * dest->rgbtBlue + (1-alpha) *
source->rgbtBlue;
source++; dest++;
}
}
Image1->Picture->Assign(DestBmp);

delete SourceBmp;
delete DestBmp;
}
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage) 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.