Skip to content

ralt/xpmjs

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 

XPMJS

Very little library to use pseudo-XPM images in javascript.

Usage example:

<div id="cvs"></div>

var xpmImage = XPM.create(
    '24 24 2 1',
    '  c #AAA',
    'x c #000',
    '      xxxxxxxxxxxx      ',
    '     xxxxxxxxxxxxxx     ',
    '    xxxxxxxxxxxxxxxx    ',
    '   xxxxxxxxxxxxxxxxxx   ',
    '  xxxxxxxxxxxxxxxxxxxx  ',
    ' xxxxxxxxxxxxxxxxxxxxxx ',
    '  xxxxxxxxxxxxxxxxxxxx  ',
    '   xxxxxxxxxxxxxxxxxx   ',
    '    xxxxxxxxxxxxxxxx    ',
    '     xxxxxxxxxxxxxx     ',
    '      xxxxxxxxxxxx      ',
    '       xxxxxxxxxx       ',
    '        xxxxxxxx        ',
    '         xxxxxx         ',
    '          xxxx          ',
    '           xx           ',
    '          xxxx          ',
    '         xxxxxx         ',
    '        xxxxxxxx        ',
    '       xxxxxxxxxx       ',
    '      xxxxxxxxxxxx      ',
    '     xxxxxxxxxxxxxx     ',
    '    xxxxxxxxxxxxxxxx    ',
    '   xxxxxxxxxxxxxxxxxx'
)
document.getElementById('cvs').appendChild(xpmImage)

Will print out: this image

It is not faster than .drawImage, check it out by yourself there. It may catch up with it after caching for multiple times, but it will always be slower.

However, it may have some use, as you can see here. Mainly, bandwidth saving, reuse of the same icon with different colors and quick editing of those icons.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published