Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
0260c4c
NativeCall is now in "CORE"
FROGGS Mar 2, 2015
f26591e
add provides section for latest panda (S11 support)
zoffixznet Apr 2, 2015
269ef0c
Many updates for it to compile
hankache Jan 23, 2016
e7970e7
Remove @*INC from examples. Remove done from .t files and silence som…
hankache Jan 23, 2016
2de56a1
Readme typo fix
hankache Jan 23, 2016
0b0821c
Change 'Parcel' to 'List'
hankache Jan 23, 2016
46b75d3
Sanitize META.info
hankache Jan 23, 2016
4591f06
Create .travis.yml
hankache Jan 23, 2016
421c564
Update .travis.yml
hankache Jan 23, 2016
462aeb5
Update .travis.yml
hankache Jan 23, 2016
bb1685e
Update README.md
hankache Jan 23, 2016
3bc685e
add prove to travis
hankache Jan 23, 2016
5a7efef
Update .travis.yml
hankache Jan 23, 2016
f6a6d51
Update .travis.yml
hankache Jan 24, 2016
1dd45f5
remove range to test travis
hankache Jan 24, 2016
c000962
Update .travis.yml
hankache Jan 30, 2016
650b8ea
Add mandatory "perl" META field
zoffixznet Oct 26, 2016
3b100fa
Use modern META filename
zoffixznet Apr 25, 2017
6840fb1
Use SPDX identifier in license field of META.info
samcv Apr 26, 2017
bfa68a9
Merge branch 'add_meta_provides' of https://github.com/zoffixznet/per…
dwarring Aug 4, 2018
0e7ce20
Merge branch 'master' of https://github.com/hankache/perl6-Imlib2
dwarring Aug 4, 2018
8cd35f0
Merge branch 'patch-2' of https://github.com/zoffixznet/perl6-Imlib2
dwarring Aug 4, 2018
f32fa33
Merge branch 'patch-3' of https://github.com/zoffixznet/perl6-Imlib2
dwarring Aug 4, 2018
b57021b
Merge branch 'SPDX-license' of https://github.com/samcv/perl6-Imlib2
dwarring Aug 4, 2018
3e9767e
remove Panda from Build and README
dwarring Aug 4, 2018
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
16 changes: 16 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
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-panda
- panda installdeps .
4 changes: 1 addition & 3 deletions Build.pm
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.

13 changes: 13 additions & 0 deletions META6.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"perl" : "6.*",
"name" : "Imlib2",
"license" : "Artistic-2.0",
"version" : "0.0.1",
"description" : "Perl 6 interface to the Imlib2 image library.",
"provides" : { "Imlib2": "lib/Imlib2.pm" },
"authors" : ["Henrique Dias"],
"perl" : "6.c",
"depends" : [ "LibraryMake" ],
"source-type" : "git",
"source-url" : "git://github.com/hankache/perl6-Imlib2.git"
}
79 changes: 39 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,64 +1,63 @@
perl6-Imlib2
Perl 6 Imlib2 ![Imlib2 Logo](logotype/logo_32x32.png)
============

![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.
Perl 6 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.

panda update
panda install Imlib2
To install with Zef:

To run a sample script that uses the Imlib2 library.
zef update
zef install Imlib2

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.
WARNING: This module is Work in Progress, which means: this interface is not final. This will perhaps change in the future.

use Imlib2;
Below is a sample code:

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

# Sets the current image Imlib2 will be using with its function calls.
$rawimage.context_set();
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);
# 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");
$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();
# Frees the image that is set as the current image in Imlib2's context.
$im.free_image();

exit();
exit();
```

Author
------
Expand All @@ -73,7 +72,7 @@ See Also
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 Perl 6 itself.

[1]: lib/Imlib2.pod "Imlib2 Perl6 Module Documentation"
[2]: http://docs.enlightenment.org/api/imlib2/html/ "Imlib2 Library Documentation"
Expand Down
4 changes: 1 addition & 3 deletions examples/adjust.p6
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/usr/bin/env perl6

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

use Imlib2;

say "Select a parameter to adjust";
Expand Down Expand Up @@ -79,7 +77,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();
2 changes: 0 additions & 2 deletions examples/blend_image_onto_image.p6
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/usr/bin/env perl6

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

use Imlib2;

say "Operations:
Expand Down
4 changes: 0 additions & 4 deletions examples/blur.p6
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
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
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
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
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
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
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
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
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
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
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
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
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
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();
10 changes: 3 additions & 7 deletions examples/koch_curve.p6
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#!/usr/bin/env perl6

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

my $x0 = 0;
my $y0 = 0;
Expand All @@ -10,7 +8,6 @@ my $recursions = 6;
my $width = 600;
my $height = ($width/3).Int;

use Imlib2;

my $im = Imlib2.new();
my $newimage = $im.create_image($width, $height);
Expand All @@ -23,7 +20,7 @@ $im.image_draw_rectangle(
location => (0, 0),
size => ($width, $height),
fill => True);

my $polygon = $im.polygon_new();
exit() unless $polygon;

Expand Down Expand Up @@ -56,7 +53,7 @@ sub begin($x, $y) {
sub from360($angle360) {
return pi * $angle360/180;
}

sub right($angle360) {
$direction360 -= $angle360;
}
Expand Down Expand Up @@ -84,4 +81,3 @@ sub kock_curve($length, $depth) {
kock_curve($length/3, $depth - 1);
}
}

Loading