Encoding A Picture For Viewing With Red Filter Glasses

For this to work you need a picturebox called Picture1 and it's scalemode set to "Pixels". Just call Encode_for_red_glasses for it to go. This method is also alittle slow so be patient.

Private Sub Encode_for_red_glasses()
On Error Resume Next

Dim x, y, a, bz, c As Long

For x = 1 To Picture1.ScaleWidth

    For y = 1 To Picture1.ScaleHeight

        DoEvents

        a = Picture1.Point(x + 1, y)

        bz = Picture1.Point(x, y + 1)

        c = Picture1.Point(x + 1, y + 1)

        Picture1.PSet (x, y), RGB(CInt(Val(Mid$(CStr(a), 1, 2))), CInt(Val(Mid$(CStr_(bz), 3, 2))), CInt(Val(Mid$(CStr(c), 5, 2))))

        'make the previous two lines into one.

        Next

Next

End Sub

You might also like...

Comments

Michael H

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Computer science education cannot make anybody an expert programmer any more than studying brushes and pigment can make somebody an expert painter” - Eric Raymond