Download Shareware and Freeware Software for Windows, Linux, Macintosh, PDA

line Home  |  About Us  |  Link To Us  |  FAQ  |  Contact

Serving Software Downloads in 976 Categories, Downloaded 29.548.281 Times

Image::Xpm 1.09

  Date Added: July 08, 2010  |  Visits: 552

Image::Xpm

Report Broken Link
Printer Friendly Version


Product Homepage
Download (76 downloads)



Image::Xpm is a Perl module that can load, create, manipulate and save xpm image files. SYNOPSIS use Image::Xpm; my $j = Image::Xpm->new(-file, Camel.xpm); my $i = Image::Xpm->new(-width => 10, -height => 16); my $h = $i->new; # Copy of $i $i->xy(5, 8, red); # Set a colour (& add to palette if necessary) print $i->xy(9, 3); # Get a colour $i->xy(120, 130, #1256DD); $i->xy(120, 130, $i->rgb2colour(66, 0x4D, 31)); $i->vec(24, #808080); # Set a colour using a vector offset print $i->vec(24); # Get a colour using a vector offset print $i->get(-width); # Get and set object attributes $i->set(-height, 15); $i->load(test.xpm); $i->save; # Changing just the palette $i->add_colours(qw(red green blue #123456 #C0C0C0)); $i->del_colour(blue); This class module provides basic load, manipulate and save functionality for the xpm file format. It inherits from Image::Base which provides additional manipulation functionality, e.g. new_from_image(). See the Image::Base pod for information on adding your own functionality to all the Image::Base derived classes. new() my $i = Image::Xpm->new(-file => test.xpm); my $j = Image::Xpm->new(-width => 12, -height => 18); my $k = $i->new; We can create a new xpm image by reading in a file, or by creating an image from scratch (all the pixels are white by default), or by copying an image object that we created earlier. If we set -file then all the other arguments are ignored (since theyre taken from the file). If we dont specify a file, -width and -height are mandatory and -cpp will default to 1 unless specified otherwise. -file The name of the file to read when creating the image. May contain a full path. This is also the default name used for loading and saveing, though it can be overridden when you load or save. -width The width of the image; taken from the file or set when the object is created; read-only. -height The height of the image; taken from the file or set when the object is created; read-only. -cpp Characters per pixel. Commonly 1 or 2, default is 1 for images created by the module; read-only. See the example for how to change an images cpp. -hotx The x-coord of the images hotspot; taken from the file or set when the object is created. Set to -1 if there is no hotspot. -hoty The y-coord of the images hotspot; taken from the file or set when the object is created. Set to -1 if there is no hotspot. -ncolours The number of unique colours in the palette. The image may not be using all of them; read-only. -cindex An hash whose keys are colour names, e.g. #123456 or blue and whose values are the palette names, e.g. , #, etc; read-only. If you want to add more colours to the image itself simply write pixels with the new colours using xy; if you want to add more colours to the palette without necessarily using them in the image use add_colours. -palette A hash whose keys are the palette names, e.g. , #, etc. and whose values are hashes of colour type x colour name pairs, e.g. c => red, etc; read-only. If you want to add more colours to the image itself simply write pixels with the new colours using xy; if you want to add more colours to the palette without necessarily using them in the image use add_colours. -pixels A string of palette names which constitutes the data for the image itself; read-only. -extname The name of the extension text if any; commonly XPMEXT; read-only. -extlines The lines of text of any extensions; read-only. -comments An array (possibly empty) of comment lines that were in a file that was read in; they will be written out although we make no guarantee regarding their placement; read-only. get() my $width = $i->get(-width); my ($hotx, $hoty) = $i->get(-hotx, -hoty); Get any of the objects attributes. Multiple attributes may be requested in a single call. See xy and vec to get/set colours of the image itself. set() $i->set(-hotx => 120, -hoty => 32); Set any of the objects attributes. Multiple attributes may be set in a single call; some attributes are read-only. See xy and vec to get/set colours of the image itself. xy() $i->xy(4, 11, #123454); # Set the colour at point 4,11 my $v = $i->xy(9, 17); # Get the colour at point 9,17 Get/set colours using x, y coordinates; coordinates start at 0. If the colour does not exist in the palette it will be added automatically. When called to set the colour the value returned is characters used for that colour in the palette; when called to get the colour the value returned is the colour name, e.g. blue or #f0f0f0, etc, e.g. $colour = xy($x, $y); # e.g. #123456 $cc = xy($x, $y, $colour); # e.g. ! We dont normally pick up the return value when setting the colour. vec() $i->vec(43, 0); # Unset the bit at offset 43 my $v = $i->vec(87); # Get the bit at offset 87 Get/set bits using vector offsets; offsets start at 0. The offset of a pixel is ((y * width * cpp) + (x * cpp)). The sort of return value depends on whether we are reading (getting) or writing (setting) the colour - see xy for an explanation. rgb2colour() and rgb2color() $i->rgb2colour(0xff, 0x40, 0x80); # Returns #ff4080 Image::Xpm->rgb2colour(10, 20, 30); # Returns #0a141e Convenience class or object methods which accept three integers and return a colour name string. load() $i->load; $i->load(test.xpm); Load the image whose name is given, or if none is given load the image whose name is in the -file attribute. save() $i->save; $i->save(test.xpm); Save the image using the name given, or if none is given save the image using the name in the -file attribute. The image is saved in xpm format. add_colours() and add_colors() $i->add_colours(qw(#C0C0DD red blue #123456)); These are for adding colours to the palette; you dont need to use them to set a pixels colour - use xy for that. Add one or more colour names either as hex strings or as literal colour names. These are always added as type c colours; duplicates are ignored. NB If you just want to set some pixels in colours that may not be in the palette, simply do so using xy since new colours are added automatically. del_colour() and del_color() $i->del_colour(green); Delete a colour from the palette; returns undef if the colour isnt in the palette, false (0) if the colour is in the palette but also in the image, or true (1) if the colour has been deleted (i.e. it was in the palette but not in use in the image)..

Requirements: No special requirements
Platforms: Linux
Keyword: Colour Colours File Or I- Image Imagexpm In The Image Libraries Palette Perl Module Programming Want To Xy You Want To
Users rating: 0/10

License: Freeware Size: 102.4 KB
USER REVIEWS
More Reviews or Write Review


IMAGE::XPM RELATED
Backup Utilities  -  SSuite Back Master 2.6
SSuite Office - Backup Master is a backup software solution designed to backup your data either on the local computer or onto another system in the network. It's a multi-threaded program that can be used to backup your files and folders. The...
635.74 KB  
Backup Utilities  -  SSuite Backup Master 2.6.2.1
SSuite Office - Backup Master is a backup software solution designed to backup your data either on the local computer or onto another system in the network. It's a multi-threaded program that can be used to backup your files and folders. The...
635.74 KB  
Entertainment  -  Sun Rise And Shine 1.3.257.2
Do you like waking up in the morning and be greeted with a positive vibe? Do you like to get through the day with lots of positivity along the way? Than this little app is for you. In January 2010 I started a new job. I moved from the...
1024 KB  
Games  -  PuzzleOfJewel 1.12
Welcome to this tempting and addictive jewel world, join your friends in the puzzle adventure. Classic switch and match play method make you easy to play, Varied bombs, boosters and charms leave you hungry for more. It is the most meaty...
14 MB  
Games  -  Shatranj 1.0.0.0
Grandfather of modern chess, Shatranj was played in the old indian empires over a thousand years ago! Now you get to play it here against real opponents. The rules for Shatranj are very similar to modern chess but be careful as not...
1024 KB  
Productivity  -  SMS the Contact 1.0.0.0
SMS the Contact lets you send the contact information in the form of SMS. Its so simple like ABC. All you need to do is to just pick the contact that you want to share. No matter, how many numbers it contains, all the numbers, email addresses...
1024 KB  
Games  -  Wild West Guns 1.0.0.0
Fight your way through a ruthless army of bandits in the greatest western first person shooter on mobile devices! Are you ready to defeat the outlaws, collect the rewards and loot chests full of precious gold? Give it a try and find out what...
12 MB  
Libraries  -  GO::View 0.72
GO::View is a Perl module that creates a gif or png image for visualizing the GO DAG. This perl module generates a graphic that displays the parent and child relationships of a selected GO term. It also provides the visualization for the...
870.4 KB  
Networking  -  Classic Image Button 1.0.0
Looking for the classic image button in the visual editor of Wordpress? Look no further and install this plugin!Classic Image Button adds the classic image button option to the WYSIWYG editor in Wordpress. The plugin adds a button to the top row...
10 KB  
Libraries  -  DBIx::DWIW 0.44
DBIx::DWIW is a Perl module for robust and simple DBI wrapper to Do What I Want (DWIW). SYNOPSIS When used directly: use DBIx::DWIW; my $db = DBIx::DWIW->Connect(DB => $database, User => $user, Pass => $password, Host => $host); my...
22.53 KB  
NEW DOWNLOADS IN PROGRAMMING, LIBRARIES
Programming  -  FLEX-db Digital Asset Manager 3.0.9
FLEX-db - an enterprise Digital Asset Manager (DAM). It ingests and links metadata with files, creates thumbnails, and processes files using business rules. FLEX-db has a JSP client, Java app server for file input and output and an EJB metadata...
21.57 MB  
Programming  -  Libicom 0.9.0
The libicom library is a character based dynamicly linked library for Linux. It is used to remotely control the Icom IC-R8500 wide band receiver via an RS232 link. All call and return parameters to the control functions are character string based....
20.48 KB  
Programming  -  dotdesktop 0.3
Dotdesktop library provides ability to parse desktop entry file and access the information in a convenient way. Desktop entry file format is defined by freedesktop.org, it is used to describe information about an application such as the name and...
327.68 KB  
Programming  -  Cedalion for Linux 0.2.6
Cedalion is a programming language that allows its users to add new abstractions and define (and use) internal DSLs. Its innovation is in the fact that it uses projectional editing to allow the new abstractions to have no syntactic limitations.
471.04 KB  
Programming  -  libyasl 0.2
Libyasl is a C++ class library to easily realize TCP/UDP/Multicast clientsand servers in IPv4 and IPv6 environments under GNU/Linux systems.
143.36 KB  
Libraries  -  EuGTK 4.8.9
Makes it easy to develop good- looking, fast, cross-platform programs that run on Linux, OS X, and Windows. Euphoria is a very fast interpreted/compiled language with straight-forward syntax. EuGTK allows programming in a clean, object-oriented...
10.68 MB  
Libraries  -  Linux User Group Library Manager 1.0
The LUG Library Manager is a project to help Linux User Groups start their own library. A LUG library is helpful to the community at large because it increases access to information, and gives everyone the opportunity to become more knowledgeable.
5.35 KB  
Libraries  -  Module::MakefilePL::Parse 0.12
Module::MakefilePL::Parse is a Perl module to parse required modules from Makefile.PL. SYNOPSIS use Module::MakefilePL::Parse; open $fh, Makefile.PL; $parser = Module::MakefilePL::Parse->new( join("", ) ); $info = $parser->required;...
8.19 KB  
Libraries  -  sqlpp 0.06
sqlpp Perl package is a SQL preprocessor. sqlpp is a conventional cpp-alike preprocessor taught to understand SQL ( PgSQL, in particular) syntax specificities. In addition to the standard #define/#ifdef/#else/#endif cohort, provides also...
10.24 KB  
Libraries  -  App::SimpleScan::Substitution::Line 2.02
App::SimpleScan::Substitution::Line is a line with optional fixed variable values. SYNOPSIS my $line = App::SimpleScan::Substitution::Line->new(" this "); # Use only this value when substituting " ". $line->fix(substituite =>...
54.27 KB