File: qgsgloweffect.sip

package info (click to toggle)
qgis 2.18.28%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,007,948 kB
  • sloc: cpp: 671,774; python: 158,539; xml: 35,690; ansic: 8,346; sh: 1,766; perl: 1,669; sql: 999; yacc: 836; lex: 461; makefile: 292
file content (254 lines) | stat: -rw-r--r-- 7,670 bytes parent folder | download | duplicates (3)
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
/** \ingroup core
 * \class QgsGlowEffect
 * \brief Base class for paint effect which draw a glow inside or outside a
 * picture.
 *
 * \note Added in version 2.9
 */

class QgsGlowEffect : QgsPaintEffect
{
%TypeHeaderCode
#include <qgsgloweffect.h>
%End

  public:

    /** Color sources for the glow */
    enum GlowColorType
    {
      SingleColor, /*!< use a single color and fade the color to totally transparent */
      ColorRamp /*!< use colors from a color ramp */
    };

    QgsGlowEffect();
    QgsGlowEffect( const QgsGlowEffect& other );
    virtual ~QgsGlowEffect();

    virtual QgsStringMap properties() const;
    virtual void readProperties( const QgsStringMap& props );

    /** Sets the spread distance for drawing the glow effect.
     * @param spread spread distance. Units are specified via @link setSpreadUnit @endlink
     * @see spread
     * @see setSpreadUnit
     * @see setSpreadMapUnitScale
     */
    void setSpread( const double spread );

    /** Returns the spread distance used for drawing the glow effect.
     * @returns spread distance. Units are retrieved via @link spreadUnit @endlink
     * @see setSpread
     * @see spreadUnit
     * @see spreadMapUnitScale
     */
    double spread() const;

    /** Sets the units used for the glow spread distance.
     * @param unit units for spread distance
     * @see spreadUnit
     * @see setSpread
     * @see setSpreadMapUnitScale
     */
    void setSpreadUnit( const QgsSymbolV2::OutputUnit unit );

    /** Returns the units used for the glow spread distance.
     * @returns units for spread distance
     * @see setSpreadUnit
     * @see spread
     * @see spreadMapUnitScale
     */
    QgsSymbolV2::OutputUnit spreadUnit() const;

    /** Sets the map unit scale used for the spread distance.
     * @param scale map unit scale for spread distance
     * @see spreadMapUnitScale
     * @see setSpread
     * @see setSpreadUnit
     */
    void setSpreadMapUnitScale( const QgsMapUnitScale& scale );

    /** Returns the map unit scale used for the spread distance.
     * @returns map unit scale for spread distance
     * @see setSpreadMapUnitScale
     * @see spread
     * @see spreadUnit
     */
    const QgsMapUnitScale& spreadMapUnitScale() const;

    /** Sets blur level (strength) for the glow. This can be used to smooth the
     * output from the glow effect.
     * @param level blur level. Values between 0 and 16 are valid, with larger
     * values indicating greater blur strength.
     * @see blurLevel
     */
    void setBlurLevel( const int level );

    /** Returns the blur level (strength) for the glow.
     * @returns blur level. Value will be between 0 and 16, with larger
     * values indicating greater blur strength.
     * @see setBlurLevel
     */
    int blurLevel() const;

    /** Sets the transparency for the effect
     * @param transparency double between 0 and 1 inclusive, where 0 is fully opaque
     * and 1 is fully transparent
     * @see transparency
     */
    void setTransparency( const double transparency );

    /** Returns the transparency for the effect
     * @returns transparency value between 0 and 1 inclusive, where 0 is fully opaque
     * and 1 is fully transparent
     * @see setTransparency
     */
    double transparency() const;

    /** Sets the color for the glow. This only applies if the @link colorType @endlink
     * is set to SingleColor. The glow will fade between the specified color and
     * a totally transparent version of the color.
     * @param color glow color
     * @see color
     * @see setColorType
     */
    void setColor( const QColor& color );

    /** Returns the color for the glow. This only applies if the @link colorType @endlink
     * is set to SingleColor. The glow will fade between the specified color and
     * a totally transparent version of the color.
     * @returns glow color
     * @see setColor
     * @see colorType
     */
    QColor color() const;

    /** Sets the color ramp for the glow. This only applies if the @link colorType @endlink
     * is set to ColorRamp. The glow will utilise colors from the ramp.
     * @param ramp color ramp for glow. Ownership of the ramp is transferred to the effect.
     * @see ramp
     * @see setColorType
     */
    void setRamp( QgsVectorColorRampV2* ramp /Transfer/ );

    /** Returns the color ramp used for the glow. This only applies if the @link colorType @endlink
     * is set to ColorRamp. The glow will utilise colors from the ramp.
     * @returns color ramp for glow
     * @see setRamp
     * @see colorType
     */
    QgsVectorColorRampV2* ramp() const;

    /** Sets the blend mode for the effect
     * @param mode blend mode used for drawing the effect on to a destination
     * paint device
     * @see blendMode
     */
    void setBlendMode( const QPainter::CompositionMode mode );

    /** Returns the blend mode for the effect
     * @returns blend mode used for drawing the effect on to a destination
     * paint device
     * @see setBlendMode
     */
    QPainter::CompositionMode blendMode() const;

    /** Sets the color mode to use for the glow. The glow can either be drawn using a QgsVectorColorRampV2
     * color ramp or by simply specificing a single color. setColorType is used to specify which mode to use
     * for the glow.
     * @param colorType color type to use for glow
     * @see colorType
     * @see setColor
     * @see setRamp
     */
    void setColorType( GlowColorType colorType );

    /** Returns the color mode used for the glow. The glow can either be drawn using a QgsVectorColorRampV2
     * color ramp or by specificing a single color.
     * @returns current color mode used for the glow
     * @see setColorType
     * @see color
     * @see ramp
     */
    GlowColorType colorType() const;

  protected:

    virtual QRectF boundingRect( const QRectF& rect, const QgsRenderContext& context ) const;
    virtual void draw( QgsRenderContext& context );

    /** Specifies whether the glow is drawn outside the picture or within
     * the picture.
     * @returns true if glow is to be drawn outside the picture, or false
     * to draw glow within the picture
     */
    virtual bool shadeExterior() const = 0;

};


/** \ingroup core
 * \class QgsOuterGlowEffect
 * \brief A paint effect which draws a glow outside of a picture.
 *
 * \note Added in version 2.9
 */

class QgsOuterGlowEffect : QgsGlowEffect
{
%TypeHeaderCode
#include <qgsgloweffect.h>
%End
  public:

    /** Creates a new QgsOuterGlowEffect effect from a properties string map.
     * @param map encoded properties string map
     * @returns new QgsOuterGlowEffect
     */
    static QgsPaintEffect* create( const QgsStringMap& map ) /Factory/;

    QgsOuterGlowEffect();
    virtual ~QgsOuterGlowEffect();

    virtual QString type() const;
    virtual QgsOuterGlowEffect* clone() const /Factory/;

  protected:

    virtual bool shadeExterior() const;

};


/** \ingroup core
 * \class QgsInnerGlowEffect
 * \brief A paint effect which draws a glow within a picture.
 *
 * \note Added in version 2.9
 */

class QgsInnerGlowEffect : QgsGlowEffect
{
%TypeHeaderCode
#include <qgsgloweffect.h>
%End
  public:

    /** Creates a new QgsInnerGlowEffect effect from a properties string map.
     * @param map encoded properties string map
     * @returns new QgsInnerGlowEffect
     */
    static QgsPaintEffect* create( const QgsStringMap& map ) /Factory/;

    QgsInnerGlowEffect();
    virtual ~QgsInnerGlowEffect();

    virtual QString type() const;
    virtual QgsInnerGlowEffect* clone() const /Factory/;

  protected:

    virtual bool shadeExterior() const;

};