How to make glass effect image in .NET/WinXP
-
Is it possible to make a simple white bar that is see-through and has a smooth alpha-blended shadow? This is my goal: http://www.osx-e.com/screenshots/06\_47\_50\_RealDock.jpg I have a PNG image that is transparent. I imported it in my VB.net project, I set the background and transparent key to the same value, but I only get very ugly shadows. They are not alpha-blended at all. Have you tried making a glass-like image in .NET?
-
Is it possible to make a simple white bar that is see-through and has a smooth alpha-blended shadow? This is my goal: http://www.osx-e.com/screenshots/06\_47\_50\_RealDock.jpg I have a PNG image that is transparent. I imported it in my VB.net project, I set the background and transparent key to the same value, but I only get very ugly shadows. They are not alpha-blended at all. Have you tried making a glass-like image in .NET?
I generally build transparent GIFs; I originally build the icon as an image file in Freehand and then export the file as a gif and reopen it in Fireworks. From there I set up the transparency and save the gif. I have tried other image formats including PNG when I needed the effect and they always look bad; I have never had the problem with transparent GIFs. Also, if the image has a drop shadow, that usually will not work unless it was drawn on a surface with the exact same back color and the target location in the web page.
-
I generally build transparent GIFs; I originally build the icon as an image file in Freehand and then export the file as a gif and reopen it in Fireworks. From there I set up the transparency and save the gif. I have tried other image formats including PNG when I needed the effect and they always look bad; I have never had the problem with transparent GIFs. Also, if the image has a drop shadow, that usually will not work unless it was drawn on a surface with the exact same back color and the target location in the web page.
The biggest problem is the shadows. I want them to look smooth independent of what surface they are drawn on. I think the solution is PNG because it supports more than 1 transparency key. But I don't know how advantage transparent PNG images in VB? How to make their multi-color transparency key work?
-
The biggest problem is the shadows. I want them to look smooth independent of what surface they are drawn on. I think the solution is PNG because it supports more than 1 transparency key. But I don't know how advantage transparent PNG images in VB? How to make their multi-color transparency key work?
-
Is it possible to make a simple white bar that is see-through and has a smooth alpha-blended shadow? This is my goal: http://www.osx-e.com/screenshots/06\_47\_50\_RealDock.jpg I have a PNG image that is transparent. I imported it in my VB.net project, I set the background and transparent key to the same value, but I only get very ugly shadows. They are not alpha-blended at all. Have you tried making a glass-like image in .NET?
Put two Buttons on your form named btnBlendShapes and btnDrawImages respectively. Add a picturebox, named pic. Type this : Import this
Imports System.Drawing.Imaging
Then,
Private Sub btnBlendShapes\_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBlendShapes.Click 'alpha numbers has to be between values 0 and 255. 'alpha 0 is fully transparent while alpha 255 is fully opaque 'of course, change any of the alpha values below depending on which color you want to be more or 'less transparent or opaque 'the first apha value to be fully visible Dim alphaValue As Integer = 255 'the second alpha value will have some transparency Dim alphaValue2 As Integer = 155 'create 2 brushes. 1 brush with the first alpha value and the second brush using the 2nd alpha 'value Dim aBrush As SolidBrush = New SolidBrush(Color.FromArgb(alphaValue, Color.Fuchsia)) Dim aBrush2 As SolidBrush = New SolidBrush(Color.FromArgb(alphaValue2, Color.Goldenrod)) 'draw 2 rectangles, 1 with the first brush and the other rectangle using the 2nd brush pic.CreateGraphics.FillRectangle(aBrush, 0, 0, 100, 100) pic.CreateGraphics.FillRectangle(aBrush2, 50, 50, 100, 100) End Sub Private Sub btnDrawImages\_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDrawImages.Click 'the 2 images to use for the alpha blend. you may have to change the image paths to where the 'images are on your computer. Dim imagePath As String = "AW-9TriplePan2.gif" Dim imagePath2 As String = "AW-9TriplePan2.gif" 'create 2 new images with the above filenames Dim img As Image = Image.FromFile(imagePath) Dim img2 As Image = Image.FromFile(imagePath2) 'create 2 new ojects to use the ImageAttrubute class and the ColorMatrix Class Dim i As ImageAttributes = New ImageAttributes Dim c As ColorMatrix = New ColorMatrix 'draw both images onto the picturebox control. the first image will not have any changes made to 'any of its attributes. pic.CreateGraphics.DrawImage(img, 0, 0, 200, 150) 'with matrix33 you can adjust the images alpha value 'values I think are to be between 0 and 1. Ex: .3, .25, or .5 ect.... c.Matrix33 = 0.45 i.SetColorMatrix(c) 'this 2nd image will have its maxtrix3