Part 2 of fun with Java


I’ve been at Java programming again. I’ve organized some code into functions and have a whole new system of generating images. Particularly, I have improved my most useful function. I’ll try to include a screenshot here.

Screenshot (169)

This function is the new and improved version of the original chessboard function. It is not limited to zeroes and ones. It supports multiple colors, which in this case are represented by integers. However, theoretically these numbers can be interpreted in any way you would like. For example shades of gray or an indexed palette. This function makes no assumptions about what I or anyone else might do with the array. What those colors are depends entirely on other code which sets up the colors in a palette. I have functions for that though too which are used in combination to make rainbow or grayscale colors.

But that’s not all! It now does more that squares. It has the variables box_width, box_height, and box_depth which are independent of each other. These variables are essential as they allow tell the program when to switch to a new color. For example, if you set the height higher than the width, the rectangles will appear taller than they are wide. I’ll show some example images that have been generated with this function.

So as you can see, I’ve learned a lot more about creating images using Java. However it’s very time consuming and exhausting. I think I’ll take a break for awhile but it’s so rewarding seeing the kinds of things I can make with it.

Advertisements

Author: chandlerklebs

I have unusual thoughts on almost every subject. I am as Pro-Life as I can possibly be. I am strongly opposed to violence of any type. That includes rape, war, and (obviously) abortion. Everything I think, speak, and write must be filtered by the effect it could have on the lives of others. If I am in any way promoting violence accidentally, please let me know.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s