60xpm Module

60.1Overview

The xpm module provides measures to write image data in XPM format and to parse a list of strings that is described in the format. To utilize it, import the xpm module using import function.

Below is an example to parse a list of strings described in XPM format.

import(xpm)
foo_xpm = @{
"13 13 2 2 0 0",
"   c #000000",
"#  c #ffffff",
"          #               ",
"          #               ",
"  # # # # # # # # # #     ",
"          #               ",
"          #     #         ",
"        # # # # # #       ",
"      #   #     #   #     ",
"    #     #   #       #   ",
"  #       #   #       #   ",
"  #       #   #       #   ",
"  #       # #         #   ",
"    # # #           #     ",
"                # #       ",
}
img = image(`rgba).xpmdata(foo_xpm)

60.2Extension to image Class

This module extends the image class with methods described here.

image#write@xpm(stream:stream:w):reduce
Writes a xpm image to a stream.
image#xpmdata(xpm[]:string):reduce
Read xpm data from a string list.