Imageclass Syntax

The basics

Let's start by covering just the required syntax for an imageclass.

  __NORMAL "artwork/image-1.png"

Line 1 begins the imageclass
Line 2 gives it a name
Line 3 identifies the image to be used and in which state (explained more below)
Line 4 ends the imageclass

Each of those words beginning with two underscores is actually a keyword (remember those things we talked about back in the definitions part of the howto?). As you can see some keywords do not require arguments and others do.

Applying the basics

Consider the following "my-image.png".

Now lets setup an e16 imageclass with that image to be used in the title bar of a border.

  __NORMAL "artwork/my-image.png"

Hmph. So much for basics. See how the scaling process stretched out the beveled edge.

Imageclass properties

In order to get the desired affect we need to apply some imageclass properties. Below is a list of what's available.





__FLIP __FLIP_90
__FLIP __FLIP_270

In order to fix our border we need to use __EDGE_SCALING and __PADDING.

Edge scaling identifies pixels from the edge of an image that are to be left "as is" when scaling the image. Its purpose is to preserve things like beveled edges so that the scaling/stretching process doesn't distort them as seen in the first example. In the example below, 3 pixels on both sides and 2 pixels on the top and bottom are not scaled in order to leave us our nice beveled look.

Padding is needed when you don't want text (or other images) to begin at the very edges of your image, similar to margins in a text document. See below how the "Eterm-0.9.4" text is positioned away from the edges of the image now? Text justification is done in the textclasses.

The values for both of these options impact the edges of an image in the following order: left, right, top, bottom.

Here's an example of what happens when we apply those properties.

  __NORMAL "artwork/my-image.png"
  __EDGE_SCALING 3 3 2 2
  __PADDING 10 10 4 4


The default fill rule stretches the image. However, its possible to tile an image rather than stretch it.

Below is an image designed for tiling and how how e16 processes the tile directive for that same Eterm border. We maintain a nice pattern look as apposed to the distortion that would occur during any stretching of that image.

  __NORMAL "artwork/tile-image.png"
  __PADDING 10 10 4 4

Visual feedback

So far the only images we've used are declared using the '__NORMAL' keyword. This keyword controls image state. This is the only image state directive that's required in an imageclass. If you'd like to have more visual feedback when using your theme, however, then you need to create and include other images declared with the appropriate image state name.

The table below will help you understand the possible image states.

Image State Name        Usage
__NORMAL Always, unless a more specific image declaration overrides it
__HILITED When mouse pointer hovers over the image
__CLICKED When image is clicked on
__NORMAL_ACTIVE When the window is currently focused
__HILITED_ACTIVE Window is focused and pointer hovers the image
__CLICKED_ACTIVE Window has focus and pointer is clicking the image
__NORMAL_STICKY When window has been set to sticky (on all desktops)
__HILITED_STICKY Window is sticky and pointer hovers the image
__CLICKED_STICKY Window is sticky and pointer is clicking the image
__NORMAL_ACTIVE_STICKY When window is sticky and focused
__HILITED_ACTIVE_STICKY Window is sticky/focused and pointer is hovering image
__CLICKED_ACTIVE_STICKY Window is sticky/focused and pointer is clicking the image

Pulling it all together

Below is an example of using several image states in one image class. Edge scaling follows each image state to address any differences required for each image, but padding is only needed once.

  __NORMAL "artwork/image-normal.png"
  __EDGE_SCALING 4 4 4 4
  __HILITED "artwork/image-hilited.png"
  __EDGE_SCALING 4 4 4 4
  __CLICKED "artwork/image-clicked.png"
  __EDGE_SCALING 4 4 4 4
  __PADDING 8 8 8 8
Syndicate content