Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Post GLR changes #6

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.precomp/
blib/
Makefile
*.o
17 changes: 17 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
sudo: required

language: perl6

perl6:
- latest

before_install:
- perl6 -v
install:
- echo $TRAVIS_OS_NAME
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get -qq update ; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get install -y libimlib2-dev ; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get install screen ; fi
- rakudobrew build zef
- zef --depsonly install .
- zef --debug install .
4 changes: 1 addition & 3 deletions Build.pm → Build.rakumod
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
use Panda::Common;
use Panda::Builder;
use LibraryMake;

class Build is Panda::Builder {
class Build {
method build($workdir) {
shell("mkdir -p $workdir/blib/lib");
make("$workdir/src", "$workdir/blib/lib");
Expand Down
9 changes: 0 additions & 9 deletions META.info

This file was deleted.

12 changes: 12 additions & 0 deletions META6.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name" : "Imlib2",
"version" : "0.0.3",
"description" : "Raku interface to the Imlib2 image library.",
"license" : "Artistic-2.0",
"provides" : { "Imlib2": "lib/Imlib2.rakumod" },
"authors" : ["Naoum Hankache","Henrique Dias"],
"perl" : "6.d",
"depends" : [ "LibraryMake" ],
"source-type" : "git",
"source-url" : "git://github.com/hankache/perl6-Imlib2.git"
}
97 changes: 48 additions & 49 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,80 +1,79 @@
perl6-Imlib2
Raku Imlib2 ![Imlib2 Logo](logotype/logo_32x32.png)
============
Raku interface to the Imlib2 image library.

![Imlib2 Logo](logotype/logo_32x32.png)
Perl 6 interface to the Imlib2 image library.
| Operating System | Build Status |
| ----------------- | --------------- |
| Linux | [![Build Status](https://travis-ci.org/hankache/perl6-Imlib2.svg?branch=master)](https://travis-ci.org/hankache/perl6-Imlib2) |

Description
-----------
Perl6 binding for [Imlib2][2], a featureful and efficient image manipulation library, which produces high quality, anti-aliased output.
Raku binding for [Imlib2][2], a featureful and efficient image manipulation library, which produces high quality, anti-aliased output.

Installation
------------
Note that a recent version of [Imlib2][3] library must be installed before installing this module.

To install with the Panda tool.
To install with zef:

panda update
panda install Imlib2
zef update
zef install Imlib2

To run a sample script that uses the Imlib2 library.

git clone git://github.com/mrhdias/perl6-Imlib2.git
cd perl6-Imlib2/examples
PERL6LIB=$HOME/.perl6/2013.02.1/lib LD_LIBRARY_PATH=$HOME/.perl6/2013.02.1/lib ./imlib2.p6

Synopsis
--------
WARNING: This module is Work in Progress, which means: this interface is not final. This will perhaps change in the future.
A sample of the code can be seen below.

use Imlib2;

my $im = Imlib2.new();
# Create a new raw image.
my $rawimage = $im.create_image(200, 200);
exit() unless $rawimage;

# Sets the current image Imlib2 will be using with its function calls.
$rawimage.context_set();

# Sets the color with which text, lines and rectangles are drawn when
# being rendered onto an image.
$im.context_set_color(
red => 255,
green => 127,
blue => 0,
alpha => 255);

$im.image_draw_rectangle(
location => (0, 0),
size => (200, 200),
fill => True);

$im.image_set_format("png");
unlink("images/test_imlib2.png") if "images/test_imlib2.png".IO ~~ :e;
$im.save_image("images/test_imlib2.png");

# Frees the image that is set as the current image in Imlib2's context.
$im.free_image();

exit();
WARNING: This module is Work in Progress, which means: this interface is not final. This will perhaps change in the future.

Below is a sample code:

```Raku
use Imlib2;

my $im = Imlib2.new();
# Create a new raw image.
my $rawimage = $im.create_image(200, 200);
exit() unless $rawimage;

# Sets the current image Imlib2 will be using with its function calls.
$rawimage.context_set();

# Sets the color with which text, lines and rectangles are drawn when
# being rendered onto an image.
$im.context_set_color(
red => 255,
green => 127,
blue => 0,
alpha => 255);

$im.image_draw_rectangle(
location => (0, 0),
size => (200, 200),
fill => True);
$im.image_set_format("png");
unlink("images/test_imlib2.png") if "images/test_imlib2.png".IO ~~ :e;
$im.save_image("images/test_imlib2.png");

# Frees the image that is set as the current image in Imlib2's context.
$im.free_image();

exit();
```

Author
------
Henrique Dias <[email protected]>

See Also
--------
* [Imlib2 Perl6 Module Documentation][1]
* [Imlib2 Raku Module Documentation][1]
* [Imlib2 Library Documentation][2]
* [Imlib2 Source Repository][3]

License
-------

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
This library is free software; you can redistribute it and/or modify it under the same terms as Raku itself.

[1]: lib/Imlib2.pod "Imlib2 Perl6 Module Documentation"
[1]: lib/Imlib2.pod "Imlib2 Raku Module Documentation"
[2]: http://docs.enlightenment.org/api/imlib2/html/ "Imlib2 Library Documentation"
[3]: http://sourceforge.net/projects/enlightenment/files/imlib2-src/
6 changes: 1 addition & 5 deletions examples/adjust.p6 → examples/adjust.raku
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#!/usr/bin/env perl6

BEGIN { @*INC.push('../lib') };

use Imlib2;

say "Select a parameter to adjust";
Expand Down Expand Up @@ -79,7 +75,7 @@ $im.image_set_format("png");
unlink("images/test_adjust.png") if "images/test_adjust.png".IO ~~ :e;
$im.save_image("images/test_adjust.png");

# Frees the image that is set as the current image in Imlib2's context.
# Frees the image that is set as the current image in Imlib2's context.
$im.free_image();

exit();
4 changes: 0 additions & 4 deletions examples/blend_image_onto_image.p6 → examples/blend_image_onto_image.raku
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#!/usr/bin/env perl6

BEGIN { @*INC.push('../lib') };

use Imlib2;

say "Operations:
Expand Down
4 changes: 0 additions & 4 deletions examples/blur.p6 → examples/blur.raku
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#!/usr/bin/env perl6

BEGIN { @*INC.push('../lib') };

use Imlib2;

my $radius = prompt("How much value to blur the image? (0..128): ");
Expand Down
4 changes: 0 additions & 4 deletions examples/border.p6 → examples/border.raku
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#!/usr/bin/env perl6

BEGIN { @*INC.push('../lib') };

use Imlib2;

my $im = Imlib2.new();
Expand Down
4 changes: 0 additions & 4 deletions examples/circumference.p6 → examples/circumference.raku
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#!/usr/bin/env perl6

BEGIN { @*INC.push('../lib') };

use Imlib2;

my $im = Imlib2.new();
Expand Down
4 changes: 0 additions & 4 deletions examples/clone_image.p6 → examples/clone_image.raku
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#!/usr/bin/env perl6

BEGIN { @*INC.push('../lib') };

use Imlib2;

my $im = Imlib2.new();
Expand Down
4 changes: 0 additions & 4 deletions examples/color_modifier.p6 → examples/color_modifier.raku
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#!/usr/bin/env perl6

BEGIN { @*INC.push('../lib') };

use Imlib2;

my $im = Imlib2.new();
Expand Down
6 changes: 1 addition & 5 deletions examples/color_range.p6 → examples/color_range.raku
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#!/usr/bin/env perl6

BEGIN { @*INC.push('../lib') };

use Imlib2;

my $im = Imlib2.new();
Expand All @@ -18,7 +14,7 @@ my $color_range = $im.create_color_range();
# Sets the current color range to use for rendering gradients.
$color_range.context_set();

# Returns the current color range being used for gradients.
# Returns the current color range being used for gradients.
say "Yes I'm a color range." if $im.context_get_color_range();

$im.context_set_color(
Expand Down
11 changes: 2 additions & 9 deletions examples/create_transparent_image.p6 → examples/create_transparent_image.raku
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
#!/usr/bin/env perl6
#
# Note: the perl6 implementation is very slow...
#

BEGIN { @*INC.push('../lib') };

use Imlib2;

say "Create transparent image function implementations:";
Expand Down Expand Up @@ -48,13 +41,13 @@ sub create_transparent_image($source_image, $new_alpha) {
$source_image.context_set();
my $width = $im.image_get_width();
my $height = $im.image_get_height();

my $dest_image = $im.create_image($width, $height);
exit() unless $dest_image;
$dest_image.context_set();
$im.image_clear();
$im.image_set_has_alpha(True);

my ($red, $green, $blue, $alpha) = (0, 0, 0, 0);
loop (my $y = 0; $y < $height; $y++) {
loop (my $x = 0; $x < $width; $x++) {
Expand Down
4 changes: 0 additions & 4 deletions examples/draw_lines.p6 → examples/draw_lines.raku
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#!/usr/bin/env perl6

BEGIN { @*INC.push('../lib') };

use Imlib2;

my $im = Imlib2.new();
Expand Down
4 changes: 0 additions & 4 deletions examples/draw_pixel.p6 → examples/draw_pixel.raku
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#!/usr/bin/env perl6

BEGIN { @*INC.push('../lib') };

use Imlib2;

my $im = Imlib2.new();
Expand Down
4 changes: 0 additions & 4 deletions examples/ellipse.p6 → examples/ellipse.raku
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#!/usr/bin/env perl6

BEGIN { @*INC.push('../lib') };

use Imlib2;

my $im = Imlib2.new();
Expand Down
6 changes: 1 addition & 5 deletions examples/export_image.p6 → examples/export_image.raku
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#!/usr/bin/env perl6

BEGIN { @*INC.push('../lib') };

use Imlib2;

if @*ARGS.elems != 2 {
Expand Down Expand Up @@ -39,7 +35,7 @@ if @*ARGS[0].IO ~~ :e {

$im.save_image(@*ARGS[0]);

# Frees the image that is set as the current image in Imlib2's context.
# Frees the image that is set as the current image in Imlib2's context.
$im.free_image();

exit();
6 changes: 1 addition & 5 deletions examples/font.p6 → examples/font.raku
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#!/usr/bin/env perl6

BEGIN { @*INC.push('../lib') };

use Imlib2;

my $im = Imlib2.new();
Expand Down Expand Up @@ -76,7 +72,7 @@ $im.image_set_format("png");
unlink("images/test_font.png") if "images/test_font.png".IO ~~ :e;
$im.save_image("images/test_font.png");

# Frees the image that is set as the current image in Imlib2's context.
# Frees the image that is set as the current image in Imlib2's context.
$im.free_image();

exit();
4 changes: 0 additions & 4 deletions examples/image_modification.p6 → examples/image_modification.raku
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#!/usr/bin/env perl6

BEGIN { @*INC.push('../lib') };

use Imlib2;

my $im = Imlib2.new();
Expand Down
6 changes: 1 addition & 5 deletions examples/imlib2.p6 → examples/imlib2.raku
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#!/usr/bin/env perl6

BEGIN { @*INC.push('../lib') };

use Imlib2;

my $im = Imlib2.new();
Expand Down Expand Up @@ -72,7 +68,7 @@ $im.image_set_format("png");
unlink("images/test_imlib2.png") if "images/test_imlib2.png".IO ~~ :e;
$im.save_image("images/test_imlib2.png");

# Frees the image that is set as the current image in Imlib2's context.
# Frees the image that is set as the current image in Imlib2's context.
$im.free_image();

exit();
Loading