{
    "content": [
        {
            "type": "text",
            "text": "# Image::Xbm (perldoc)\n\n## NAME\n\nImage::Xbm - Load, create, manipulate and save xbm image files.\n\n## SYNOPSIS\n\nuse Image::Xbm ;\nmy $j = Image::Xbm->new( -file, 'balArrow.xbm' ) ;\nmy $i = Image::Xbm->new( -width => 10, -height => 16 ) ;\nmy $h = $i->new ; # Copy of $i\nmy $p = Image::Xbm->newfromstring( \"###\\n#-#\\n###\" ) ;\nmy $q = $p->newfromstring( \"H##\", \"#-#\", \"###\" ) ;\nmy $s = $q->serialse ; # Compresses a little too.\nmy $t = Image::Xbm->newfromserialsed( $s ) ;\n$i->xybit( 5, 8, 1 ) ;           # Set a bit\nprint '1' if $i->xybit( 9, 3 ) ; # Get a bit\nprint $i->xy( 4, 5 ) ;           # Will print black or white\n$i->vec( 24, 0 ) ;            # Set a bit using a vector offset\nprint '1' if $i->vec( 24 ) ;  # Get a bit using a vector offset\nprint $i->get( -width ) ;     # Get and set object and class attributes\n$i->set( -height, 15 ) ;\n$i->load( 'test.xbm' ) ;\n$i->save ;\nprint \"equal\\n\" if $i->isequal( $j ) ;\nprint $j->asstring ;\n#####-\n###---\n###---\n#--#--\n#---#-\n-----#\nprint $j->asbinstring ;\n1111101110001110001001001000100000010000\nView an xbm file from the command line:\n% perl -MImage::Xbm -e'print Image::Xbm->new(-file,shift)->asstring' file\nCreate an xbm file from the command line:\n% perl -MImage::Xbm -e'Image::Xbm->newfromstring(\"###\\n#-#\\n-#-\")->save(\"test.xbm\")'\n\n## DESCRIPTION\n\nThis class module provides basic load, manipulate and save functionality for the xbm file\nformat. It inherits from \"Image::Base\" which provides additional manipulation functionality,\ne.g. \"newfromimage()\". See the \"Image::Base\" pod for information on adding your own\nfunctionality to all the \"Image::Base\" derived classes.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **CHANGES**\n- **AUTHOR**\n- **COPYRIGHT**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "Image::Xbm",
        "section": "",
        "mode": "perldoc",
        "summary": "Image::Xbm - Load, create, manipulate and save xbm image files.",
        "synopsis": "use Image::Xbm ;\nmy $j = Image::Xbm->new( -file, 'balArrow.xbm' ) ;\nmy $i = Image::Xbm->new( -width => 10, -height => 16 ) ;\nmy $h = $i->new ; # Copy of $i\nmy $p = Image::Xbm->newfromstring( \"###\\n#-#\\n###\" ) ;\nmy $q = $p->newfromstring( \"H##\", \"#-#\", \"###\" ) ;\nmy $s = $q->serialse ; # Compresses a little too.\nmy $t = Image::Xbm->newfromserialsed( $s ) ;\n$i->xybit( 5, 8, 1 ) ;           # Set a bit\nprint '1' if $i->xybit( 9, 3 ) ; # Get a bit\nprint $i->xy( 4, 5 ) ;           # Will print black or white\n$i->vec( 24, 0 ) ;            # Set a bit using a vector offset\nprint '1' if $i->vec( 24 ) ;  # Get a bit using a vector offset\nprint $i->get( -width ) ;     # Get and set object and class attributes\n$i->set( -height, 15 ) ;\n$i->load( 'test.xbm' ) ;\n$i->save ;\nprint \"equal\\n\" if $i->isequal( $j ) ;\nprint $j->asstring ;\n#####-\n###---\n###---\n#--#--\n#---#-\n-----#\nprint $j->asbinstring ;\n1111101110001110001001001000100000010000\nView an xbm file from the command line:\n% perl -MImage::Xbm -e'print Image::Xbm->new(-file,shift)->asstring' file\nCreate an xbm file from the command line:\n% perl -MImage::Xbm -e'Image::Xbm->newfromstring(\"###\\n#-#\\n-#-\")->save(\"test.xbm\")'",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 51,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 179,
                "subsections": []
            },
            {
                "name": "CHANGES",
                "lines": 25,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "COPYRIGHT",
                "lines": 4,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "Image::Xbm - Load, create, manipulate and save xbm image files.\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "use Image::Xbm ;\n\nmy $j = Image::Xbm->new( -file, 'balArrow.xbm' ) ;\n\nmy $i = Image::Xbm->new( -width => 10, -height => 16 ) ;\n\nmy $h = $i->new ; # Copy of $i\n\nmy $p = Image::Xbm->newfromstring( \"###\\n#-#\\n###\" ) ;\n\nmy $q = $p->newfromstring( \"H##\", \"#-#\", \"###\" ) ;\n\nmy $s = $q->serialse ; # Compresses a little too.\nmy $t = Image::Xbm->newfromserialsed( $s ) ;\n\n$i->xybit( 5, 8, 1 ) ;           # Set a bit\nprint '1' if $i->xybit( 9, 3 ) ; # Get a bit\nprint $i->xy( 4, 5 ) ;           # Will print black or white\n\n$i->vec( 24, 0 ) ;            # Set a bit using a vector offset\nprint '1' if $i->vec( 24 ) ;  # Get a bit using a vector offset\n\nprint $i->get( -width ) ;     # Get and set object and class attributes\n$i->set( -height, 15 ) ;\n\n$i->load( 'test.xbm' ) ;\n$i->save ;\n\nprint \"equal\\n\" if $i->isequal( $j ) ;\n\nprint $j->asstring ;\n\n#####-\n###---\n###---\n#--#--\n#---#-\n-----#\n\nprint $j->asbinstring ;\n\n1111101110001110001001001000100000010000\n\nView an xbm file from the command line:\n\n% perl -MImage::Xbm -e'print Image::Xbm->new(-file,shift)->asstring' file\n\nCreate an xbm file from the command line:\n\n% perl -MImage::Xbm -e'Image::Xbm->newfromstring(\"###\\n#-#\\n-#-\")->save(\"test.xbm\")'\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "This class module provides basic load, manipulate and save functionality for the xbm file\nformat. It inherits from \"Image::Base\" which provides additional manipulation functionality,\ne.g. \"newfromimage()\". See the \"Image::Base\" pod for information on adding your own\nfunctionality to all the \"Image::Base\" derived classes.\n\nnew()\nmy $i = Image::Xbm->new( -file => 'test.xbm' ) ;\nmy $j = Image::Xbm->new( -width => 12, -height => 18 ) ;\nmy $k = $i->new ;\n\nWe can create a new xbm image by reading in a file, or by creating an image from scratch (all\nthe bits are unset by default), or by copying an image object that we created earlier.\n\nIf we set \"-file\" then all the other arguments are ignored (since they're taken from the file).\nIf we don't specify a file, \"-width\" and \"-height\" are mandatory.\n\n\"-file\"\nThe name of the file to read when creating the image. May contain a full path. This is also\nthe default name used for \"load\"ing and \"save\"ing, though it can be overridden when you load\nor save.\n\n\"-width\"\nThe width of the image; taken from the file or set when the object is created; read-only.\n\n\"-height\"\nThe height of the image; taken from the file or set when the object is created; read-only.\n\n\"-hotx\"\nThe x-coord of the image's hotspot; taken from the file or set when the object is created.\nSet to -1 if there is no hotspot.\n\n\"-hoty\"\nThe y-coord of the image's hotspot; taken from the file or set when the object is created.\nSet to -1 if there is no hotspot.\n\n\"-bits\"\nThe bit vector that stores the image; read-only.\n\nnewfromstring()\nmy $p = Image::Xbm->newfromstring( \"###\\n#-#\\n###\" ) ;\nmy $q = $p->newfromstring( \"H##\", \"#-#\", \"###\" ) ;\nmy $r = $p->newfromstring( $p->asstring ) ;\n\nCreate a new bitmap from a string or from an array or list of strings. If you want to use\ndifferent characters you can:\n\nImage::Xbm->set( -setch => 'X', -unsetch => ' ' ) ;\nmy $s = $p->newfromstring( \"XXX\", \"X X\", \"XhX\" ) ;\n\nYou can also specify a hotspot by making one of the characters a 'H' (set bit hotspot) or 'h'\n(unset bit hotspot) -- you can use different characters by setting \"-sethotch\" and \"-unsethotch\"\nrespectively.\n\nnewfromserialised()\nmy $i = Image::Xbm->newfromserialised( $s ) ;\n\nCreates an image from a string created with the \"serialse()\" method. Since such strings are a\nlittle more compressed than xbm files or Image::Xbm objects they might be useful if storing a\nlot of bitmaps, or for transferring bitmaps over comms links.\n\nserialise()\nmy $s = $i->serialise ;\n\nCreates a string version of the image which can be completed recreated using the\n\"newfromserialised\" method.\n\nget()\nmy $width = $i->get( -width ) ;\nmy( $hotx, $hoty ) = $i->get( -hotx, -hoty ) ;\n\nGet any of the object's attributes. Multiple attributes may be requested in a single call.\n\nSee \"xy\" and \"vec\" to get/set bits of the image itself.\n\nset()\n$i->set( -hotx => 120, -hoty => 32 ) ;\n\nSet any of the object's attributes. Multiple attributes may be set in a single call. Except for\n\"-setch\" and \"-unsetch\" all attributes are object attributes; some attributes are read-only.\n\nSee \"xy\" and \"vec\" to get/set bits of the image itself.\n\nclass attributes\nImage::Xbm->set( -setch => 'X' ) ;\n$i->set( -setch => '@', -unsetch => '*' ) ;\n\n\"-setch\"\nThe character to print set bits as when using \"asstring\", default is '#'. This is a class\nattribute accessible from the class or an object via \"get\" and \"set\".\n\n\"-unsetch\"\nThe character to print set bits as when using \"asstring\", default is '-'. This is a class\nattribute accessible from the class or an object via \"get\" and \"set\".\n\n\"-sethotch\"\nThe character to print set bits as when using \"asstring\", default is 'H'. This is a class\nattribute accessible from the class or an object via \"get\" and \"set\".\n\n\"-unsethotch\"\nThe character to print set bits as when using \"asstring\", default is 'h'. This is a class\nattribute accessible from the class or an object via \"get\" and \"set\".\n\nxybit()\n$i->xy( 4, 11, 1 ) ;      # Set the bit at point 4,11\nmy $v = $i->xy( 9, 17 ) ; # Get the bit at point 9,17\n\nGet/set bits using x, y coordinates; coordinates start at 0.\n\nxy()\n$i->xy( 4, 11, 'black' ) ;  # Set the bit from a colour at point 4,11\nmy $v = $i->xy( 9, 17 ) ;   # Get the bit as a colour at point 9,17\n\nGet/set bits using colours using x, y coordinates; coordinates start at 0.\n\nIf set with a colour of 'black' or a numeric value > 0 or a string not matching /^#0+$/ then the\nbit will be set, otherwise it will be cleared.\n\nIf you get a colour you will always get 'black' or 'white'.\n\nvec()\n$i->vec( 43, 0 ) ;      # Unset the bit at offset 43\nmy $v = $i->vec( 87 ) ; # Get the bit at offset 87\n\nGet/set bits using vector offsets; offsets start at 0.\n\nload()\n$i->load ;\n$i->load( 'test.xbm' ) ;\n\nLoad the image whose name is given, or if none is given load the image whose name is in the\n\"-file\" attribute.\n\nsave()\n$i->save ;\n$i->save( 'test.xbm' ) ;\n\nSave the image using the name given, or if none is given save the image using the name in the\n\"-file\" attribute. The image is saved in xbm format, e.g.\n\n#define testwidth 6\n#define testheight 6\nstatic unsigned char testbits[] = {\n0x1f, 0x07, 0x07, 0x09, 0x11, 0x20 } ;\n\nisequal()\nprint \"equal\\n\" if $i->isequal( $j ) ;\n\nReturns true (1) if the images are equal, false (0) otherwise. Note that hotspots and filenames\nare ignored, so we compare width, height and the actual bits only.\n\nasstring()\nprint $i->asstring ;\n\nReturns the image as a string, e.g.\n\n#####-\n###---\n###---\n#--#--\n#---#-\n-----#\n\nThe characters used may be changed by \"set\"ting the \"-setch\" and \"-unsetch\" characters. If you\ngive \"asstring\" a parameter it will print out the hotspot if present using \"-sethotch\" or\n\"-unsethotch\" as appropriate, e.g.\n\nprint $n->asstring( 1 ) ;\n\nH##\n#-#\n###\n\nasbinstring()\nprint $i->asbinstring ;\n\nReturns the image as a string of 0's and 1's, e.g.\n\n1111101110001110001001001000100000010000\n",
                "subsections": []
            },
            "CHANGES": {
                "content": "2000/11/09\n\nAdded Jerrad Pierce's patch to allow load() to accept filehandles or strings; will document in\nnext release.\n\n2000/05/05\n\nAdded newfromserialised() and serialise() methods.\n\n2000/05/04\n\nMade xy() compatible with Image::Base, use xybit() for the earlier functionality.\n\n2000/05/01\n\nImproved speed of vec(), xy() and asstring().\n\nTried use integer to improve speed but according to Benchmark it made the code slower so I\ndropped it; interestingly perl 5.6.0 was around 25% slower than perl 5.004 with and without use\ninteger.\n\n2000/04/30\n\nCreated.\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "Mark Summerfield. I can be contacted as <summer@perlpress.com> - please include the word 'xbm'\nin the subject line.\n",
                "subsections": []
            },
            "COPYRIGHT": {
                "content": "Copyright (c) Mark Summerfield 2000. All Rights Reserved.\n\nThis module may be used/distributed/modified under the LGPL.\n",
                "subsections": []
            }
        }
    }
}