Giter Site home page Giter Site logo

image-keyboard-config's Introduction

NAME
    Image::Keyboard::Config - Perl class for image keyboard configuration
    creating.

SYNOPSIS
     use Image::Keyboard::Config;
     my $obj = Image::Keyboard->new(%parameters);
     my $obj = $obj->align_horz($align);
     my $obj = $obj->align_vert($align);
     my $obj = $obj->draw;
     my $obj = $obj->font($color, $file, $size);
     my $conf_hr = $obj->get;
     my $obj = $obj->height($height);
     my $obj = $obj->image($image);
     my $obj = $obj->left($left);
     my $obj = $obj->move($x, $y);
     my $obj = $obj->padding($top, $right, $bottom, $left);
     my $obj = $obj->text($text);
     my $obj = $obj->top($top);
     my $obj = $obj->width($width);

METHODS
    "new(%parameters)"
            Constructor.

            *       "background_file"

                     Background file.
                     Default values is undef.

            *       "config"

                     Configuration structure.
                     Default value is {}.

            *       "f_color"

                     Font color.
                     Default value is 'black'.

            *       "f_file"

                     Font file.
                     Default value is undef.

            *       "f_size"

                     Font size.
                     Default value is 20.

            *       "b_cont_align_horz"

                     Button content horizontal align.
                     Default value is 'center'.

            *       "b_cont_align_vert"

                     Button content vertical align.
                     Default value is 'middle'.

            *       "b_cont_text"

                     Button content text.
                     Default value is 'Foo'.

            *       "b_padd_bottom"

                     Button bottom padding.
                     Default value is 0.

            *       "b_padd_left"

                     Button left padding.
                     Default value is 0.

            *       "b_padd_right"

                     Button right padding.
                     Default value is 0.

            *       "b_padd_top"

                     Button top padding.
                     Default value is 0.

            *       "b_box_height"

                     Button box height size.
                     Default value is 100.

            *       "b_box_width"

                     Button box width size.
                     Default value is 100.

            *       "b_image"

                     Buttom image.
                     Default value is undef.

            *       "b_pos_left"

                     Button left position.
                     Default value is 0.

            *       "b_pos_top"

                     Button top_position.
                     Default value is 0.

    "align_horz($align)"
             Horizontal align.
             Set $align to 'b_cont_align_horz' parameter.
             Returns object.

    "align_vert($align)"
             Vertical align.
             Set $align to 'b_cont_vert' parameter.
             Returns object.

    "draw()"
             Draw button.
             Returns object.

    "font($color, $file, $size)"
             Set font properties.
             Set $color to 'f_color' parameter.
             Set $file to 'f_file' parameter.
             Set $size to 'f_size' parameter.
             Returns object.

    "get()"
             Get configuration structure.
             Returns reference to hash with keyboard configuration.

    "height($height)"
             Height.
             Set $height to 'b_box_height' parameter.
             Returns object.

    "image($image)"
             Image.
             Set $image to 'b_image' parameter.
             Returns object.

    "left($left)"
             Left.
             Set $left to 'b_pos_left' parameter.
             Returns object.

    "move($x, $y)"
             Move to x, y coords.
             Add $x to 'b_pos_top' parameter.
             Add $y to 'b_pos_left' parameter.
             Returns object.

    "padding($top, $right, $bottom, $left)"
             Padding.
             Set $top to 'b_padd_top' parameter.
             Set $right to 'b_padd_right' parameter.
             Set $bottom to 'b_padd_bottom' parameter.
             Set $left to 'b_padd_left' parameter.
             Returns object.

    "text($text)"
             Text.
             Set $text to 'b_cont_text' parameter.
             Returns object.

    "top($top)"
             Top.
             Set $top to 'b_pos_top' parameter.
             Returns object.

    "width($width)"
             Width.
             Set $width to 'b_box_width' parameter.
             Returns object.

ERRORS
     new():
             From Class::Utils::set_params():
                     Unknown parameter '%s'.

EXAMPLE
     # Pragmas.
     use strict;
     use warnings;

     # Modules.
     use Data::Printer;
     use Image::Keyboard::Config;

     # Object.
     my $conf = Image::Keyboard::Config->new(
            'b_image' => 'data/ex1/keyboard_button_small.png',
            'background_file' => 'data/ex1/keyboard_background.png',
            'f_file' => 'data/ex1/DejaVuSans.ttf',
     );

     # Draw two buttons.
     $conf->draw->move(100, 100)->draw;

     # Get configuration.
     my $conf_hr = $conf->get;

     # Dump configuration.
     p $conf_hr;

     # Output:
     # \ {
     #     background   "data/ex1/keyboard_background.png",
     #     button       {
     #         1   {
     #             font    {
     #                 color   "black",
     #                 file    "data/ex1/DejaVuSans.ttf",
     #                 size    20
     #             },
     #             image   "data/ex1/keyboard_button_small.png",
     #             pos     {
     #                 left   0,
     #                 top    0
     #             },
     #             text    {
     #                 align     {
     #                     horz   "center",
     #                     vert   "middle"
     #                 },
     #                 padding   {
     #                     bottom   0,
     #                     left     0,
     #                     right    0,
     #                     top      0
     #                 },
     #                 string    "Foo"
     #             }
     #         },
     #         2   {
     #             font    {
     #                 color   "black",
     #                 file    "data/ex1/DejaVuSans.ttf",
     #                 size    20
     #             },
     #             image   "data/ex1/keyboard_button_small.png",
     #             pos     {
     #                 left   100,
     #                 top    100
     #             },
     #             text    {
     #                 align     {
     #                     horz   "center",
     #                     vert   "middle"
     #                 },
     #                 padding   {
     #                     bottom   0,
     #                     left     0,
     #                     right    0,
     #                     top      0
     #                 },
     #                 string    "Foo"
     #             }
     #         }
     #     }
     # }

DEPENDENCIES
    Class::Utils.

SEE ALSO
    Image::Keyboard.

REPOSITORY
    <https://github.com/tupinek/Image-Keyboard-Config>

AUTHOR
    Michal Špaček <mailto:[email protected]>

    <http://skim.cz>

LICENSE AND COPYRIGHT
     © 2013-2015 Michal Špaček
     BSD 2-Clause License

VERSION
    0.02

image-keyboard-config's People

Contributors

michal-josef-spacek avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.