### ----------------------------------------------------
### -- Imlib2
### -- Licenses: Artistic-2.0
### -- Authors: Naoum Hankache, Henrique Dias
### -- File: lib/Imlib2.pod
### ----------------------------------------------------
### -- Chunk 3 of 3
_format("png");
	... some operations ...
	my Str $filename = "test.png";
	$im.save_image($filename);
	$im.free_image();

	# save image with returned error.
	use Imlib2;
	my $im = Imlib2.new();
	my $image = $im.create_image(100, 200);
	$image.context_set();
	$im.image_set_format("png");
	... some operations ...
	my Str $filename = "test.png";
	my LoadError $error_return;
	$im.save_image($filename, $error_return);
	say "No error..." if $error_return == IMLIB_LOAD_ERROR_NONE;
	$im.free_image();

Parameters:

	Str $filename - Image file.
	LoadError $error_return - The returned error.

Saves the current image in the format specified by the current image's
format settings to the filename $filename.
If the $error_return is passed as argument the $error_return will be
set to an error value if the save fails.

=head2 Rotation/Skewing

Functions to rotate/swew images.

=head3 create_rotated_image

Usage:

	use Imlib2;
	my $im = Imlib2.new();
	my $loaded_image = $im.load_image("pictures/holidays.jpeg");
	$loaded_image.context_set();
	my Rat $angle = -45.0;
	my Imlib2::Image $rotated_image = $im.create_rotated_image($angle);
	$rotated_image.context_set();
	... some operations ...
	$im.free_image(); # frees the rotated image
	$loaded_image.context_set();
	$im.free_image(); # frees the loaded image

Parameters:

	Rat $angle - An angle in degrees (-360 to 360).

Returns:

	Imlib2::Image $rotated_image - A valid image, otherwise NULL.

Creates an new copy of the current image, but rotated by angle degrees.
On success it returns a valid image handle, otherwise NULL.

=head2 Imlib2::Border

Structure to store and handle the values of the border.

=head3 new

Usage:

	use Imlib2;
	my $structure = Imlib2::Border.new(
		left   => 10,
		right  => 10,
		top    => 10,
		bottom => 10);
	... some operations ...

Parameters:

	left - Left side of the border in pixels.
	right - Right side of the border in pixels.
	top - Top side of the border in pixels.
	bottom - Bottom side of the border in pixels.

Returns:

	Imlib2::Border $structure - Structure to store the values ​​of the border.

Returns a new structure to store the values of the border of the
current context image. The parameters are optional. By default the value
of each side of the border is equal to zero.

=head3 init

Usage:

	use Imlib2;
	my $structure = Imlib2::Border.new(
		left   => 10,
		right  => 10,
		top    => 10,
		bottom => 10);
	my $border = $structure.init();
	... some operations ...

Returns:

	OpaquePointer $border - Returns a C pointer.

Store the values of the border in C structure and returns a pointer
to this.

=head3 put

Usage:

	use Imlib2;
	my $structure = Imlib2::Border.new();
	my $border = $structure.init();
	$structure.left = 10;
	$structure.right = 10;
	$structure.top = 10;
	$structure.bottom = 10;
	$structure.put($border);
	... some operations ...

Parameters:

	OpaquePointer $border - C pointer.

Only store the values of the border in C structure.

=head3 get

Usage:

	use Imlib2;
	my $structure = Imlib2::Border.new(
		left   => 10,
		right  => 10,
		top    => 10,
		bottom => 10);
	my $border = $structure.init();
	$structure.get($border);
	say "Left: " ~ $structure.left;
	say "Right: " ~ $structure.right;
	say "Top: " ~ $structure.top;
	say "Bottom: " ~ $structure.bottom;
	... some operations ...

Parameters:

	OpaquePointer $border - C pointer.

Get the stored values of the border from the C structure and update the
attributes left, right, top and bottom.

=head1 AUTHOR

Henrique Dias - L<mrhdias@mail.com>

=head1 SEE ALSO

=over 4

=item *

Imlib2 Library Documentation L<http://docs.enlightenment.org/api/imlib2/html/>

=item *

Imlib2 Source Repository L<http://sourceforge.net/projects/enlightenment/files/imlib2-src/>

=back

=head1 LICENSE

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



