Thursday, August 11, 2016

Gui elements: The Button

Creating a graphical user interface in Gimp

Part 4: The Button

Unlike a panel, buttons are usually just one size. Even with thousands of variations most still work as frames. One frame is on, the other off. 
In this tut I'll show how to make a simple button, and how you can add some variations using color.

 Step 1:

 Create a smaller image with a transparent background, 256x256 is good.

 Step 2:

We'll use the rectangle tool to make a rectangular selection.
You might notice the tool itself also has an option to round corners, so let's use it this time.
Set it to a radius of 6, and make your selection about 128 by 64 in the center of the layer.

Step 3:

Set the Bucket fill tool to use Aluminium 6 from the Tango palette, and fill it.
Be sure to keep the selection.

Step 4:

 Add a new transparent layer, and select it in the layers dialog.
Fill it with Aluminium 5, and right click the image Select: None.

Step 5:

 While still on the new layer go over to the tools, and choose the move tool.
Click on the image again, and use the up arrow button to move the layer up 6 pixels.

Step 6:

 The first frame is done.
Merge the top frame down onto the background.
Autocrop the image, and save it as a png to preserve its transparency.

Step 7:

Right click the image: Edit> Undo the autocrop, and undo the merge down.
Then go back to the top layer, and make sure it is selected in the layers dialog.

Step 8:

Right click there or on the image, Layer>Transparency>Alpha to Selection to get the selection of the last fill.

Step 9:

 Click the eye icon on the layers dialog to make the second layer transparent.
Add a brand new layer, select it, and fill it with Aluminium 4.
Release the selection once again, and grab the move tool.
Click on the image, and use the up arrow button to move that layer up 4 pixels this time.

 Step 10:

The second frame is now ready to go, so repeat the steps of merging it down onto the background layer, and autocrop the image to save. Don't worry about the middle layer, as its not visible anyway.

Extra steps:

You can still use the background, and other layers to make more buttons with different colors.
Just be sure to delete the old layer, and make a new one, as bucket filling on something that was already filled will leave some artifacts.

No comments:

Post a Comment