Hi,
The shading models will not work for this application. Two suggestions
create a semi transparent white brush or brighten the image in certain
area to make it look like a light is shining on it. Hope this helps.
Dim bm As New Bitmap("Water lilies.jpg")
Dim brTexture As New
TextureBrush(Bitmap.FromFile("WoodTexture.gif"))
Dim p As New Pen(brTexture, 50)
Dim g As Graphics = Graphics.FromImage(bm)
Dim rDraw As Rectangle = New Rectangle(0, 0, bm.Width,
bm.Height)
Dim brWhite As New SolidBrush(Color.FromArgb(48, Color.White))
Dim gp As New GraphicsPath
gp.AddEllipse(bm.Width \ 2, bm.Height \ 2, 500, 500)
Dim regBrighten As New Region(gp)
For x As Integer = 0 To bm.Width - 1
For y As Integer = 0 To bm.Height - 1
Dim pt As New Point(x, y)
If regBrighten.IsVisible(pt) Then
Dim c As Color = bm.GetPixel(x, y)
Dim r, gr, b As Integer
gr = c.G
r = c.R
b = c.B
gr = CInt(gr * 1.8)
r = CInt(r * 1.8)
b = CInt(b * 1.8)
If gr > 255 Then gr = 255
If r > 255 Then r = 255
If b > 255 Then b = 255
c = Color.FromArgb(r, gr, b)
bm.SetPixel(x, y, c)
End If
Next
Next
g.DrawRectangle(p, rDraw)
g.FillEllipse(brWhite, 50, 50, 100, 100)
PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
PictureBox1.Image = bm
Ken
------------------------------
Ken Tucker said:
Hi,
Rod Stephens book Visual Basic Graphics programming has some vb classic
examples on shading models. I will look at it and see if I can upgrade
an example for you.
HYPERLINK
"
http://www.vb-helper.com/vbgp.htm"
http://www.vb-helper.com/vbgp.htm
Ken
------------------------
"SStory" <HYPERLINK
"mailto:
[email protected]"TheStorys@TAKEOUTTHISSPA
MBUSTERsofthome.net> wrote in message
Thanks for the demo Ken, but I am looking I suppose for the White
reflections.
In Photoshop one would probably paint a few semi transparent white
spots
on
the photo to make it look as though the glass were reflecting a little
light
and thus the picture would appear to be behind glass. Still not sure
and
this
as much and art question as a "how to do it" in vb.net graphics
question.
Do I need some sort of light source producing algorithm for that or
what?
Maybe better just to forget the glass effect.
Thanks for the attempt.
Shane
"Ken Tucker [MVP]" <HYPERLINK
"mailto:
[email protected]"HYPERLINK
"mailto:
[email protected]"(e-mail address removed)> wrote in message
Hi,
Maybe this will work.
HYPERLINK
"HYPERLINK
"
http://www.onteorasoftware.com/downloads/woodframe.zip"
http://www.onteoraso
"
http://www.onteorasoftware.com/downloads/woodframe.zip"
http://www.onteoraso
ftware.com/downloads/woodframe.zip
Ken
---------------------
"Herfried K. Wagner [MVP]" <HYPERLINK
"mailto:
[email protected]"HYPERLINK
"mailto:
[email protected]"(e-mail address removed)> wrote in
message
news:
[email protected]:
"mailto:
[email protected]"TheStorys@TAKEOUTTHISSPA
MBUSTERsofthome.net> scripsit:
Well, I am tryign to make a picture look like it is really ina
picture
frame and need it to appear to have the glass over the picture?
Any
suggestions? I am sure it would be reflections of some sort but
have
I am not sure how to do that too. The easiest way would be to
overlay
another semitransparent image (PNG) that adds some effects to the
image. But I don't have a semitransparent PNG here at the moment,
so
I
cannot test it.