develooper Front page | perl.perl6.language | Postings from October 2005

Standard library for perl6? (graphical primitives)

Thread Next
From:
Markus Laire
Date:
October 14, 2005 22:33
Subject:
Standard library for perl6? (graphical primitives)
Message ID:
435094A6.7030606@laire.info
(I'm mainly interested about graphical primitives, but there are likely 
other areas where standard library would be of use.)

If I want to write a crossplatform text-mode application, I could write 
it in perl, and know that it will be usable in wide variety of 
platforms, as long as I use only "standard" commands and not any 
platform-specific modules etc..

But if I want to write graphics-mode application, I really don't know 
what to do. Even if I were to write a simple one, which just draws lines 
  or puts pixels on screen, I do not know of any good solution.

Java has graphical primitives, but is encumbered by bad licenses.
C doesn't have graphical primitives in standard library, AFAIK.

Perl does have CPAN, but the problem is that there are no standard 
modules, and so there can be several modules doing the same thing. perl5 
has some standard commands, listed in "perlfunc", but that doesn't 
include any graphical primitives.

Could it be possible to create a "Standard library" for perl6, which 
would also include graphical primitives (putpixel, getpixel, 
getcolordepth, putimage, getimage, copyrectangle)?

Just a basic example:

   use 6;
   use Stdlib::GraphicalPrimitives;

   // check for availability of graphics mode
   if (!GraphModeAvailable())) {
     print "No graphics available, sorry\n";
     exit 1;
   }

   // initialize graph-mode, ask for a 100x100 pixel area
   // with 24bit colors to work on
   if (!InitGraphics(100, 100, 24)) {
     print "Couldn't get 100x100x24 graphics area\n";
     exit 2;
   }

   // do something
   DrawLine(0, 0, 99, 99);
   // ...


-- 
Markus Laire

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About