Infralution Support Forum Index Infralution Support
Support groups for Infralution products
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Transparent PNG background in splash form is not transparent

 
Post new topic   Reply to topic    Infralution Support Forum Index -> .NET Encryptor Support
View previous topic :: View next topic  
Author Message
ancientOne



Joined: 26 May 2011
Posts: 26

PostPosted: Wed Jul 11, 2012 3:36 am    Post subject: Transparent PNG background in splash form is not transparent Reply with quote

I'm using the NetEncryptor splash form with a transparent background on which my own 32bpp .png logo image is substituted for the Infralution image used in the samples. The form background is forced to transparent with the following code in Sub new() of SplashForm.vb:

Private Sub New()
InitializeComponent()

'*** transparent background new code....
Me.SetStyle(System.Windows.Forms.ControlStyles.SupportsTransparentBackColor, True)
Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None
Me.BackColor = System.Drawing.Color.Transparent
Me.TransparencyKey = System.Drawing.Color.White

_bitmap = new Bitmap(BackgroundImage)
_hBitmap = _bitmap.GetHbitmap(Color.FromArgb(0))

End Sub

I've tried this several different ways, and it seems to work fine in the IDE but when installed and executed on a target system (virtual box), the transparency is not respected and the transparent border is rendered as white. My thought process was to make the form background transparent and set the .png "see through" color either transparent or white and let the transparency key handle the rendering. But it isn't.

I don't think this is a NetEncryptor problem (but I haven't tried installing with the Infralution logo). Anybody else having this problem or have any suggestions?

Thanks
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Wed Jul 11, 2012 6:05 am    Post subject: Reply with quote

I think probably you are seeing a limitation of the Virtual Box display drivers which don't always handle transparency properly.

However you don't need to try to implement transparency like this because the original SplashForm actually handles full 32 bit alpha blended images. These are much better than using a transparency key. They allow you to achieve full transparency in a region by setting the alpha channel to 0 in that area - but more importantly they allow you to get smooth alpha blended edges (so you don't get jagged edges between transparent and non-transparent curved areas).

If you run the original splash form code with the original Infralution Splash.png you will see that this mechanism does work on Virtual Box and you get an image with a smooth transition between transparent and non-transparent regions.

So my advice would be to convert your splash image into a 32 bit alpha blended image (like the original Splash.png). You can do this with any good image editor (Gimp is a good free editor).
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
ancientOne



Joined: 26 May 2011
Posts: 26

PostPosted: Tue Jul 17, 2012 1:57 pm    Post subject: Reply with quote

Yes, I think you are right about how VirtualBox handles (or doesn't handle) transparency in this situation. I tried my installer unmodified on a real XP machine and it appears correctly. Thank you.
Back to top
View user's profile Send private message
ancientOne



Joined: 26 May 2011
Posts: 26

PostPosted: Tue Aug 14, 2012 3:14 am    Post subject: Reply with quote

Grant, The image editor I typically use is Irfanview, and I am concerned that Irfanview may not be creating a proper 32-bit alpha blended image.

Can you outline step-by-step how to save an image as a 32-bit alpha blended image in Irfanview? Or, alternately in Paint.Net or Gimp?

On some XP systems, and not just virtual ones, the transparent areas of the PNG are showing up white.

Also, would it be better to deploy and load the PNG from disk rather than having it in memory as a system resource? It seems like the way Net.Encryptor works, I am using 3x the RAM resources if it is a .net application resource. Or does it make any difference?

Thanks.
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Tue Aug 14, 2012 8:29 am    Post subject: Reply with quote

Have you remove the extra code you put in the SplashForm sub New (in your original post). This code may well interfere with proper alpha blending transparency.

If you aren't sure whether your own image is alpha blended then you can try using the default Splash.png image (Infralution logo) that comes with .NET Encryptor. If this works OK but your image doesn't then you know that there is a problem with your image.

I'm not familiar with Irfanview. In GIMP to create an alphablended image use the File->New menu to create an image of the required size and then you must use the Layer->Transparency->Add Alpha Channel menu to add an alpha channel. Once you have done this you can use the Edit->Clear menu to clear the default white background. Now you will see the checkerboard pattern that indicates transparency. You can now paint onto the image using the tools with different alpha levels set.

If you have an existing image that you want to convert to alphablended then you can open the image in GIMP and then use the Layer->Transparency->Color to Alpha menu to automatically generate an alpha channel by selecting the background color of the original image. How well this works depends on the complexity original image.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Infralution Support Forum Index -> .NET Encryptor Support 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, 2005 phpBB Group