summaryrefslogtreecommitdiffstats
path: root/ksquirrel/sq_glwidget_helpers.h
blob: 12dacfa1386e1074cf791843f069fbbfb442f743 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/***************************************************************************
                          sq_glwidget_helpers.h  -  description
                             -------------------
    begin                : May 31 2005
    copyright            : (C) 2005 by Baryshev Dmitry
    email                : ksquirrel.iv@gmail.com
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef SQ_GLWIDGET_HELPERS
#define SQ_GLWIDGET_HELPERS

#include <ktoolbarbutton.h>

class TQWMatrix;

class KToolBar;

struct RGBA;

class SQ_ToolButtonPopup : public KToolBarButton
{
    public:
        SQ_ToolButtonPopup(const TQPixmap &pix, const TQString &textLabel, KToolBar *tqparent);
        ~SQ_ToolButtonPopup();
};

class SQ_ToolButton : public TQToolButton
{
    public:
        SQ_ToolButton(const TQIconSet &iconSet, const TQString &textLabel, TQObject *receiver,
                        const char *slot, KToolBar *tqparent, const char *name = 0);
        ~SQ_ToolButton();

        static int fixedWidth();
};

inline
int SQ_ToolButton::fixedWidth()
{
    return 26;
}

namespace SQ_GLHelpers
{
    //                                                                               0, 1, 2
    typedef void (* scanLineGetter)(RGBA *data, RGBA *, int rw, int w, int h, int y, int flip);

    void scanLine0(RGBA *, RGBA *, int, int, int, int, int);
    void scanLine90(RGBA *, RGBA *, int, int, int, int, int);
    void scanLine180(RGBA *, RGBA *, int, int, int, int, int);
    void scanLine270(RGBA *, RGBA *, int, int, int, int, int);

    int roundAngle(int ang);

    void subRotation(TQWMatrix &wm, int curangle, int orient);

    /*
     * normalize selection rectangle
     * sx,sy are X and Y coordinates
     * sw x sh is a selection tqgeometry
     */
    bool normalizeSelection(int &sx, int &sy, int &sw, int &sh, int w, int h, const TQWMatrix&, int curangle, int orient);
}

#endif