KImage is a Konfabulator library that is meant to be used as a drop-in replacement for complex Image objects. It gives added functionality for treating a group of images as a single image.
Extract the contents of KImage.zip into your Widget's folder, and include KImage.js to be able to create KImage objects.
Usage examples may be found inside the KImage.js file.
KImage was created by James M. Allen.
The functionality that KImage was created to perform was "smart-scaling" of images - a neat effect where you can stretch specific parts of an image, while keeping other parts fixed. The Yahoo! Weather Widget makes use of this technique when you expand/collapse it - the top and bottom of the image are fixed, while the middle stretches to the desired size of the Widget.
The way a Widget developer uses this is by creating a series of images in one of the following three configurations:
This allows for smart-scaling in both horizontal and vertical directions. If you specify the src as "MyImage*.png", then you must have nine images total:
1x3 (Vertical)EditThis allows for smart-scaling in just the vertical direction. If you specify the src as "MyImage|.png", then you must have three images total:
This allows for smart-scaling in just the horizontal direction. If you specify the src as "MyImage<.png", then you must have three images total:
This is the usage example inside KImage.js:
include("KImage.js"); foo = new KImage(); foo.src = "Resources/Window*.png"; foo.hOffset = 30; foo.vOffset = 30; foo.width = 200; foo.height = 150;