Thursday, July 28, 2016

GUI elements: The Box

Creating a Graphical User Interface In Gimp

Part 2: The box

You figured out how to separate the top and the bottom with a line, and probably even tried to split the left and right by rotating it 90 degrees.
Now how about enclosing things by putting that together?

Step 1:

Make a new transparent image of 6 by 6.
This one is also pretty easy.

Step 2:

Get the 1 pixel brush again, and set to to black.
You will need to zoom in quite a lot.
Draw in the first five pixels forming borders.
Be sure to leave the right and bottom sides blank.

Step 3:

Change the brush to white, and draw three pixels under the first row and column as shown.
Then fill in the right, and bottom as well.
All done. It can already be exported as a repeating texture otherwise known as a "9 patch".
The next steps will show you how to easily scale it up for use in an image.

Step 4:

Create a new image, 128 x 128 here, and set the background to off white.
Again something darker than the white you just used.
Add a new transparent layer, and select it in the layers dialog.
Grab the black 1 pixel brush, and click where you want the box to start.
Now after you click, press the ctrl button. You will notice a line coming from where you just clicked.
If you click again it will create a line to that point.
One catch here however, keep the line straight.
Notice also that it will automatically count how many pixels you have moved the mouse.

Step 5:

If you're careful you can easily make the desired size rectangle you want.
If you are familiar with Gimp you may already have a prefered method to create a 1 pixel outline so by all means use what works for you.

Step 6:

Now when you have finished duplicate that layer.
Make sure to select the original layer in the layers dialog.

Step 7:

Then go back to the layout and right click to get to the colors tools.
Invert the color of the original transparent layer.

Step 8:

Grab the move tool, click on the layer, and move the layer down one, and right one pixel.
You can then merge the two layers together in the layers dialog.
Like befor I suggest playing with opacity.

Or even inverting the colors to make it look outset, rather than inset.

No comments:

Post a Comment