// barsunduk 11/2011
// Lib_spr
//     
// (   )

const
    //    
    //    ,    
    //          
    trans_none = 0;
    trans_mirror = 2;
    trans_rot90 = 5;
    trans_rot180 = 3;
    trans_rot270 = 6;
    trans_mirror_rot90 = 7;
    trans_mirror_rot180 = 1;
    trans_mirror_rot270 = 4;

    //   ( get  set)
    p_align = 0; //   (0-/1- /2-  / ..  )
    p_x = 1; //   
    p_y = 2; //   
    p_w = 3; //  
    p_h = 4; //  
    p_layer = 5; //    ()
    p_step = 6; //    
    p_frame = 7; //    
    p_row = 8; //    
    p_trans = 9; //  (/)
    p_img = 10; //  
    p_enable = 11; // 
    p_visible = 12; // 
    p_fplus = 13; //   
    p_rplus = 14; //   
    p_frameback = 15; //       

interface
    // minalpha: integer = 0; //     
    //  minalpha = 0       
    //  minalpha = 255       
    // , , minalpha = 128,     ,
    //     128   ,   
    // ,      ,  alpha < 128  

    //       [0..255]
    public static int getminalpha() {

    //       [0..255]
    public static void setminalpha(int minalpha) {


    //      1 
    function empty: Image;
    
    //     
    function ptinrect(int x, int y, int rx, int ry, int rw, int rh);

    //   
    function xrect(int rx1, int ry1, int rw1, int rh1,
            int rx2, int ry2, int rw2, int rh2);

    //     
    function sprxrect(spr, x, y, w, h: integer): integer;

    //    
    function get(int sprindex, int parindex);

    //    
    procedure set(int sprindex, int parindex, int value);

    //    
    //    0,   ,   ,
    //       
    procedure initspr(int spr_count);

    //      
    procedure seti(Image img, int imgindex);

    // / 
    // (    )
    function getalign(sprindex: integer): integer;
    
    // 0 -   , 1 -  , 2 -   ,
    // 3 -  , 4 -     ..
    procedure setalign(sprindex, value: integer);

    //    
    // (  align)
    function getx(int sprindex);

    procedure setx(int sprindex, int value);

    function gety(int sprindex): integer;

    procedure sety(int sprindex, int value);

    function getw(int sprindex): integer;

    procedure setw(int sprindex, int value);

    function geth(int sprindex): integer;

    procedure seth(int sprindex, int value);

    function getlayer(int sprindex): integer;

    procedure setlayer(int sprindex, int value);

    function getstep(int sprindex): integer;

    procedure setstep(int sprindex, int value);

    function getframe(int sprindex): integer;

    function getframes(int sprindex): integer;

    procedure setframe(int sprindex, int value);

    function getrows(int sprindex): integer;

    function getrow(int sprindex): integer;

    procedure setrow(int sprindex, int value);

    function gettrans(int sprindex): integer;

    procedure settrans(int sprindex, int value);

    function getimageindex(int sprindex): integer;

    procedure setimageindex(int sprindex, int value);

    function getimage(int sprindex): Image: integer;

    procedure setimage(int sprindex, Image img);

    function getenable(int sprindex): integer;

    procedure setenable(int sprindex, int value);

    procedure setvisible(int sprindex, int value);

    function getvisible(int sprindex): integer;

    function getframeback(int sprindex): integer;

    procedure setframeback(int sprindex, int value);
    
    //     
    procedure move(int sprindex, int x, int y);
    
    //    
    procedure moveto(int sprindex, int x, int y);
    
    //   (   step)
    procedure moveleft(int sprindex);
    
    //   (   step)
    procedure moveright(int sprindex);
    
    //   (   step)
    procedure moveup(int sprindex);
    
    //   (   step)
    procedure movedown(int sprindex);
    
    //     
    function addi(Image img): integer;

    //  
    procedure prevframe(int sprindex);
    
    //  
    procedure nextframe(int sprindex);

    //  
    procedure prevrow(int sprindex);
    
    //  
    procedure nextrow(int sprindex);

    //    (   )
    function getframeimage(int sprindex): Image;
    
    //     
    //      
    function adds(int imgindex): integer;

    //     
    //          
    function addswh(int imgindex, int w, int h): integer;

    //     
    //   
    function addis(Image img): integer;

    //     
    //       
    function addiswh(Image img, int w, int h): integer;

    //       
    function addcopy(int sprindex): integer;

    //    
    function getx0(sprindex: integer): integer;

    //    
    function getx0(sprindex: integer): integer;

    //    
    // ( visible != 0        )
    procedure drawspr(int sprindex);

    //      (   layer)
    procedure drawall;
    
    //  
    // ( )
    function overrect(int spr1, int spr2): integer;
    
    //  
    function overpix(int spr1, int spr2): integer;

    //    
    //      1 
    //   -   
    function dels(sprindex: integer): integer;
    
    //    
    //      1 
    //   -   
    function deli(imgindex: integer): integer;
