Author Topic: XPM Exporting (xpm2 format) [v0.3.4-1]  (Read 1510 times)

From the X PixMap Wikipedia entry:
Quote
X PixMap (XPM) is an image file format used by the X Window System, created in 1989 by Daniel Dardailler and Colas Nahaboo working at Bull Research Center at Sophia Antipolis, France, and later enhanced by Arnaud Le Hors.

It is intended primarily for creating icon pixmaps, and supports transparent pixels. Derived from the earlier XBM syntax, it is a plain text file in the XPM2 format or of a C programming language syntax, which can be included in a C program file.

Quote
ACDSee, Amaya, CorelDRAW, GIMP, ImageMagick, IrfanView (formats plugin), PaintShop Pro, Photoshop (plugins), and XnView among others support XPM. Gravatar and picons also support XPM.

I stumbled upon this and took note of the syntax (notably XPM2), and was curious if I could possibly add some sort of exporter to this format.
This, obviously, is well suited for pixel art, and possibly maps of servers later on down the line.



https://github.com/TheBlackParrot/blockland-xpm
https://github.com/TheBlackParrot/blockland-xpm/raw/master/System_XPMSupport.zip

Sample exports:
https://dl.dropboxusercontent.com/u/182376391/test.xpm
https://dl.dropboxusercontent.com/u/182376391/test2.xpm
https://dl.dropboxusercontent.com/u/182376391/test3.xpm
(save: https://dl.dropboxusercontent.com/u/182376391/xpmtest.bls)

It adapts to the colorset chosen, since you can define whatever you want for the colors.



COMMANDS:
  • /setXPMStart - sets the start position of the XPM export area (e.g. top-left corner)
  • /setXPMEnd - sets the end position of the XPM export area (e.g. bottom-right corner)
  • /saveXPMFile [filename] - exports the selected area to XPM (e.g. config/image.xpm)



video because w/e
https://www.youtube.com/watch?v=p234qansP3c



TO DO:
  • [FEATURE] Detect if the user is doing vertical (X/Z, Y/Z) or horizontal (X/Y) art, right now it's only horizontal (flat on the ground)
  • [FEATURE] Add in a client/server handshake instead of this being purely server-sided (hence System) [v0.2]
  • [FEATURE] Switch the method to have 1 1x1 block represent 1 pixel [v0.3]
  • [BUG] Only export used colors, not all 64 slots [v0.1.2]
  • [FEATURE] Allow for non-existant bricks in a specified export area to represent the background [v0.1.3]
  • [FEATURE] Allow the user to specify their own background color
  • [FEATURE] Allow the user to specify a scale for the image (e.g. 1x1 represents 1 pixel, 2, 3, 4, etc.)
  • [FEATURE] Darken lower z-depths if generating a map (maybe????)
  • [FEATURE] Add a couple of header comments (e.g. owner, generator version, date/time, etc.) [v0.3.2]
  • [BUG] Allow for simultaneous saving between players (IDs in global vars?)
  • [BUG] Work around some strange 256 character limit in commandToClient [v0.3.1]
  • [BUG] Round numbers if they have some odd decimal value, e.g. 4.99999 or 5.00001 [v0.3.3]
  • [FEATURE] Allow colors to be scaled depending on the lighting of the server (off by default)
  • [FEATURE] Allow for switching to XPM1 and XPM3 upon request
  • [FEATURE] Help command via /xpmhelp [v0.3.4]
« Last Edit: March 26, 2015, 11:35:35 PM by TheBlackParrot »


Very useful for pixel art or patterns.

Thank you