CVI
edge.js 1.5 allows you to add individual masks (inc. inbuilt mask) to images on your webpages. It uses unobtrusive javascript to keep your code clean.

It works in all the major browsers - Mozilla Firefox 1.5+, Opera 9+, Safari and IE6+. On older browsers, it'll degrade and your visitors won't notice a thing.
CVI-lab: Get a fast impression of the effects and their illustration qualities.

Demonstration

Shows some of the things edge.js does.

First 5 images with class = "edges imaskN" the two other images with class = "edges inbuilt"...

beautiful girl

Koblenz Wiesbaden Mainz Frankfurt Mannheim Heidelberg Würzburg Bamberg Nürnberg Karlsruhe Heilbronn Stuttgart Ulm Augsburg Baden map
 

Images used are copyrighted and are used for demonstration only.

Setting Up

Download edge.js and include it into your webpage.

// only if you want to use mask images instead of the inbuilt
<script type="text/javascript">
var mask2load = new Array();
mask2load[0] = "masks/8bit/crippleedge.png";
mask2load[1] = "masks/8bit/frizzedge.png";
mask2load[2] = "masks/8bit/softedge.png";
// if you want IE to use mask images: add GIF versions
// of the same name to the array (edge.js will find them)
mask2load[3] = "masks/2bit/crippleedge.gif";
mask2load[4] = "masks/2bit/frizzedge.gif";
mask2load[5] = "masks/2bit/softedge.gif";
</script>
// else only this line...
<script type="text/javascript" src="edge.js"></script>

Using It

To get the masked picture edges just add a class="edge" to the image.

You'll find a few provided mask images
in low (2bit GIF format) "masks/2bit/" quality (required by IE)
and high (8bit PNG format) "masks/8bit/" quality.

softedge crippleedge frizzedge splatteredge waveedge
Create your own mask images for individual edge effects.

Classes

Scripting lib

If you want flexibility, use "cvi_edge_lib.js" instead of "edge.js". You can make your images respond to user actions (e.g. changing one or more options when the image is hovered over).

Set defaults using Javascript
cvi_edge.defaultMask = 0; //INT 0-n (mask number)
cvi_edge.defaultInbuilt = false; //BOOLEAN (inbuilt options below)
cvi_edge.defaultType = 'frame'; //STR 'f|l|r'-'frame|linear|radial'
cvi_edge.defaultAngle = 0; //INT 0|90|180|270 (degree) [linear only]
cvi_edge.defaultSize = 20; //INT 1-200 (px) [frame only]
If cvi_filter_lib.js is loaded also...
cvi_edge.defaultFilter = null; //OBJ [{f='grayscale'},{f='emboss', s:1}...]

Add images using Javascript
cvi_edge.add(image, options);
image should be an image element: document.getElementById("myimg")
options can contain one or more values: {mask: value, inbuilt: value, type: value, angle: value, size: value, filter: value}
Examples:
cvi_edge.add(document.getElementById("myimg"), {mask: 2});
<img onLoad="cvi_edge.add(this, { mask: 2 });" ...>

Modify images using Javascript
cvi_edge.modify(image, options);
If the image has already an effect but a option value has changed, the effect will be changed accordingly.
Example:
cvi_edge.modify(document.getElementById("myimg"), { mask: 0, inbuilt: false }); cvi_edge.modify(document.getElementById("myimg"), { inbuilt: true, type: 'radial' });

Remove effect from an image using Javascript
cvi_edge.remove(image);

Support libs

If you are using the more flexible "cvi_edge_lib.js" instead of "edge.js", you'll get access to additional features by the following support libraries (part of distribution):

Why use Javascript Image Masks?

In older browsers, the script degrades and your visitors won't notice a thing.

Download

Please read the license before you download edge.js 1.5

F.A.Q.

Please read the Frequently Asked Questions before you contact the author.

History

Version 1.5

Version 1.4 Version 1.31 Version 1.3 Version 1.2 Version 1.1 Version 1.0

Contact

Please leave any comments at this contact formular.

License

edge.js and cvi_edge_lib.js are distributed under the Netzgestade Non-commercial Software License Agreement.
License permits free of charge use on non-commercial and private web sites only under special conditions (as described in the license). This license equals neither "open source" nor "public domain". There are also Commercial Software Licenses available.

YOU AGREE TO ALL CONDITIONS OF THIS LICENCE AGREEMENT CONCERNING THE USE OF THE SOFTWARE BY ACCEPTING THIS LICENCE.
IF YOU DO NOT AGREE TO ALL CONDITIONS OF THIS AGREEMENT, YOU SHALL NOT INSTALL THE SOFTWARE, OR USE IT IN OTHER WAYS.

Other Projects

edge.netzgesta.de © 2024 by Christian Effenberger :: Imprint feed   twitter   facebook   myspace   delicious   digg   reddit   magnoliacom   newsvine   furl   google   yahoo   blinklist   mister-wong