{
    "content": [
        {
            "type": "text",
            "text": "# Image::Base (perldoc)\n\n## NAME\n\nImage::Base - base class for loading, manipulating and saving images.\n\n## SYNOPSIS\n\nThis class should not be used directly. Known inheritors are Image::Xbm and Image::Xpm.\nuse Image::Xpm ;\nmy $i = Image::Xpm->new( -file => 'test.xpm' ) ;\n$i->line( 1, 1, 3, 7, 'red' ) ;\n$i->ellipse( 3, 3, 6, 7, '#ff00cc' ) ;\n$i->rectangle( 4, 2, 9, 8, 'blue' ) ;\nIf you want to create your own algorithms to manipulate images in terms of (x,y,colour) then you\ncould extend this class (without changing the file), like this:\n# Filename: mylibrary.pl\npackage Image::Base ; # Switch to this class to build on it.\nsub mytransform {\nmy $self  = shift ;\nmy $class = ref( $self ) || $self ;\n# Perform your transformation here; might be drawing a line or filling\n# a rectangle or whatever... getting/setting pixels using $self->xy().\n}\npackage main ; # Switch back to the default package.\nNow if you \"require\" mylibrary.pl after you've \"use\"d Image::Xpm or any other Image::Base\ninheriting classes then all these classes will inherit your \"mytransform()\" method.\n\n## DESCRIPTION\n\nnewfromimage()\nmy $bitmap = Image::Xbm->new( -file => 'bitmap.xbm' ) ;\nmy $pixmap = $bitmap->newfromimage( 'Image::Xpm', -cpp => 1 ) ;\n$pixmap->save( 'pixmap.xpm' ) ;\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::Base",
        "section": "",
        "mode": "perldoc",
        "summary": "Image::Base - base class for loading, manipulating and saving images.",
        "synopsis": "This class should not be used directly. Known inheritors are Image::Xbm and Image::Xpm.\nuse Image::Xpm ;\nmy $i = Image::Xpm->new( -file => 'test.xpm' ) ;\n$i->line( 1, 1, 3, 7, 'red' ) ;\n$i->ellipse( 3, 3, 6, 7, '#ff00cc' ) ;\n$i->rectangle( 4, 2, 9, 8, 'blue' ) ;\nIf you want to create your own algorithms to manipulate images in terms of (x,y,colour) then you\ncould extend this class (without changing the file), like this:\n# Filename: mylibrary.pl\npackage Image::Base ; # Switch to this class to build on it.\nsub mytransform {\nmy $self  = shift ;\nmy $class = ref( $self ) || $self ;\n# Perform your transformation here; might be drawing a line or filling\n# a rectangle or whatever... getting/setting pixels using $self->xy().\n}\npackage main ; # Switch back to the default package.\nNow if you \"require\" mylibrary.pl after you've \"use\"d Image::Xpm or any other Image::Base\ninheriting classes then all these classes will inherit your \"mytransform()\" method.",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 28,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 95,
                "subsections": []
            },
            {
                "name": "CHANGES",
                "lines": 8,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "COPYRIGHT",
                "lines": 4,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "Image::Base - base class for loading, manipulating and saving images.\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "This class should not be used directly. Known inheritors are Image::Xbm and Image::Xpm.\n\nuse Image::Xpm ;\n\nmy $i = Image::Xpm->new( -file => 'test.xpm' ) ;\n$i->line( 1, 1, 3, 7, 'red' ) ;\n$i->ellipse( 3, 3, 6, 7, '#ff00cc' ) ;\n$i->rectangle( 4, 2, 9, 8, 'blue' ) ;\n\nIf you want to create your own algorithms to manipulate images in terms of (x,y,colour) then you\ncould extend this class (without changing the file), like this:\n\n# Filename: mylibrary.pl\npackage Image::Base ; # Switch to this class to build on it.\n\nsub mytransform {\nmy $self  = shift ;\nmy $class = ref( $self ) || $self ;\n\n# Perform your transformation here; might be drawing a line or filling\n# a rectangle or whatever... getting/setting pixels using $self->xy().\n}\n\npackage main ; # Switch back to the default package.\n\nNow if you \"require\" mylibrary.pl after you've \"use\"d Image::Xpm or any other Image::Base\ninheriting classes then all these classes will inherit your \"mytransform()\" method.\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "newfromimage()\nmy $bitmap = Image::Xbm->new( -file => 'bitmap.xbm' ) ;\nmy $pixmap = $bitmap->newfromimage( 'Image::Xpm', -cpp => 1 ) ;\n$pixmap->save( 'pixmap.xpm' ) ;\n\nNote that the above will only work if you've installed Image::Xbm and Image::Xpm, but will work\ncorrectly for any image object that inherits from Image::Base and respects its API.\n\nYou can use this method to transform an image to another image of the same type but with some\ndifferent characteristics, e.g.\n\nmy $p = Image::Xpm->new( -file => 'test1.xpm' ) ;\nmy $q = $p->newfromimage( ref $p, -cpp => 2, -file => 'test2.xpm' ) ;\n$q->save ;\n\nline()\n$i->line( $x0, $y0, $x1, $y1, $colour ) ;\n\nDraw a line from point ($x0,$y0) to point ($x1,$y1) in colour $colour.\n\nellipse()\n$i->ellipse( $x0, $y0, $x1, $y1, $colour ) ;\n\nDraw an oval enclosed by the rectangle whose top left is ($x0,$y0) and bottom right is ($x1,$y1)\nusing a line colour of $colour.\n\nrectangle()\n$i->rectangle( $x0, $y0, $x1, $y1, $colour, $fill ) ;\n\nDraw a rectangle whose top left is ($x0,$y0) and bottom right is ($x1,$y1) using a line colour\nof $colour. If $fill is true then the rectangle will be filled.\n\nnew()\nVirtual - must be overridden.\n\nRecommend that it at least supports \"-file\" (filename), \"-width\" and \"-height\".\n\nnewfromserialised()\nNot implemented. Recommended for inheritors. Should accept a string serialised using serialise()\nand return an object (reference).\n\nserialise()\nNot implemented. Recommended for inheritors. Should return a string representation (ideally\ncompressed).\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\" get/set colours of the image itself.\n\nset()\nVirtual - must be overridden.\n\nSet any of the object's attributes. Multiple attributes may be set in a single call; some\nattributes are read-only.\n\nSee \"xy\" get/set colours of the image itself.\n\nxy()\nVirtual - must be overridden. Expected to provide the following functionality:\n\n$i->xy( 4, 11, '#123454' ) ;    # Set the colour at point 4,11\nmy $v = $i->xy( 9, 17 ) ;       # Get the colour at point 9,17\n\nGet/set colours using x, y coordinates; coordinates start at 0.\n\nWhen called to set the colour the value returned is class specific; when called to get the\ncolour the value returned is the colour name, e.g. 'blue' or '#f0f0f0', etc, e.g.\n\n$colour = xy( $x, $y ) ;  # e.g. #123456\nxy( $x, $y, $colour ) ;   # Return value is class specific\n\nWe don't normally pick up the return value when setting the colour.\n\nload()\nVirtual - must be overridden. Expected to provide the following functionality:\n\n$i->load ;\n$i->load( 'test.xpm' ) ;\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()\nVirtual - must be overridden. Expected to provide the following functionality:\n\n$i->save ;\n$i->save( 'test.xpm' ) ;\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 xpm format.\n",
                "subsections": []
            },
            "CHANGES": {
                "content": "2000/05/05\n\nAdded some basic drawing methods. Minor documentation changes.\n\n2000/05/04\n\nCreated.\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "Mark Summerfield. I can be contacted as <summer@perlpress.com> - please include the word\n'imagebase' in 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": []
            }
        }
    }
}