0% found this document useful (0 votes)
151 views1 page

Pure VB Pset in Picturebox

This document discusses the basics of per-pixel graphics programming using the built-in Visual Basic functions Point and PSet. It recommends that even experienced VB programmers review this as it provides the foundation for more advanced graphics principles. It describes Point and PSet as the only per-pixel functions in VB, but warns that they are extremely slow and should be avoided for image processing. Code examples are provided to extract the red, green, and blue color components from a pixel retrieved using Point.

Uploaded by

balabooks
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
151 views1 page

Pure VB Pset in Picturebox

This document discusses the basics of per-pixel graphics programming using the built-in Visual Basic functions Point and PSet. It recommends that even experienced VB programmers review this as it provides the foundation for more advanced graphics principles. It describes Point and PSet as the only per-pixel functions in VB, but warns that they are extremely slow and should be avoided for image processing. Code examples are provided to extract the red, green, and blue color components from a pixel retrieved using Point.

Uploaded by

balabooks
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Pure VB Pixel Routines First, lets discuss the basics of per-pixel graphics programming using only built-in Visual

Basic functions. I recommend that even hardened VB veterans glance through this document, as it provides the foundation for the advanced graphics principles discussed in the next three tutorials. We will discuss the only VB per-pixel graphics functions (Point and PSet), and after this is done you may know a lot more than you ever wanted to about VB graphics :) *hehe* Most of you have probably heard of the horrible twins of PSet and Point*. These two routines are usually the first per-pixel methods introduced to VB programmers (since they come included as part of the language), but perhaps inevitably they are also the slowest way to do things. Avoid ever using these routines for per-pixel image processing (though they do have some uses in non-pixel-sized work). I include them here only for completeness; I would never recommend using them in an actual image processing program because they are so extremely slow. Why are they so slow? Well discuss that later, after weve looked at their syntax.

Dim Color as Long Color = PictureBox.Point(x,y) Public Function ExtractR(ByVal CurrentColor As Long) As Byte ExtractR = CurrentColor And 255 End Function Public Function ExtractG(ByVal CurrentColor As Long) As Byte ExtractG = (CurrentColor \ 256) And 255 End Function Public Function ExtractB(ByVal CurrentColor As Long) As Byte ExtractB = (CurrentColor \ 65536) And 255 End Function

Dim R as Byte, G as Byte, B as Byte Dim Color as Long Color = PictureBox.Point(0, 0) R = ExtractR(Color) G = ExtractG(Color) B = ExtractB(Color)

PictureBox.PSet (x,y), Color

You might also like