NAME
Graphics::Raylib::Texture - Drawable Texture from Image
VERSION
version 0.025
SYNOPSIS
use Graphics::Raylib '+family';
use PDL;
use PDL::Matrix;
my $pdl = mpdl[
                 [0, 1, 1, 1, 0],
                 [1, 0, 0, 0, 0],
                 [0, 1, 1, 1 ,0],
                 [0, 0, 0, 0 ,1],
                 [0, 1, 1, 1 ,0],
               ];
my $g = Graphics::Raylib->window(240, 240);
$g->fps(60);
my $img = Graphics::Raylib::Texture->new(matrix => unpdl($pdl), color => YELLOW, transposed => 1);
while (!$g->exiting) {
    $img->matrix = unpdl($pdl);
    $img->rotation -= 1;
    Graphics::Raylib::draw {
        $g->clear(BLACK);
        $img->draw;
    };
    # now do some operations on $pdl, to get next iteration
}
DESCRIPTION
For drawing images
METHODS AND ARGUMENTS
- new( file => $filename, [width => $imgwidth, height => imgheight] ] ) =item new( pixels => $str, [width => $imgwidth, height => imgheight] ] ) =item new( bytes => $rawbytes, [width => $imgwidth, height => imgheight] ] ) =item new( imager => $imager, [width => $imgwidth, height => imgheight] ] )
 - 
Prepares the image the for drawing. The image may be specified as
filename, by itsbytes, an instance of Imager or Graph::Easy or as a series ofpixels.pixels' value may be either an array ref of array refs or a string. In all cases except forpixels => string, thesizecan be omitted and it will be inferred from the image.Specifying
fullscreen => 1overridesheightandwidth. - new( matrix => $AoA, color => $color, [ width => $image_width, height => $image_height, transposed => 0, $rotate => 0 ])
 - 
Creates a texture out of a matrix for printing.
$AoAis an array of arrays ref.$image_widthand$image_heightare the size of the area on which the Matrix should be drawn. It's optional defaults to the screen size.If
$coloris aGraphics::Raylib::Color, it will be used to color all positive $AoA elements. The space occupied by negative and zero elements stays at background color.if
$coloris a code reference, It will be evaluated for each matrix element, with the element's value as argument. The return type of the code reference will be used for the color. Returnundef, for omitting the element (drawing it transparently).$color == undefis an unsafe but faster shorthand for$color = sub { shift }.transposed =>determines whether the image should be drawn transposed ( x,y flipped ). It's more effecient than transposing in a separate step.rotate =>sets an angle (in degrees) for rotation. Rotation origin is the center of the image.See the game of life example at Graphics::Raylib (or
t/30-game-of-life.t) for a more complete example. - draw()
 - 
Call this while in a
Graphics::Raylib::drawblock in order to draw the image to screen.By default, the texture will be drawn centered.
 - flip( vertical => 1, horizontal => 0)
 - 
Flip the image in the specified orientation
 - image
 - 
lvalue subroutine returning the image's underlying
Graphics::Raylib::XS::Image - retexture
 - 
Reload texture from image
 
GIT REPOSITORY
http://github.com/athreef/Graphics-Raylib
SEE ALSO
Graphics::Raylib Graphics::Raylib::Shape
AUTHOR
Ahmad Fatoum <athreef@cpan.org>, http://a3f.at
COPYRIGHT AND LICENSE
Copyright (C) 2018 Ahmad Fatoum
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.