🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.delphi.graphics
Article #263

Re: How to remove Transparency from a TPngGraphic?

#263
From: Andrew Fiddian-Green
Date: Tue, 05 Aug 2008 12:14
55 lines
2348 bytes
Jens Gruschel wrote:
> Just an additional note: Instead of iterating over all pixels manually 
> you can use the AlphaBlend WinAPI function, something like:

I tried this one too, and it still did not resolve my problem.

In the meantime I also encountered a similar problem with a JPEG so 
perhaps my difficulty is finally NOT due to the PNG alpha channel, but 
due to something else?

What I am doing is the following:

Step 1
------
Depending on the data type of the source stream create either a 
TJpegImage or a TPngGraphic

   grph := TJpegImage.Create;
  or
   grph := TPngGraphic.Create;


Step 2
------
Load the respective graphic from the source stream

   grph.LoadFromStream()

Step 3
------
Create a TPicture as a holding container

   fPicture := TPicture.Create;
   fPicture.Graphic := grph;

Step 4
------
Create a small size thumbnail

   thumb := TBitmap.Create;
   thumb.Canvas.StretchDraw(.. grph);

Step 5
------
Assign the thumbnail to a TImage on my form

   MyForm.Image1.Picture.Bitmap.Handle := thumb.ReleaseHandle;


Given that the problem is perhaps not due to the PNG alpha channel, the 
only other areas where I can imagine problems are Step 4 and Step 5

Any further thoughts?

AndrewFG
Technical Details
Message-ID: <48984436@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!newshub.sdsu.edu!news.linkpendium.com!news.linkpendium.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <4896e163$1@newsgroups.borland.com> <4897411a@newsgroups.borland.com> <4897697b$1@newsgroups.borland.com> <48977549@newsgroups.borland.com> <48977893$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10a296,6badd6a37592c3c8
X-Google-Attributes: gid10a296,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Tue, 05 Aug 2008 14:14:18 +0200
From: Andrew Fiddian-Green <nn@dd>
User-Agent: Thunderbird 2.0.0.16 (Windows/20080708)
MIME-Version: 1.0
Newsgroups: borland.public.delphi.graphics
Subject: Re: How to remove Transparency from a TPngGraphic?
References: <4896e163$1@newsgroups.borland.com> <4897411a@newsgroups.borland.com> <4897697b$1@newsgroups.borland.com> <48977549@newsgroups.borland.com> <48977893$1@newsgroups.borland.com>
In-Reply-To: <48977893$1@newsgroups.borland.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 82.136.116.153
Message-ID: <48984436@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1217938486 82.136.116.153 (5 Aug 2008 05:14:46 -0700)
Lines: 55
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!newshub.sdsu.edu!news.linkpendium.com!news.linkpendium.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail