CodeBase - Lines and Dots

Return to the CodeBase listing

Category: Bitmap

Version: 1.0

0
0

Information

Uploaded: 29th Jul 2005 06:44

Modified: 26th Feb 2010 23:07

Author:  Mark Garrett

Summary

Draws a 20 pixel line and 11 dots. Gives a rundown of the rgb values of each pixel. In the left column are seem the resulting line rgb color values of each line pixel. In the right column are given the resulting dot pixel values. Click left mouse button to repeat for other colors.

Full Description

Ever wonder why some programs written don't seem to work just right? Like programs dealing with pixels?<br /> <br /> This basically demonstrates that lines are not constant in value, but dots are. Even diagonal lines drawn with the &quot;line&quot; command do not contain a constant value.<br /> <br /> If a programmer wants to write a successfull pixel routine,one in which he can successfully use the point(x,y) command, using the dot command is the most reliable, and using the line command is most unreliable.<br /> <br /> This program demonstrates this principle by drawing a line with the &quot;line command&quot; and 11 dots with the dot command.<br /> <br /> Then it reads the pixels of the line and the dots and returns the values. If you look closely, you can see the line and dots displayed on the top of the screen.<br /> <br /> First, it displays the original rgb value that is used to draw the line and the dots (a random color) <br /> <br /> then the program reads each pixel from left to right and then displays the rgb and color value on the screen below from top to bottom.<br /> <br /> What is the solution then to this dilema? The solution is to make a function that will draw &quot;dot lines&quot;. You can see in the program that I constructed a line with 4 pixels at the top of the screen out of dots, and that even though they are joined together to form a line, they still give a consistent reading, each pixel identical to the next.<br /> <br /> The values given for this line are the last 4 on the bottom right-hand side of the screen.<br /> <br />

Comments

No comments yet.