Using SiMPLE To Create
Your Own Computer Art
(Part 3)


Welcome to Part 3 of our introductory discussion about creating your own computer art.

In Part 1 we created an image of a "face", and in Part 2 we showed how to create an image of a small multi-colored "target" that could be drawn at any specified location on the screen. (But . . . it sure would be nice if we could find an easy way to place our images at the very center of the screen.)

Question: What is the Location of the Center of the Screen?

Answer: It depends what your computer's current screen resolution  is set to. (Screen resolution  is the number of pixel rows and pixel columns that are available on your screen.)

Back in the "old" days, it was standard to have your screen resolution set to 640x480. What this meant was that your screen was displaying 480 rows, each containing 640 pixels. As technology improved, the "standard" for displays became 800x600. Currently, screen resolutions of 1024x768 (and even higher) are now popular.

As a result, not everyone's computer screen is set to the same resolution. So consequently, the row number (and the column number) for center of the screen may be different for each user.

Fortunately, SiMPLE has a pair of built-in functions  that will tell you the computer's current screen resolution. (A function  is simply a kind of "black box" that supplies you with a desired numerical value.) The "ypixels()"  function will tell you how many rows are available on the screen, and the "xpixels()"  function will tell you how many pixels are available in each row.

Therefore, to draw the "target" image at the center of the screen, just use half of whatever values are returned by the "xpixels()" and "ypixels()" functions:

Ultra-SiMPLE
row = ypixels()/2
col = xpixels()/2
solid color (8)
solid circle (col, row, 70)
solid color (4)
solid circle (col, row, 60)
solid color (5)
solid circle (col, row, 50)
solid color (9)
solid circle (col, row, 40)
solid color (10)
solid circle (col, row, 30)
solid color (14)
solid circle (col, row, 20)
solid color (12)
solid circle (col, row, 10)

And similarly for the "face" image:

Ultra-SiMPLE
row = ypixels()/2
col = xpixels()/2
solid color (14)
solid circle (col, row, 100)
solid color (1)
solid circle (col-30, row-15, 20)
solid circle (col+30, row-15, 20)
solid color (4)
solid circle (col, row+45, 25)


After having come this far in our discussion, perhaps you are thinking to yourself:

"Instead of having to prepare a list of instructions for the computer to perform, wouldn't it be a lot easier to just use a Paint program (such as MSPAINT) for drawing my pictures?"
And the answer would be:
"Yes . . . if you want to create nothing more than static images (such as the "Happy Face and "colored target" images that we've made)."
The real power of computer-generated art lies in its ability to be dynamic and interactive. As you gain experience and become more familiar with SiMPLE's capabilities, you will discover how to create art that doesn't just "sit there like a bump on a log". Instead, you will be able to create works of art that are dynamic  (as we will see in the next part of this discussion).


This concludes the third part of our discussion.


Click here to read Part 4.




[ Webmaster | FAQ's | Home Page | Contact Us ]

© Copyright 2007 SiMPLE CodeWorks, Inc. All rights reserved.