sipify core effects

This commit is contained in:
Denis Rouzaud 2017-05-23 14:33:31 +02:00
parent 827c19f2e7
commit 09d3e2ff3a
14 changed files with 1551 additions and 1095 deletions

View File

@ -42,15 +42,6 @@ core/composer/qgspaperitem.sip
core/composer/qgsscalebarstyle.sip
core/composer/qgssingleboxscalebarstyle.sip
core/composer/qgsticksscalebarstyle.sip
core/effects/qgsblureffect.sip
core/effects/qgscoloreffect.sip
core/effects/qgseffectstack.sip
core/effects/qgsgloweffect.sip
core/effects/qgsimageoperation.sip
core/effects/qgspainteffect.sip
core/effects/qgspainteffectregistry.sip
core/effects/qgsshadoweffect.sip
core/effects/qgstransformeffect.sip
core/gps/qgsgpsconnection.sip
core/gps/qgsgpsconnectionregistry.sip
core/gps/qgsgpsdconnection.sip

View File

@ -1,95 +1,116 @@
/** \ingroup core
* \class QgsBlurEffect
* \brief A paint effect which blurs a source picture, using a number of different blur
* methods.
*
* \note Added in version 2.9
*/
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/effects/qgsblureffect.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsBlurEffect : QgsPaintEffect
{
%TypeHeaderCode
#include <qgsblureffect.h>
%Docstring
A paint effect which blurs a source picture, using a number of different blur
methods.
.. versionadded:: 2.9
%End
%TypeHeaderCode
#include "qgsblureffect.h"
%End
public:
/** Available blur methods (algorithms) */
enum BlurMethod
{
StackBlur, /*!< stack blur, a fast but low quality blur. Valid blur level values are between 0 - 16.*/
GaussianBlur /*!< Gaussian blur, a slower but high quality blur. Blur level values are the distance in pixels for the blur operation. */
StackBlur,
GaussianBlur
};
/** Creates a new QgsBlurEffect effect from a properties string map.
* @param map encoded properties string map
* @returns new QgsBlurEffect
*/
static QgsPaintEffect *create( const QgsStringMap &map ) /Factory/;
%Docstring
Creates a new QgsBlurEffect effect from a properties string map.
\param map encoded properties string map
:return: new QgsBlurEffect
:rtype: QgsPaintEffect
%End
QgsBlurEffect();
virtual ~QgsBlurEffect();
virtual QString type() const;
virtual QgsStringMap properties() const;
virtual void readProperties( const QgsStringMap &props );
virtual QgsBlurEffect *clone() const /Factory/;
/** Sets blur level (strength)
* @param level blur level. Depending on the current @link blurMethod @endlink, this parameter
* has different effects
* @see blurLevel
* @see blurMethod
*/
void setBlurLevel( const int level );
%Docstring
Sets blur level (strength)
\param level blur level. Depending on the current blurMethod(), this parameter
has different effects
.. seealso:: blurLevel
.. seealso:: blurMethod
%End
/** Returns the blur level (strength)
* @returns blur level. Depending on the current @link blurMethod @endlink, this parameter
* has different effects
* @see setBlurLevel
* @see blurMethod
*/
int blurLevel() const;
%Docstring
Returns the blur level (strength)
:return: blur level. Depending on the current blurMethod(), this parameter
has different effects
.. seealso:: setBlurLevel
.. seealso:: blurMethod
:rtype: int
%End
/** Sets the blur method (algorithm) to use for performing the blur.
* @param method blur method
* @see blurMethod
*/
void setBlurMethod( const BlurMethod method );
%Docstring
Sets the blur method (algorithm) to use for performing the blur.
\param method blur method
.. seealso:: blurMethod
%End
/** Returns the blur method (algorithm) used for performing the blur.
* @returns blur method
* @see setBlurMethod
*/
BlurMethod blurMethod() const;
%Docstring
Returns the blur method (algorithm) used for performing the blur.
:return: blur method
.. seealso:: setBlurMethod
:rtype: BlurMethod
%End
/** 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 );
%Docstring
Sets the transparency for the effect
\param transparency double between 0 and 1 inclusive, where 0 is fully opaque
and 1 is fully transparent
.. seealso:: transparency
%End
/** 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;
%Docstring
Returns the transparency for the effect
:return: transparency value between 0 and 1 inclusive, where 0 is fully opaque
and 1 is fully transparent
.. seealso:: setTransparency
:rtype: float
%End
/** 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 );
%Docstring
Sets the blend mode for the effect
\param mode blend mode used for drawing the effect on to a destination
paint device
.. seealso:: blendMode
%End
/** 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;
%Docstring
Returns the blend mode for the effect
:return: blend mode used for drawing the effect on to a destination
paint device
.. seealso:: setBlendMode
:rtype: QPainter.CompositionMode
%End
protected:
@ -97,3 +118,12 @@ class QgsBlurEffect : QgsPaintEffect
virtual QRectF boundingRect( const QRectF &rect, const QgsRenderContext &context ) const;
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/effects/qgsblureffect.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/

View File

@ -1,174 +1,221 @@
/** \ingroup core
* \class QgsColorEffect
* \brief A paint effect which alters the colors (e.g., brightness, contrast) in a
* source picture.
*
* \note Added in version 2.9
*/
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/effects/qgscoloreffect.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsColorEffect : QgsPaintEffect
{
%TypeHeaderCode
#include <qgscoloreffect.h>
%Docstring
A paint effect which alters the colors (e.g., brightness, contrast) in a
source picture.
.. versionadded:: 2.9
%End
%TypeHeaderCode
#include "qgscoloreffect.h"
%End
public:
/** Creates a new QgsColorEffect effect from a properties string map.
* @param map encoded properties string map
* @returns new QgsColorEffect
*/
static QgsPaintEffect *create( const QgsStringMap &map ) /Factory/;
%Docstring
Creates a new QgsColorEffect effect from a properties string map.
\param map encoded properties string map
:return: new QgsColorEffect
:rtype: QgsPaintEffect
%End
QgsColorEffect();
virtual ~QgsColorEffect();
virtual QString type() const;
virtual QgsStringMap properties() const;
virtual void readProperties( const QgsStringMap &props );
virtual QgsColorEffect *clone() const /Factory/;
/** Sets the brightness modification for the effect.
* @param brightness Valid values are between -255 and 255, where 0 represents
* no change, negative values indicate darkening and positive values indicate
* lightening
* @see setBrightness
*/
void setBrightness( int brightness );
%Docstring
Sets the brightness modification for the effect.
\param brightness Valid values are between -255 and 255, where 0 represents
no change, negative values indicate darkening and positive values indicate
lightening
.. seealso:: setBrightness
%End
/** Returns the brightness modification for the effect.
* @returns brightness value. Values are between -255 and 255, where 0 represents
* no change, negative values indicate darkening and positive values indicate
* lightening
* @see setBrightness
*/
int brightness() const;
%Docstring
Returns the brightness modification for the effect.
:return: brightness value. Values are between -255 and 255, where 0 represents
no change, negative values indicate darkening and positive values indicate
lightening
.. seealso:: setBrightness
:rtype: int
%End
/** Sets the contrast modification for the effect.
* @param contrast Valid values are between -100 and 100, where 0 represents
* no change, negative values indicate less contrast and positive values indicate
* greater contrast
* @see setContrast
*/
void setContrast( int contrast );
%Docstring
Sets the contrast modification for the effect.
\param contrast Valid values are between -100 and 100, where 0 represents
no change, negative values indicate less contrast and positive values indicate
greater contrast
.. seealso:: setContrast
%End
/** Returns the contrast modification for the effect.
* @returns contrast value. Values are between -100 and 100, where 0 represents
* no change, negative values indicate less contrast and positive values indicate
* greater contrast
* @see setContrast
*/
int contrast() const;
%Docstring
Returns the contrast modification for the effect.
:return: contrast value. Values are between -100 and 100, where 0 represents
no change, negative values indicate less contrast and positive values indicate
greater contrast
.. seealso:: setContrast
:rtype: int
%End
/** Sets the saturation modification for the effect.
* @param saturation Valid values are between 0 and 2.0, where 1.0 represents
* no change, 0.0 represents totally desaturated (grayscale), and positive values indicate
* greater saturation
* @see saturation
*/
void setSaturation( double saturation );
%Docstring
Sets the saturation modification for the effect.
\param saturation Valid values are between 0 and 2.0, where 1.0 represents
no change, 0.0 represents totally desaturated (grayscale), and positive values indicate
greater saturation
.. seealso:: saturation
%End
/** Returns the saturation modification for the effect.
* @returns saturation value. Values are between 0 and 2.0, where 1.0 represents
* no change, 0.0 represents totally desaturated (grayscale), and positive values indicate
* greater saturation
* @see setSaturation
*/
double saturation() const;
%Docstring
Returns the saturation modification for the effect.
:return: saturation value. Values are between 0 and 2.0, where 1.0 represents
no change, 0.0 represents totally desaturated (grayscale), and positive values indicate
greater saturation
.. seealso:: setSaturation
:rtype: float
%End
/** Sets whether the effect should convert a picture to grayscale.
* @param grayscaleMode method for grayscale conversion
* @see grayscaleMode
*/
void setGrayscaleMode( QgsImageOperation::GrayscaleMode grayscaleMode );
%Docstring
Sets whether the effect should convert a picture to grayscale.
\param grayscaleMode method for grayscale conversion
.. seealso:: grayscaleMode
%End
/** Returns whether the effect will convert a picture to grayscale.
* @returns method for grayscale conversion
* @see setGrayscaleMode
*/
QgsImageOperation::GrayscaleMode grayscaleMode() const;
%Docstring
Returns whether the effect will convert a picture to grayscale.
:return: method for grayscale conversion
.. seealso:: setGrayscaleMode
:rtype: QgsImageOperation.GrayscaleMode
%End
/** Sets whether the effect should colorize a picture.
* @param colorizeOn set to true to enable colorization
* @see colorizeOn
* @see setColorizeColor
* @see setColorizeStrength
*/
void setColorizeOn( bool colorizeOn );
%Docstring
Sets whether the effect should colorize a picture.
\param colorizeOn set to true to enable colorization
.. seealso:: colorizeOn
.. seealso:: setColorizeColor
.. seealso:: setColorizeStrength
%End
/** Returns whether the effect will colorize a picture.
* @returns true if colorization is enableds
* @see setColorizeOn
* @see colorizeColor
* @see colorizeStrength
*/
bool colorizeOn() const;
%Docstring
Returns whether the effect will colorize a picture.
:return: true if colorization is enableds
.. seealso:: setColorizeOn
.. seealso:: colorizeColor
.. seealso:: colorizeStrength
:rtype: bool
%End
/** Sets the color used for colorizing a picture. This is only used if
* @link setColorizeOn @endlink is set to true.
* @param colorizeColor colorization color
* @see colorizeColor
* @see setColorizeOn
* @see setColorizeStrength
*/
void setColorizeColor( const QColor &colorizeColor );
%Docstring
Sets the color used for colorizing a picture. This is only used if
setColorizeOn() is set to true.
\param colorizeColor colorization color
.. seealso:: colorizeColor
.. seealso:: setColorizeOn
.. seealso:: setColorizeStrength
%End
/** Returns the color used for colorizing a picture. This is only used if
* @link colorizeOn @endlink is set to true.
* @returns colorization color
* @see setColorizeColor
* @see colorizeOn
* @see colorizeStrength
*/
QColor colorizeColor() const;
%Docstring
Returns the color used for colorizing a picture. This is only used if
colorizeOn() is set to true.
:return: colorization color
.. seealso:: setColorizeColor
.. seealso:: colorizeOn
.. seealso:: colorizeStrength
:rtype: QColor
%End
/** Sets the strength for colorizing a picture. This is only used if
* @link setColorizeOn @endlink is set to true.
* @param colorizeStrength colorization strength, between 0 and 100
* @see colorizeStrength
* @see setColorizeOn
* @see setColorizeColor
*/
void setColorizeStrength( int colorizeStrength );
%Docstring
Sets the strength for colorizing a picture. This is only used if
setColorizeOn() is set to true.
\param colorizeStrength colorization strength, between 0 and 100
.. seealso:: colorizeStrength
.. seealso:: setColorizeOn
.. seealso:: setColorizeColor
%End
/** Returns the strength used for colorizing a picture. This is only used if
* @link setColorizeOn @endlink is set to true.
* @returns colorization strength, between 0 and 100
* @see setColorizeStrengths
* @see colorizeOn
* @see colorizeColor
*/
int colorizeStrength() const;
%Docstring
Returns the strength used for colorizing a picture. This is only used if
setColorizeOn() is set to true.
:return: colorization strength, between 0 and 100
.. seealso:: setColorizeStrengths
.. seealso:: colorizeOn
.. seealso:: colorizeColor
:rtype: int
%End
/** 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 );
%Docstring
Sets the transparency for the effect
\param transparency double between 0 and 1 inclusive, where 0 is fully opaque
and 1 is fully transparent
.. seealso:: transparency
%End
/** 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;
%Docstring
Returns the transparency for the effect
:return: transparency value between 0 and 1 inclusive, where 0 is fully opaque
and 1 is fully transparent
.. seealso:: setTransparency
:rtype: float
%End
/** 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 );
%Docstring
Sets the blend mode for the effect
\param mode blend mode used for drawing the effect on to a destination
paint device
.. seealso:: blendMode
%End
/** 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;
%Docstring
Returns the blend mode for the effect
:return: blend mode used for drawing the effect on to a destination
paint device
.. seealso:: setBlendMode
:rtype: QPainter.CompositionMode
%End
protected:
virtual void draw( QgsRenderContext &context );
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/effects/qgscoloreffect.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/

View File

@ -1,46 +1,58 @@
/** \ingroup core
* \class QgsEffectStack
* \brief A paint effect which consists of a stack of other chained paint effects
*
* Effect stacks can be used to apply multiple paint effects to a QPicture. For
* instance, an effect stack may blur then apply a drop shadow.
*
* The way in which effects apply to a stack is controlled by the effect's drawMode.
* Effects can either render their results onto the destination paint device,
* or just modify the source picture which is drawn by subsequent effects in the
* stack. For instance, a blur effect with a Modifier drawMode will blur the source
* picture for the following drop shadow effect without actually drawing the blurred
* picture to the paint device. If the blur effect had a Render drawMode then the
* blurred picture will be drawn on the paint device, but the following drop shadow
* effect will be drawn using the original picture, not the blurred version.
*
* \note Added in version 2.9
*/
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/effects/qgseffectstack.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsEffectStack : QgsPaintEffect
{
%TypeHeaderCode
#include <qgseffectstack.h>
%Docstring
A paint effect which consists of a stack of other chained paint effects
Effect stacks can be used to apply multiple paint effects to a QPicture. For
instance, an effect stack may blur then apply a drop shadow.
The way in which effects apply to a stack is controlled by the effect's drawMode.
Effects can either render their results onto the destination paint device,
or just modify the source picture which is drawn by subsequent effects in the
stack. For instance, a blur effect with a Modifier drawMode will blur the source
picture for the following drop shadow effect without actually drawing the blurred
picture to the paint device. If the blur effect had a Render drawMode then the
blurred picture will be drawn on the paint device, but the following drop shadow
effect will be drawn using the original picture, not the blurred version.
.. versionadded:: 2.9
%End
%TypeHeaderCode
#include "qgseffectstack.h"
%End
public:
/** Creates a new QgsEffectStack effect. This method ignores
* the map parameter, and always returns an empty effect stack.
* @param map unused encoded properties string map
* @returns new QgsEffectStack
*/
static QgsPaintEffect *create( const QgsStringMap &map ) /Factory/;
%Docstring
Creates a new QgsEffectStack effect. This method ignores
the map parameter, and always returns an empty effect stack.
\param map unused encoded properties string map
:return: new QgsEffectStack
:rtype: QgsPaintEffect
%End
QgsEffectStack();
QgsEffectStack( const QgsEffectStack &other );
/** Creates a new QgsEffectStack effect from a single initial effect.
* @param effect initial effect to add to the stack. The effect will
* be cloned, so ownership is not transferred to the stack.
* @returns new QgsEffectStack containing initial effect
*/
explicit QgsEffectStack( const QgsPaintEffect &effect );
%Docstring
Creates a new QgsEffectStack effect from a single initial effect.
\param effect initial effect to add to the stack. The effect will
be cloned, so ownership is not transferred to the stack.
:return: new QgsEffectStack containing initial effect
%End
virtual ~QgsEffectStack();
@ -49,60 +61,86 @@ class QgsEffectStack : QgsPaintEffect
virtual bool saveProperties( QDomDocument &doc, QDomElement &element ) const;
virtual bool readProperties( const QDomElement &element );
/** Unused for QgsEffectStack, will always return an empty string map
*/
virtual QgsStringMap properties() const;
%Docstring
Unused for QgsEffectStack, will always return an empty string map
:rtype: QgsStringMap
%End
/** Unused for QgsEffectStack, props parameter will be ignored
*/
virtual void readProperties( const QgsStringMap &props );
%Docstring
Unused for QgsEffectStack, props parameter will be ignored
%End
/** Appends an effect to the end of the stack.
* @param effect QgsPaintEffect to append. Ownership of the effect will be
* transferred to the stack object.
* @see insertEffect
*/
void appendEffect( QgsPaintEffect *effect /Transfer/);
void appendEffect( QgsPaintEffect *effect /Transfer/ );
%Docstring
Appends an effect to the end of the stack.
\param effect QgsPaintEffect to append. Ownership of the effect will be
transferred to the stack object.
.. seealso:: insertEffect
%End
/** Inserts an effect at a specified index within the stack.
* @param index position to insert the effect
* @param effect QgsPaintEffect to insert. Ownership of the effect will be
* transferred to the stack object.
* @see appendEffect
*/
bool insertEffect( const int index, QgsPaintEffect *effect /Transfer/);
bool insertEffect( const int index, QgsPaintEffect *effect /Transfer/ );
%Docstring
Inserts an effect at a specified index within the stack.
\param index position to insert the effect
\param effect QgsPaintEffect to insert. Ownership of the effect will be
transferred to the stack object.
.. seealso:: appendEffect
:rtype: bool
%End
/** Replaces the effect at a specified position within the stack.
* @param index position of effect to replace
* @param effect QgsPaintEffect to replace with. Ownership of the effect will be
* transferred to the stack object.
*/
bool changeEffect( const int index, QgsPaintEffect *effect /Transfer/);
bool changeEffect( const int index, QgsPaintEffect *effect /Transfer/ );
%Docstring
Replaces the effect at a specified position within the stack.
\param index position of effect to replace
\param effect QgsPaintEffect to replace with. Ownership of the effect will be
transferred to the stack object.
:rtype: bool
%End
/** Removes an effect from the stack and returns a pointer to it.
* @param index position of effect to take
*/
QgsPaintEffect *takeEffect( const int index );
QgsPaintEffect *takeEffect( const int index /TransferBack/ );
%Docstring
Removes an effect from the stack and returns a pointer to it.
\param index position of effect to take
:rtype: QgsPaintEffect
%End
/** Returns a pointer to the list of effects currently contained by
* the stack
* @returns list of QgsPaintEffects within the stack
*/
QList< QgsPaintEffect* > *effectList();
QList< QgsPaintEffect * > *effectList();
%Docstring
Returns a pointer to the list of effects currently contained by
the stack
:return: list of QgsPaintEffects within the stack
:rtype: list of QgsPaintEffect
%End
/** Returns count of effects contained by the stack
* @returns count of effects
*/
int count() const;
%Docstring
Returns count of effects contained by the stack
:return: count of effects
:rtype: int
%End
/** Returns a pointer to the effect at a specified index within the stack
* @param index position of effect to return
* @returns QgsPaintEffect at specified position
*/
QgsPaintEffect *effect( int index ) const;
%Docstring
Returns a pointer to the effect at a specified index within the stack
\param index position of effect to return
:return: QgsPaintEffect at specified position
:rtype: QgsPaintEffect
%End
protected:
virtual void draw( QgsRenderContext &context );
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/effects/qgseffectstack.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/

View File

@ -1,24 +1,34 @@
/** \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
*/
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/effects/qgsgloweffect.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsGlowEffect : QgsPaintEffect
{
%TypeHeaderCode
#include <qgsgloweffect.h>
%Docstring
Base class for paint effect which draw a glow inside or outside a
picture.
.. versionadded:: 2.9
%End
%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 */
SingleColor,
ColorRamp
};
QgsGlowEffect();
@ -28,187 +38,219 @@ class QgsGlowEffect : QgsPaintEffect
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 );
%Docstring
Sets the spread distance for drawing the glow effect.
\param spread spread distance. Units are specified via setSpreadUnit()
.. seealso:: spread
.. seealso:: setSpreadUnit
.. seealso:: setSpreadMapUnitScale
%End
/** 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;
%Docstring
Returns the spread distance used for drawing the glow effect.
:return: spread distance. Units are retrieved via spreadUnit()
.. seealso:: setSpread
.. seealso:: spreadUnit
.. seealso:: spreadMapUnitScale
:rtype: float
%End
/** Sets the units used for the glow spread distance.
* @param unit units for spread distance
* @see spreadUnit
* @see setSpread
* @see setSpreadMapUnitScale
*/
void setSpreadUnit( const QgsUnitTypes::RenderUnit unit );
%Docstring
Sets the units used for the glow spread distance.
\param unit units for spread distance
.. seealso:: spreadUnit
.. seealso:: setSpread
.. seealso:: setSpreadMapUnitScale
%End
/** Returns the units used for the glow spread distance.
* @returns units for spread distance
* @see setSpreadUnit
* @see spread
* @see spreadMapUnitScale
*/
QgsUnitTypes::RenderUnit spreadUnit() const;
%Docstring
Returns the units used for the glow spread distance.
:return: units for spread distance
.. seealso:: setSpreadUnit
.. seealso:: spread
.. seealso:: spreadMapUnitScale
:rtype: QgsUnitTypes.RenderUnit
%End
/** 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 );
%Docstring
Sets the map unit scale used for the spread distance.
\param scale map unit scale for spread distance
.. seealso:: spreadMapUnitScale
.. seealso:: setSpread
.. seealso:: setSpreadUnit
%End
/** 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;
%Docstring
Returns the map unit scale used for the spread distance.
:return: map unit scale for spread distance
.. seealso:: setSpreadMapUnitScale
.. seealso:: spread
.. seealso:: spreadUnit
:rtype: QgsMapUnitScale
%End
/** 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 );
%Docstring
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.
.. seealso:: blurLevel
%End
/** 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;
%Docstring
Returns the blur level (strength) for the glow.
:return: blur level. Value will be between 0 and 16, with larger
values indicating greater blur strength.
.. seealso:: setBlurLevel
:rtype: int
%End
/** 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 );
%Docstring
Sets the transparency for the effect
\param transparency double between 0 and 1 inclusive, where 0 is fully opaque
and 1 is fully transparent
.. seealso:: transparency
%End
/** 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;
%Docstring
Returns the transparency for the effect
:return: transparency value between 0 and 1 inclusive, where 0 is fully opaque
and 1 is fully transparent
.. seealso:: setTransparency
:rtype: float
%End
/** 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 );
%Docstring
Sets the color for the glow. This only applies if the colorType()
is set to SingleColor. The glow will fade between the specified color and
a totally transparent version of the color.
\param color glow color
.. seealso:: color
.. seealso:: setColorType
%End
/** 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;
%Docstring
Returns the color for the glow. This only applies if the colorType()
is set to SingleColor. The glow will fade between the specified color and
a totally transparent version of the color.
:return: glow color
.. seealso:: setColor
.. seealso:: colorType
:rtype: QColor
%End
/** Sets the color ramp for the glow. This only applies if the @link colorType @endlink
* is set to ColorRamp. The glow will utilize 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( QgsColorRamp *ramp /Transfer/ );
%Docstring
Sets the color ramp for the glow. This only applies if the colorType()
is set to ColorRamp. The glow will utilize colors from the ramp.
\param ramp color ramp for glow. Ownership of the ramp is transferred to the effect.
.. seealso:: ramp
.. seealso:: setColorType
%End
/** Returns the color ramp used for the glow. This only applies if the @link colorType @endlink
* is set to ColorRamp. The glow will utilize colors from the ramp.
* @returns color ramp for glow
* @see setRamp
* @see colorType
*/
QgsColorRamp *ramp() const;
%Docstring
Returns the color ramp used for the glow. This only applies if the colorType()
is set to ColorRamp. The glow will utilize colors from the ramp.
:return: color ramp for glow
.. seealso:: setRamp
.. seealso:: colorType
:rtype: QgsColorRamp
%End
/** 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 );
%Docstring
Sets the blend mode for the effect
\param mode blend mode used for drawing the effect on to a destination
paint device
.. seealso:: blendMode
%End
/** 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;
%Docstring
Returns the blend mode for the effect
:return: blend mode used for drawing the effect on to a destination
paint device
.. seealso:: setBlendMode
:rtype: QPainter.CompositionMode
%End
/** Sets the color mode to use for the glow. The glow can either be drawn using a QgsColorRamp
* 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 );
%Docstring
Sets the color mode to use for the glow. The glow can either be drawn using a QgsColorRamp
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
.. seealso:: colorType
.. seealso:: setColor
.. seealso:: setRamp
%End
/** Returns the color mode used for the glow. The glow can either be drawn using a QgsColorRamp
* 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;
%Docstring
Returns the color mode used for the glow. The glow can either be drawn using a QgsColorRamp
color ramp or by specificing a single color.
:return: current color mode used for the glow
.. seealso:: setColorType
.. seealso:: color
.. seealso:: ramp
:rtype: GlowColorType
%End
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;
%Docstring
Specifies whether the glow is drawn outside the picture or within
the picture.
:return: true if glow is to be drawn outside the picture, or false
to draw glow within the picture
:rtype: bool
%End
};
/** \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
{
%Docstring
A paint effect which draws a glow outside of a picture.
.. versionadded:: 2.9
%End
%TypeHeaderCode
#include <qgsgloweffect.h>
#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/;
%Docstring
Creates a new QgsOuterGlowEffect effect from a properties string map.
\param map encoded properties string map
:return: new QgsOuterGlowEffect
:rtype: QgsPaintEffect
%End
QgsOuterGlowEffect();
virtual ~QgsOuterGlowEffect();
virtual QString type() const;
virtual QgsOuterGlowEffect *clone() const /Factory/;
@ -220,28 +262,29 @@ class QgsOuterGlowEffect : QgsGlowEffect
};
/** \ingroup core
* \class QgsInnerGlowEffect
* \brief A paint effect which draws a glow within a picture.
*
* \note Added in version 2.9
*/
class QgsInnerGlowEffect : QgsGlowEffect
{
%Docstring
A paint effect which draws a glow within a picture.
.. versionadded:: 2.9
%End
%TypeHeaderCode
#include <qgsgloweffect.h>
#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/;
%Docstring
Creates a new QgsInnerGlowEffect effect from a properties string map.
\param map encoded properties string map
:return: new QgsInnerGlowEffect
:rtype: QgsPaintEffect
%End
QgsInnerGlowEffect();
virtual ~QgsInnerGlowEffect();
virtual QString type() const;
virtual QgsInnerGlowEffect *clone() const /Factory/;
@ -252,3 +295,11 @@ class QgsInnerGlowEffect : QgsGlowEffect
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/effects/qgsgloweffect.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/

View File

@ -1,156 +1,208 @@
/** \ingroup core
* \class QgsImageOperation
* \brief Contains operations and filters which apply to QImages
*
* A set of optimised pixel manipulation operations and filters which can be applied
* to QImages. All operations only apply to ARGB32 format images, and it is left up
* to the calling procedure to ensure that any passed images are of the correct
* format.
*
* Operations are written to either modify an image in place or return a new image, depending
* on which is faster for the particular operation.
*
* \note Added in version 2.7
*/
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/effects/qgsimageoperation.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsImageOperation
{
%TypeHeaderCode
#include <qgsimageoperation.h>
%Docstring
Contains operations and filters which apply to QImages
A set of optimised pixel manipulation operations and filters which can be applied
to QImages. All operations only apply to ARGB32 format images, and it is left up
to the calling procedure to ensure that any passed images are of the correct
format.
Operations are written to either modify an image in place or return a new image, depending
on which is faster for the particular operation.
.. versionadded:: 2.7
%End
%TypeHeaderCode
#include "qgsimageoperation.h"
%End
public:
/** Modes for converting a QImage to grayscale
*/
enum GrayscaleMode
{
GrayscaleLightness, /*!< keep the lightness of the color, drops the saturation */
GrayscaleLuminosity, /*!< grayscale by perceptual luminosity (weighted sum of color RGB components) */
GrayscaleAverage, /*!< grayscale by taking average of color RGB components */
GrayscaleOff /*!< no change */
GrayscaleLightness,
GrayscaleLuminosity,
GrayscaleAverage,
GrayscaleOff
};
/** Flip operation types
*/
enum FlipType
{
FlipHorizontal, /*!< flip the image horizontally */
FlipVertical /*!< flip the image vertically */
FlipHorizontal,
FlipVertical
};
/** Convert a QImage to a grayscale image. Alpha channel is preserved.
* @param image QImage to convert
* @param mode mode to use during grayscale conversion
*/
static void convertToGrayscale( QImage &image, const GrayscaleMode mode = GrayscaleLuminosity );
%Docstring
Convert a QImage to a grayscale image. Alpha channel is preserved.
\param image QImage to convert
\param mode mode to use during grayscale conversion
%End
/** Alter the brightness or contrast of a QImage.
* @param image QImage to alter
* @param brightness brightness value, in the range -255 to 255. A brightness value of 0 indicates
* no change to brightness, a negative value will darken the image, and a positive value will brighten
* the image.
* @param contrast contrast value. Must be a positive or zero value. A value of 1.0 indicates no change
* to the contrast, a value of 0 represents an image with 0 contrast, and a value > 1.0 will increase the
* contrast of the image.
*/
static void adjustBrightnessContrast( QImage &image, const int brightness, const double contrast );
%Docstring
Alter the brightness or contrast of a QImage.
\param image QImage to alter
\param brightness brightness value, in the range -255 to 255. A brightness value of 0 indicates
no change to brightness, a negative value will darken the image, and a positive value will brighten
the image.
\param contrast contrast value. Must be a positive or zero value. A value of 1.0 indicates no change
to the contrast, a value of 0 represents an image with 0 contrast, and a value > 1.0 will increase the
contrast of the image.
%End
/** Alter the hue or saturation of a QImage.
* @param image QImage to alter
* @param saturation double between 0 and 2 inclusive, where 0 = desaturate and 1.0 = no change
* @param colorizeColor color to use for colorizing image. Set to an invalid QColor to disable
* colorization.
* @param colorizeStrength double between 0 and 1, where 0 = no colorization and 1.0 = full colorization
*/
static void adjustHueSaturation( QImage &image, const double saturation, const QColor& colorizeColor = QColor(),
static void adjustHueSaturation( QImage &image, const double saturation, const QColor &colorizeColor = QColor(),
const double colorizeStrength = 1.0 );
%Docstring
Alter the hue or saturation of a QImage.
\param image QImage to alter
\param saturation double between 0 and 2 inclusive, where 0 = desaturate and 1.0 = no change
\param colorizeColor color to use for colorizing image. Set to an invalid QColor to disable
colorization.
\param colorizeStrength double between 0 and 1, where 0 = no colorization and 1.0 = full colorization
%End
/** Multiplies opacity of image pixel values by a factor.
* @param image QImage to alter
* @param factor factor to multiple pixel's opacity by
*/
static void multiplyOpacity( QImage &image, const double factor );
%Docstring
Multiplies opacity of image pixel values by a factor.
\param image QImage to alter
\param factor factor to multiple pixel's opacity by
%End
/** Overlays a color onto an image. This operation retains the alpha channel of the
* original image, but replaces all image pixel colors with the specified color.
* @param image QImage to alter
* @param color color to overlay (any alpha component of the color is ignored)
*/
static void overlayColor( QImage &image, const QColor &color );
%Docstring
Overlays a color onto an image. This operation retains the alpha channel of the
original image, but replaces all image pixel colors with the specified color.
\param image QImage to alter
\param color color to overlay (any alpha component of the color is ignored)
%End
/** Struct for storing properties of a distance transform operation*/
struct DistanceTransformProperties
{
/** Set to true to perform the distance transform on transparent pixels
* in the source image, set to false to perform the distance transform
* on opaque pixels
*/
DistanceTransformProperties();
bool shadeExterior;
/** Set to true to automatically calculate the maximum distance in the
* transform to use as the spread value
*/
%Docstring
Set to true to perform the distance transform on transparent pixels
in the source image, set to false to perform the distance transform
on opaque pixels
%End
bool useMaxDistance;
/** Maximum distance (in pixels) for the distance transform shading to
* spread
*/
%Docstring
Set to true to automatically calculate the maximum distance in the
transform to use as the spread value
%End
double spread;
/** Color ramp to use for shading the distance transform
*/
%Docstring
Maximum distance (in pixels) for the distance transform shading to
spread
%End
QgsColorRamp *ramp;
%Docstring
Color ramp to use for shading the distance transform
%End
};
/** Performs a distance transform on the source image and shades the result
* using a color ramp.
* @param image QImage to alter
* @param properties DistanceTransformProperties object with parameters
* for the distance transform operation
*/
static void distanceTransform( QImage &image, const QgsImageOperation::DistanceTransformProperties &properties );
%Docstring
Performs a distance transform on the source image and shades the result
using a color ramp.
\param image QImage to alter
\param properties DistanceTransformProperties object with parameters
for the distance transform operation
%End
/** Performs a stack blur on an image. Stack blur represents a good balance between
* speed and blur quality.
* @param image QImage to blur
* @param radius blur radius in pixels, maximum value of 16
* @param alphaOnly set to true to blur only the alpha component of the image
* @note for fastest operation, ensure the source image is ARGB32_Premultiplied if
* alphaOnly is set to false, or ARGB32 if alphaOnly is true
*/
static void stackBlur( QImage &image, const int radius, const bool alphaOnly = false );
%Docstring
Performs a stack blur on an image. Stack blur represents a good balance between
speed and blur quality.
\param image QImage to blur
\param radius blur radius in pixels, maximum value of 16
\param alphaOnly set to true to blur only the alpha component of the image
.. note::
for fastest operation, ensure the source image is ARGB32_Premultiplied if
alphaOnly is set to false, or ARGB32 if alphaOnly is true
%End
/** Performs a gaussian blur on an image. Gaussian blur is slower but results in a high
* quality blur.
* @param image QImage to blur
* @param radius blur radius in pixels
* @returns blurred image
* @note for fastest operation, ensure the source image is ARGB32_Premultiplied
*/
static QImage *gaussianBlur( QImage &image, const int radius ) /Factory/;
%Docstring
Performs a gaussian blur on an image. Gaussian blur is slower but results in a high
quality blur.
\param image QImage to blur
\param radius blur radius in pixels
:return: blurred image
.. note::
for fastest operation, ensure the source image is ARGB32_Premultiplied
:rtype: QImage
%End
/** Flips an image horizontally or vertically
* @param image QImage to flip
* @param type type of flip to perform (horizontal or vertical)
*/
static void flipImage( QImage &image, FlipType type );
%Docstring
Flips an image horizontally or vertically
\param image QImage to flip
\param type type of flip to perform (horizontal or vertical)
%End
/** Calculates the non-transparent region of an image.
* @param image source image
* @param minSize minimum size for returned region, if desired. If the
* non-transparent region of the image is smaller than this minimum size,
* it will be centered in the returned rectangle.
* @param center return rectangle will be centered on the center of the original image if set to true
* @note added in QGIS 2.9
* @see cropTransparent
*/
static QRect nonTransparentImageRect( const QImage &image, QSize minSize = QSize(), bool center = false );
%Docstring
Calculates the non-transparent region of an image.
\param image source image
\param minSize minimum size for returned region, if desired. If the
non-transparent region of the image is smaller than this minimum size,
it will be centered in the returned rectangle.
\param center return rectangle will be centered on the center of the original image if set to true
.. versionadded:: 2.9
.. seealso:: cropTransparent
:rtype: QRect
%End
/** Crop any transparent border from around an image.
* @param image source image
* @param minSize minimum size for cropped image, if desired. If the
* cropped image is smaller than the minimum size, it will be centered
* in the returned image.
* @param center cropped image will be centered on the center of the original image if set to true
* @note added in QGIS 2.9
*/
static QImage cropTransparent( const QImage &image, QSize minSize = QSize(), bool center = false );
%Docstring
Crop any transparent border from around an image.
\param image source image
\param minSize minimum size for cropped image, if desired. If the
cropped image is smaller than the minimum size, it will be centered
in the returned image.
\param center cropped image will be centered on the center of the original image if set to true
.. versionadded:: 2.9
:rtype: QImage
%End
public:
public:
public:
public:
public:
public:
public:
public:
public:
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/effects/qgsimageoperation.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/

View File

@ -1,305 +1,349 @@
/** \ingroup core
* \class QgsPaintEffect
* \brief Base class for visual effects which can be applied to QPicture drawings
*
* QgsPaintEffect objects can be used to modify QPicture drawings prior to rendering
* them with a QPainter operation. There are two methods for drawing using an effect,
* either drawing a picture directly, or by intercepting drawing operations to a
* render context.
*
* To directly draw a picture, use the @link render @endlink method with a source
* QPicture and destination render context.
*
* Intercepting drawing operations to a render context is achieved by first calling
* the @link begin @endlink method, passing a render context. Any drawing operations
* performed on the render context will not directly affect the context's paint
* device. When the drawing operations have been completed, call the @link end @endlink
* method. This will perform the paint effect on the intercepted drawing operations
* and render the result to the render context's paint device.
*
* \see QgsPaintEffectRegistry
* \note Added in version 2.9
*/
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/effects/qgspainteffect.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsPaintEffect
{
%Docstring
Base class for visual effects which can be applied to QPicture drawings
QgsPaintEffect objects can be used to modify QPicture drawings prior to rendering
them with a QPainter operation. There are two methods for drawing using an effect,
either drawing a picture directly, or by intercepting drawing operations to a
render context.
To directly draw a picture, use the render() method with a source
QPicture and destination render context.
Intercepting drawing operations to a render context is achieved by first calling
the begin() method, passing a render context. Any drawing operations
performed on the render context will not directly affect the context's paint
device. When the drawing operations have been completed, call the end()
method. This will perform the paint effect on the intercepted drawing operations
and render the result to the render context's paint device.
.. seealso:: QgsPaintEffectRegistry
.. versionadded:: 2.9
%End
%TypeHeaderCode
#include <qgspainteffect.h>
#include "qgspainteffect.h"
%End
%ConvertToSubClassCode
if (sipCpp->type() == "drawSource" && dynamic_cast<QgsDrawSourceEffect*>(sipCpp) != NULL)
{
sipType = sipType_QgsDrawSourceEffect;
}
else if (sipCpp->type() == "effectStack" && dynamic_cast<QgsEffectStack*>(sipCpp) != NULL)
{
sipType = sipType_QgsEffectStack;
}
else if (sipCpp->type() == "blur" && dynamic_cast<QgsBlurEffect*>(sipCpp) != NULL)
{
sipType = sipType_QgsBlurEffect;
}
else if (sipCpp->type() == "dropShadow" && dynamic_cast<QgsDropShadowEffect*>(sipCpp) != NULL)
{
sipType = sipType_QgsDropShadowEffect;
}
else if (sipCpp->type() == "outerGlow" && dynamic_cast<QgsOuterGlowEffect*>(sipCpp) != NULL)
{
sipType = sipType_QgsOuterGlowEffect;
}
else if (sipCpp->type() == "innerGlow" && dynamic_cast<QgsInnerGlowEffect*>(sipCpp) != NULL)
{
sipType = sipType_QgsInnerGlowEffect;
}
else if (sipCpp->type() == "transform" && dynamic_cast<QgsTransformEffect*>(sipCpp) != NULL)
{
sipType = sipType_QgsTransformEffect;
}
else if (sipCpp->type() == "color" && dynamic_cast<QgsColorEffect*>(sipCpp) != NULL)
{
sipType = sipType_QgsColorEffect;
}
else
{
sipType = 0;
}
if ( sipCpp->type() == "drawSource" && dynamic_cast<QgsDrawSourceEffect *>( sipCpp ) != NULL )
{
sipType = sipType_QgsDrawSourceEffect;
}
else if ( sipCpp->type() == "effectStack" && dynamic_cast<QgsEffectStack *>( sipCpp ) != NULL )
{
sipType = sipType_QgsEffectStack;
}
else if ( sipCpp->type() == "blur" && dynamic_cast<QgsBlurEffect *>( sipCpp ) != NULL )
{
sipType = sipType_QgsBlurEffect;
}
else if ( sipCpp->type() == "dropShadow" && dynamic_cast<QgsDropShadowEffect *>( sipCpp ) != NULL )
{
sipType = sipType_QgsDropShadowEffect;
}
else if ( sipCpp->type() == "outerGlow" && dynamic_cast<QgsOuterGlowEffect *>( sipCpp ) != NULL )
{
sipType = sipType_QgsOuterGlowEffect;
}
else if ( sipCpp->type() == "innerGlow" && dynamic_cast<QgsInnerGlowEffect *>( sipCpp ) != NULL )
{
sipType = sipType_QgsInnerGlowEffect;
}
else if ( sipCpp->type() == "transform" && dynamic_cast<QgsTransformEffect *>( sipCpp ) != NULL )
{
sipType = sipType_QgsTransformEffect;
}
else if ( sipCpp->type() == "color" && dynamic_cast<QgsColorEffect *>( sipCpp ) != NULL )
{
sipType = sipType_QgsColorEffect;
}
else
{
sipType = 0;
}
%End
public:
/** Drawing modes for effects. These modes are used only when effects are
* drawn as part of an effects stack
* @see QgsEffectStack
*/
enum DrawMode
{
Modifier, /*!< the result of the effect is not rendered, but is passed on to following effects in the stack */
Render, /*!< the result of the effect is rendered on the destination, but does not affect subsequent effects in the stack */
ModifyAndRender /*!< the result of the effect is both rendered and passed on to subsequent effects in the stack */
Modifier,
Render,
ModifyAndRender
};
QgsPaintEffect();
QgsPaintEffect( const QgsPaintEffect &other );
virtual ~QgsPaintEffect();
/** Returns the effect type.
* @returns unique string representation of the effect type
*/
virtual QString type() const = 0;
%Docstring
Returns the effect type.
:return: unique string representation of the effect type
:rtype: str
%End
/** Duplicates an effect by creating a deep copy of the effect
* @returns clone of paint effect
*/
virtual QgsPaintEffect *clone() const = 0 /Factory/;
%Docstring
Duplicates an effect by creating a deep copy of the effect
:return: clone of paint effect
:rtype: QgsPaintEffect
%End
/** Returns the properties describing the paint effect encoded in a
* string format.
* @returns string map of properties, in the form property key, value
* @see readProperties
* @see saveProperties
*/
virtual QgsStringMap properties() const = 0;
%Docstring
Returns the properties describing the paint effect encoded in a
string format.
:return: string map of properties, in the form property key, value
.. seealso:: readProperties
.. seealso:: saveProperties
:rtype: QgsStringMap
%End
/** Reads a string map of an effect's properties and restores the effect
* to the state described by the properties map.
* @param props effect properties encoded in a string map
* @see properties
*/
virtual void readProperties( const QgsStringMap &props ) = 0;
%Docstring
Reads a string map of an effect's properties and restores the effect
to the state described by the properties map.
\param props effect properties encoded in a string map
.. seealso:: properties
%End
/** Saves the current state of the effect to a DOM element. The default
* behavior is to save the properties string map returned by
* @link properties @endlink.
* @param doc destination DOM document
* @param element destination DOM element
* @returns true if save was successful
* @see readProperties
*/
virtual bool saveProperties( QDomDocument &doc, QDomElement &element ) const;
%Docstring
Saves the current state of the effect to a DOM element. The default
behavior is to save the properties string map returned by
properties().
\param doc destination DOM document
\param element destination DOM element
:return: true if save was successful
.. seealso:: readProperties
:rtype: bool
%End
/** Restores the effect to the state described by a DOM element.
* @param element DOM element describing an effect's state
* @returns true if read was successful
* @see saveProperties
*/
virtual bool readProperties( const QDomElement &element );
%Docstring
Restores the effect to the state described by a DOM element.
\param element DOM element describing an effect's state
:return: true if read was successful
.. seealso:: saveProperties
:rtype: bool
%End
/** Renders a picture using the effect.
* @param picture source QPicture to render
* @param context destination render context
* @see begin
*/
virtual void render( QPicture &picture, QgsRenderContext &context );
%Docstring
Renders a picture using the effect.
\param picture source QPicture to render
\param context destination render context
.. seealso:: begin
%End
/** Begins intercepting paint operations to a render context. When the corresponding
* @link end @endlink member is called all intercepted paint operations will be
* drawn to the render context after being modified by the effect.
* @param context destination render context
* @see end
* @see render
*/
virtual void begin( QgsRenderContext &context );
%Docstring
Begins intercepting paint operations to a render context. When the corresponding
end() member is called all intercepted paint operations will be
drawn to the render context after being modified by the effect.
\param context destination render context
.. seealso:: end
.. seealso:: render
%End
/** Ends interception of paint operations to a render context, and draws the result
* to the render context after being modified by the effect.
* @param context destination render context
* @see begin
*/
virtual void end( QgsRenderContext &context );
%Docstring
Ends interception of paint operations to a render context, and draws the result
to the render context after being modified by the effect.
\param context destination render context
.. seealso:: begin
%End
/** Returns whether the effect is enabled
* @returns true if effect is enabled
* @see setEnabled
*/
bool enabled() const;
%Docstring
Returns whether the effect is enabled
:return: true if effect is enabled
.. seealso:: setEnabled
:rtype: bool
%End
/** Sets whether the effect is enabled
* @param enabled set to false to disable the effect
* @see enabled
*/
void setEnabled( const bool enabled );
%Docstring
Sets whether the effect is enabled
\param enabled set to false to disable the effect
.. seealso:: enabled
%End
/** Returns the draw mode for the effect. This property only has an
* effect if the paint effect is used in a @link QgsEffectStack @endlink
* @returns draw mode for effect
* @see setDrawMode
*/
DrawMode drawMode() const;
%Docstring
Returns the draw mode for the effect. This property only has an
effect if the paint effect is used in a QgsEffectStack.
:return: draw mode for effect
.. seealso:: setDrawMode
:rtype: DrawMode
%End
/** Sets the draw mode for the effect. This property only has an
* effect if the paint effect is used in a @link QgsEffectStack @endlink
* @param drawMode draw mode for effect
* @see drawMode
*/
void setDrawMode( const DrawMode drawMode );
%Docstring
Sets the draw mode for the effect. This property only has an
effect if the paint effect is used in a QgsEffectStack.
\param drawMode draw mode for effect
.. seealso:: drawMode
%End
protected:
/** Handles drawing of the effect's result on to the specified render context.
* Derived classes must reimplement this method to apply any transformations to
* the source QPicture and draw the result using the context's painter.
* @param context destination render context
* @see drawSource
*/
virtual void draw( QgsRenderContext &context ) = 0;
%Docstring
Handles drawing of the effect's result on to the specified render context.
Derived classes must reimplement this method to apply any transformations to
the source QPicture and draw the result using the context's painter.
\param context destination render context
.. seealso:: drawSource
%End
/** Draws the source QPicture onto the specified painter. Handles scaling of the picture
* to account for the destination painter's DPI.
* @param painter destination painter
* @see source
* @see sourceAsImage
*/
void drawSource( QPainter &painter );
%Docstring
Draws the source QPicture onto the specified painter. Handles scaling of the picture
to account for the destination painter's DPI.
\param painter destination painter
.. seealso:: source
.. seealso:: sourceAsImage
%End
/** Returns the source QPicture. The @link draw @endlink member can utilize this when
* drawing the effect.
* @returns source QPicture
* @see drawSource
* @see sourceAsImage
*/
const QPicture *source() const;
%Docstring
Returns the source QPicture. The draw() member can utilize this when
drawing the effect.
:return: source QPicture
.. seealso:: drawSource
.. seealso:: sourceAsImage
:rtype: QPicture
%End
/** Returns the source QPicture rendered to a new QImage. The @link draw @endlink member can
* utilize this when drawing the effect. The image will be padded or cropped from the original
* source QPicture by the results of the @link boundingRect @endlink method.
* The result is cached to speed up subsequent calls to sourceAsImage.
* @returns source QPicture rendered to an image
* @see drawSource
* @see source
* @see imageOffset
* @see boundingRect
*/
QImage *sourceAsImage( QgsRenderContext &context );
%Docstring
Returns the source QPicture rendered to a new QImage. The draw() member can
utilize this when drawing the effect. The image will be padded or cropped from the original
source QPicture by the results of the boundingRect() method.
The result is cached to speed up subsequent calls to sourceAsImage.
:return: source QPicture rendered to an image
.. seealso:: drawSource
.. seealso:: source
.. seealso:: imageOffset
.. seealso:: boundingRect
:rtype: QImage
%End
/** Returns the offset which should be used when drawing the source image on to a destination
* render context.
* @param context destination render context
* @returns point offset for image top left corner
* @see sourceAsImage
*/
QPointF imageOffset( const QgsRenderContext &context ) const;
%Docstring
Returns the offset which should be used when drawing the source image on to a destination
render context.
\param context destination render context
:return: point offset for image top left corner
.. seealso:: sourceAsImage
:rtype: QPointF
%End
/** Returns the bounding rect required for drawing the effect. This method can be used
* to expand the bounding rect of a source picture to account for offset or blurring
* effects.
* @param rect original source bounding rect
* @param context destination render context
* @returns modified bounding rect
* @see sourceAsImage
*/
virtual QRectF boundingRect( const QRectF &rect, const QgsRenderContext &context ) const;
%Docstring
Returns the bounding rect required for drawing the effect. This method can be used
to expand the bounding rect of a source picture to account for offset or blurring
effects.
\param rect original source bounding rect
\param context destination render context
:return: modified bounding rect
.. seealso:: sourceAsImage
:rtype: QRectF
%End
/** Applies a workaround to a QPainter to avoid an issue with incorrect scaling
* when drawing QPictures. This may need to be called by derived classes prior
* to rendering results onto a painter.
* @param painter destination painter
*/
void fixQPictureDpi( QPainter *painter ) const;
%Docstring
Applies a workaround to a QPainter to avoid an issue with incorrect scaling
when drawing QPictures. This may need to be called by derived classes prior
to rendering results onto a painter.
\param painter destination painter
%End
};
/** \ingroup core
* \class QgsDrawSourceEffect
* \brief A paint effect which draws the source picture with minor or no alterations
*
* The draw source effect can be used to draw an unaltered copy of the original source
* picture. Minor changes like lowering the opacity and applying a blend mode are
* supported, however these changes will force the resultant output to be rasterized.
* If no alterations are performed then the original picture will be rendered as a vector.
*
* \note Added in version 2.9
*/
class QgsDrawSourceEffect : QgsPaintEffect
{
%TypeHeaderCode
#include <qgspainteffect.h>
%Docstring
A paint effect which draws the source picture with minor or no alterations
The draw source effect can be used to draw an unaltered copy of the original source
picture. Minor changes like lowering the opacity and applying a blend mode are
supported, however these changes will force the resultant output to be rasterized.
If no alterations are performed then the original picture will be rendered as a vector.
.. versionadded:: 2.9
%End
%TypeHeaderCode
#include "qgspainteffect.h"
%End
public:
QgsDrawSourceEffect();
virtual ~QgsDrawSourceEffect();
/** Creates a new QgsDrawSource effect from a properties string map.
* @param map encoded properties string map
* @returns new QgsDrawSourceEffect
*/
static QgsPaintEffect *create( const QgsStringMap &map ) /Factory/;
%Docstring
Creates a new QgsDrawSource effect from a properties string map.
\param map encoded properties string map
:return: new QgsDrawSourceEffect
:rtype: QgsPaintEffect
%End
virtual QString type() const;
virtual QgsDrawSourceEffect *clone() const /Factory/;
virtual QgsStringMap properties() const;
virtual void readProperties( const QgsStringMap &props );
/** 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 );
%Docstring
Sets the transparency for the effect
\param transparency double between 0 and 1 inclusive, where 0 is fully opaque
and 1 is fully transparent
.. seealso:: transparency
%End
/** 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;
%Docstring
Returns the transparency for the effect
:return: transparency value between 0 and 1 inclusive, where 0 is fully opaque
and 1 is fully transparent
.. seealso:: setTransparency
:rtype: float
%End
/** Sets the blend mode for the effect
* @param mode blend mode used for drawing the source on to a destination
* paint device
* @see blendMode
*/
void setBlendMode( const QPainter::CompositionMode mode );
%Docstring
Sets the blend mode for the effect
\param mode blend mode used for drawing the source on to a destination
paint device
.. seealso:: blendMode
%End
/** Returns the blend mode for the effect
* @returns blend mode used for drawing the source on to a destination
* paint device
* @see setBlendMode
*/
QPainter::CompositionMode blendMode() const;
%Docstring
Returns the blend mode for the effect
:return: blend mode used for drawing the source on to a destination
paint device
.. seealso:: setBlendMode
:rtype: QPainter.CompositionMode
%End
protected:
@ -309,33 +353,51 @@ class QgsDrawSourceEffect : QgsPaintEffect
class QgsEffectPainter
{
%Docstring
A class to manager painter saving and restoring required for effect drawing
.. versionadded:: 3.0
%End
%TypeHeaderCode
#include <qgspainteffect.h>
#include "qgspainteffect.h"
%End
public:
/**
* QgsEffectPainter constructor
*
* @param renderContext the QgsRenderContext object
* @note Added in QGIS 3.0
*/
QgsEffectPainter( QgsRenderContext &renderContext );
%Docstring
QgsEffectPainter constructor
\param renderContext the QgsRenderContext object
.. versionadded:: 3.0
%End
/**
* QgsEffectPainter constructor alternative if no painter translation is needed
*
* @param renderContext the QgsRenderContext object
* @param effect the QgsPaintEffect object
* @note Added in QGIS 3.0
*/
QgsEffectPainter( QgsRenderContext &renderContext, QgsPaintEffect *effect );
%Docstring
QgsEffectPainter constructor alternative if no painter translation is needed
\param renderContext the QgsRenderContext object
\param effect the QgsPaintEffect object
.. versionadded:: 3.0
%End
~QgsEffectPainter();
/**
* Sets the effect to be painted
*
* @param effect the QgsPaintEffect object
*/
void setEffect( QgsPaintEffect *effect );
%Docstring
Sets the effect to be painted
\param effect the QgsPaintEffect object
%End
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/effects/qgspainteffect.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/

View File

@ -1,125 +1,172 @@
class QgsPaintEffectWidget /External/;
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/effects/qgspainteffectregistry.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
/** \ingroup core
* \class QgsPaintEffectAbstractMetadata
* \brief Stores metadata about a paint effect class.
*
* \note It's necessary to implement the createPaintEffect() function.
* In C++ you can use the QgsPaintEffectMetadata convenience class to
* simplify creation of the metadata.
*
* \note Added in version 2.9
*/
class QgsPaintEffectAbstractMetadata
{
%TypeHeaderCode
#include <qgspainteffectregistry.h>
%Docstring
Stores metadata about a paint effect class.
.. note::
It's necessary to implement the createPaintEffect() function.
In C++ you can use the QgsPaintEffectMetadata convenience class to
simplify creation of the metadata.
.. versionadded:: 2.9
%End
%TypeHeaderCode
#include "qgspainteffectregistry.h"
%End
public:
/** Construct a new QgsPaintEffectAbstractMetadata
* @param name unique string representing paint effect class
* @param visibleName user visible name representing paint effect class
*/
QgsPaintEffectAbstractMetadata( const QString &name, const QString &visibleName );
%Docstring
Construct a new QgsPaintEffectAbstractMetadata
\param name unique string representing paint effect class
\param visibleName user visible name representing paint effect class
%End
virtual ~QgsPaintEffectAbstractMetadata();
/** Returns the unique string representing the paint effect class
* @returns unique string
* @see visibleName
*/
QString name() const;
%Docstring
Returns the unique string representing the paint effect class
:return: unique string
.. seealso:: visibleName
:rtype: str
%End
/** Returns the user visible string representing the paint effect class
* @returns friendly user visible string
* @see name
*/
QString visibleName() const;
%Docstring
Returns the user visible string representing the paint effect class
:return: friendly user visible string
.. seealso:: name
:rtype: str
%End
/** Create a paint effect of this class given an encoded map of properties.
* @param map properties string map
* @returns new paint effect
*/
virtual QgsPaintEffect *createPaintEffect( const QgsStringMap &map ) = 0 /Factory/;
%Docstring
Create a paint effect of this class given an encoded map of properties.
\param map properties string map
:return: new paint effect
:rtype: QgsPaintEffect
%End
/** Create configuration widget for paint effect of this class. Can return nullptr
* if there's no GUI for the paint effect class.
* @returns configuration widget
*/
virtual QgsPaintEffectWidget *createWidget() /Factory/;
%Docstring
Create configuration widget for paint effect of this class. Can return None
if there's no GUI for the paint effect class.
:return: configuration widget
:rtype: QgsPaintEffectWidget
%End
protected:
};
typedef QgsPaintEffect *( *QgsPaintEffectCreateFunc )( const QgsStringMap & );
typedef QgsPaintEffectWidget *( *QgsPaintEffectWidgetFunc )();
/** \ingroup core
* \class QgsPaintEffectRegistry
* \brief Singleton registry of available paint effects
*
* \note Added in version 2.9
*/
class QgsPaintEffectRegistry
{
%TypeHeaderCode
#include <qgspainteffectregistry.h>
%Docstring
Registry of available paint effects.
QgsPaintEffectRegistry is not usually directly created, but rather accessed through
QgsApplication.paintEffectRegistry().
.. versionadded:: 2.9
%End
%TypeHeaderCode
#include "qgspainteffectregistry.h"
%End
public:
QgsPaintEffectRegistry();
~QgsPaintEffectRegistry();
/** Returns the metadata for a specific effect.
* @param name unique string name for paint effect class
* @returns paint effect metadata if found, otherwise nullptr
*/
QgsPaintEffectAbstractMetadata *effectMetadata( const QString &name ) const;
%Docstring
Returns the metadata for a specific effect.
\param name unique string name for paint effect class
:return: paint effect metadata if found, otherwise None
:rtype: QgsPaintEffectAbstractMetadata
%End
/** Registers a new effect type.
* @param metadata effect metadata. Ownership is transferred to the registry.
* @returns true if add was successful.
*/
bool addEffectType( QgsPaintEffectAbstractMetadata *metadata /Transfer/ );
%Docstring
Registers a new effect type.
\param metadata effect metadata. Ownership is transferred to the registry.
:return: true if add was successful.
:rtype: bool
%End
/** Creates a new paint effect given the effect name and properties map.
* @param name unique name representing paint effect class
* @param properties encoded string map of effect properties
* @returns new paint effect of specified class, or nullptrif matching
* paint effect could not be created
*/
QgsPaintEffect *createEffect( const QString &name, const QgsStringMap &properties = QgsStringMap() ) const /Factory/;
%Docstring
Creates a new paint effect given the effect name and properties map.
\param name unique name representing paint effect class
\param properties encoded string map of effect properties
:return: new paint effect of specified class, or None if matching
paint effect could not be created
:rtype: QgsPaintEffect
%End
/** Creates a new paint effect given a DOM element storing paint effect
* properties.
* @param element encoded DOM element of effect properties
* @returns new paint effect, or nullptr if matching
* paint effect could not be created
*/
QgsPaintEffect *createEffect( const QDomElement &element ) const /Factory/;
%Docstring
Creates a new paint effect given a DOM element storing paint effect
properties.
\param element encoded DOM element of effect properties
:return: new paint effect, or None if matching
paint effect could not be created
:rtype: QgsPaintEffect
%End
/** Returns a list of known paint effects.
* @returns list of paint effect names
*/
QStringList effects() const;
%Docstring
Returns a list of known paint effects.
:return: list of paint effect names
:rtype: list of str
%End
/** Returns a new effect stack consisting of a sensible selection of default
* effects. All effects except the standard draw source effect are disabled,
* but are included so that they can be easily drawn just by enabling the effect.
* @returns default effects stack
* @see isDefaultStack()
*/
static QgsPaintEffect *defaultStack() /Factory/;
%Docstring
Returns a new effect stack consisting of a sensible selection of default
effects. All effects except the standard draw source effect are disabled,
but are included so that they can be easily drawn just by enabling the effect.
:return: default effects stack
.. seealso:: isDefaultStack()
:rtype: QgsPaintEffect
%End
/** Tests whether a paint effect matches the default effects stack.
* @param effect paint effect to test
* @returns true if effect is default stack
* @note added in QGIS 2.12
* @see defaultStack()
*/
static bool isDefaultStack( QgsPaintEffect *effect );
%Docstring
Tests whether a paint effect matches the default effects stack.
\param effect paint effect to test
:return: true if effect is default stack
.. versionadded:: 2.12
.. seealso:: defaultStack()
:rtype: bool
%End
private:
QgsPaintEffectRegistry( const QgsPaintEffectRegistry &rh );
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/effects/qgspainteffectregistry.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/

View File

@ -1,177 +1,212 @@
/** \ingroup core
* \class QgsShadowEffect
* \brief Base class for paint effects which offset, blurred shadows
*
* \note Added in version 2.9
*/
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/effects/qgsshadoweffect.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsShadowEffect : QgsPaintEffect
{
%TypeHeaderCode
#include <qgsshadoweffect.h>
%Docstring
Base class for paint effects which offset, blurred shadows
.. versionadded:: 2.9
%End
%TypeHeaderCode
#include "qgsshadoweffect.h"
%End
public:
QgsShadowEffect();
virtual ~QgsShadowEffect();
virtual QgsStringMap properties() const;
virtual void readProperties( const QgsStringMap &props );
/** Sets blur level (strength) for the shadow.
* @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 );
%Docstring
Sets blur level (strength) for the shadow.
\param level blur level. Values between 0 and 16 are valid, with larger
values indicating greater blur strength.
.. seealso:: blurLevel
%End
/** Returns the blur level (strength) for the shadow.
* @returns blur level. Value will be between 0 and 16, with larger
* values indicating greater blur strength.
* @see setBlurLevel
*/
int blurLevel() const;
%Docstring
Returns the blur level (strength) for the shadow.
:return: blur level. Value will be between 0 and 16, with larger
values indicating greater blur strength.
.. seealso:: setBlurLevel
:rtype: int
%End
/** Sets the angle for offsetting the shadow.
* @param angle offset angle in degrees clockwise from North
* @see offsetAngle
* @see setOffsetDistance
*/
void setOffsetAngle( const int angle );
%Docstring
Sets the angle for offsetting the shadow.
\param angle offset angle in degrees clockwise from North
.. seealso:: offsetAngle
.. seealso:: setOffsetDistance
%End
/** Returns the angle used for offsetting the shadow.
* @returns offset angle in degrees clockwise from North
* @see setOffsetAngle
* @see offsetDistance
*/
int offsetAngle() const;
%Docstring
Returns the angle used for offsetting the shadow.
:return: offset angle in degrees clockwise from North
.. seealso:: setOffsetAngle
.. seealso:: offsetDistance
:rtype: int
%End
/** Sets the distance for offsetting the shadow.
* @param distance offset distance. Units are specified via @link setOffsetUnit @endlink
* @see offsetDistance
* @see setOffsetUnit
* @see setOffsetMapUnitScale
*/
void setOffsetDistance( const double distance );
%Docstring
Sets the distance for offsetting the shadow.
\param distance offset distance. Units are specified via setOffsetUnit()
.. seealso:: offsetDistance
.. seealso:: setOffsetUnit
.. seealso:: setOffsetMapUnitScale
%End
/** Returns the distance used for offsetting the shadow.
* @returns offset distance. Distance units are retrieved via @link offsetUnit @endlink
* @see setOffsetDistance
* @see offsetUnit
* @see offsetMapUnitScale
*/
double offsetDistance() const;
%Docstring
Returns the distance used for offsetting the shadow.
:return: offset distance. Distance units are retrieved via offsetUnit()
.. seealso:: setOffsetDistance
.. seealso:: offsetUnit
.. seealso:: offsetMapUnitScale
:rtype: float
%End
/** Sets the units used for the shadow offset distance.
* @param unit units for offset distance
* @see offsetUnit
* @see setOffsetDistance
* @see setOffsetMapUnitScale
*/
void setOffsetUnit( const QgsUnitTypes::RenderUnit unit );
%Docstring
Sets the units used for the shadow offset distance.
\param unit units for offset distance
.. seealso:: offsetUnit
.. seealso:: setOffsetDistance
.. seealso:: setOffsetMapUnitScale
%End
/** Returns the units used for the shadow offset distance.
* @returns units for offset distance
* @see setOffsetUnit
* @see offsetDistance
* @see offsetMapUnitScale
*/
QgsUnitTypes::RenderUnit offsetUnit() const;
%Docstring
Returns the units used for the shadow offset distance.
:return: units for offset distance
.. seealso:: setOffsetUnit
.. seealso:: offsetDistance
.. seealso:: offsetMapUnitScale
:rtype: QgsUnitTypes.RenderUnit
%End
/** Sets the map unit scale used for the shadow offset distance.
* @param scale map unit scale for offset distance
* @see offsetMapUnitScale
* @see setOffsetDistance
* @see setOffsetUnit
*/
void setOffsetMapUnitScale( const QgsMapUnitScale &scale );
%Docstring
Sets the map unit scale used for the shadow offset distance.
\param scale map unit scale for offset distance
.. seealso:: offsetMapUnitScale
.. seealso:: setOffsetDistance
.. seealso:: setOffsetUnit
%End
/** Returns the map unit scale used for the shadow offset distance.
* @returns map unit scale for offset distance
* @see setOffsetMapUnitScale
* @see offsetDistance
* @see offsetUnit
*/
const QgsMapUnitScale &offsetMapUnitScale() const;
%Docstring
Returns the map unit scale used for the shadow offset distance.
:return: map unit scale for offset distance
.. seealso:: setOffsetMapUnitScale
.. seealso:: offsetDistance
.. seealso:: offsetUnit
:rtype: QgsMapUnitScale
%End
/** Sets the color for the shadow.
* @param color shadow color
* @see color
*/
void setColor( const QColor &color );
%Docstring
Sets the color for the shadow.
\param color shadow color
.. seealso:: color
%End
/** Returns the color used for the shadow.
* @returns shadow color
* @see setColor
*/
QColor color() const;
%Docstring
Returns the color used for the shadow.
:return: shadow color
.. seealso:: setColor
:rtype: QColor
%End
/** 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 );
%Docstring
Sets the transparency for the effect
\param transparency double between 0 and 1 inclusive, where 0 is fully opaque
and 1 is fully transparent
.. seealso:: transparency
%End
/** 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;
%Docstring
Returns the transparency for the effect
:return: transparency value between 0 and 1 inclusive, where 0 is fully opaque
and 1 is fully transparent
.. seealso:: setTransparency
:rtype: float
%End
/** 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 );
%Docstring
Sets the blend mode for the effect
\param mode blend mode used for drawing the effect on to a destination
paint device
.. seealso:: blendMode
%End
/** 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;
%Docstring
Returns the blend mode for the effect
:return: blend mode used for drawing the effect on to a destination
paint device
.. seealso:: setBlendMode
:rtype: QPainter.CompositionMode
%End
protected:
virtual QRectF boundingRect( const QRectF &rect, const QgsRenderContext &context ) const;
virtual void draw( QgsRenderContext &context );
/** Specifies whether the shadow is drawn outside the picture or within
* the picture.
* @returns true if shadow is to be drawn outside the picture, or false
* to draw shadow within the picture
*/
virtual bool exteriorShadow() const = 0;
%Docstring
Specifies whether the shadow is drawn outside the picture or within
the picture.
:return: true if shadow is to be drawn outside the picture, or false
to draw shadow within the picture
:rtype: bool
%End
};
/** \ingroup core
* \class QgsDropShadowEffect
* \brief A paint effect which draws an offset and optionally blurred drop shadow
*
* \note Added in version 2.9
*/
class QgsDropShadowEffect : QgsShadowEffect
{
%TypeHeaderCode
#include <qgsshadoweffect.h>
%Docstring
A paint effect which draws an offset and optionally blurred drop shadow
.. versionadded:: 2.9
%End
%TypeHeaderCode
#include "qgsshadoweffect.h"
%End
public:
/** Creates a new QgsDropShadowEffect effect from a properties string map.
* @param map encoded properties string map
* @returns new QgsDropShadowEffect
*/
static QgsPaintEffect *create( const QgsStringMap &map ) /Factory/;
%Docstring
Creates a new QgsDropShadowEffect effect from a properties string map.
\param map encoded properties string map
:return: new QgsDropShadowEffect
:rtype: QgsPaintEffect
%End
QgsDropShadowEffect();
virtual ~QgsDropShadowEffect();
virtual QString type() const;
virtual QgsDropShadowEffect *clone() const /Factory/;
@ -182,29 +217,29 @@ class QgsDropShadowEffect : QgsShadowEffect
};
/** \ingroup core
* \class QgsInnerShadowEffect
* \brief A paint effect which draws an offset and optionally blurred drop shadow
* within a picture.
*
* \note Added in version 2.9
*/
class QgsInnerShadowEffect : QgsShadowEffect
{
%TypeHeaderCode
#include <qgsshadoweffect.h>
%Docstring
A paint effect which draws an offset and optionally blurred drop shadow
within a picture.
.. versionadded:: 2.9
%End
%TypeHeaderCode
#include "qgsshadoweffect.h"
%End
public:
/** Creates a new QgsInnerShadowEffect effect from a properties string map.
* @param map encoded properties string map
* @returns new QgsInnerShadowEffect
*/
static QgsPaintEffect *create( const QgsStringMap &map ) /Factory/;
%Docstring
Creates a new QgsInnerShadowEffect effect from a properties string map.
\param map encoded properties string map
:return: new QgsInnerShadowEffect
:rtype: QgsPaintEffect
%End
QgsInnerShadowEffect();
virtual ~QgsInnerShadowEffect();
virtual QString type() const;
virtual QgsInnerShadowEffect *clone() const /Factory/;
@ -214,3 +249,12 @@ class QgsInnerShadowEffect : QgsShadowEffect
virtual bool exteriorShadow() const;
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/effects/qgsshadoweffect.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/

View File

@ -1,199 +1,242 @@
/** \ingroup core
* \class QgsTransformEffect
* \brief A paint effect which applies transformations (such as move,
* scale and rotate) to a picture.
*
* \note Added in version 2.9
*/
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/effects/qgstransformeffect.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsTransformEffect : QgsPaintEffect
{
%TypeHeaderCode
#include <qgstransformeffect.h>
%Docstring
A paint effect which applies transformations (such as move,
scale and rotate) to a picture.
.. versionadded:: 2.9
%End
%TypeHeaderCode
#include "qgstransformeffect.h"
%End
public:
/** Creates a new QgsTransformEffect effect from a properties string map.
* @param map encoded properties string map
* @returns new QgsTransformEffect
*/
static QgsPaintEffect *create( const QgsStringMap &map ) /Factory/;
%Docstring
Creates a new QgsTransformEffect effect from a properties string map.
\param map encoded properties string map
:return: new QgsTransformEffect
:rtype: QgsPaintEffect
%End
QgsTransformEffect();
virtual ~QgsTransformEffect();
virtual QString type() const;
virtual QgsStringMap properties() const;
virtual void readProperties( const QgsStringMap &props );
virtual QgsTransformEffect *clone() const /Factory/;
/** Sets the transform x translation.
* @param translateX distance to translate along the x axis
* @see translateX
* @see setTranslateY
* @see setTranslateUnit
* @see setTranslateMapUnitScale
*/
void setTranslateX( const double translateX );
%Docstring
Sets the transform x translation.
\param translateX distance to translate along the x axis
.. seealso:: translateX
.. seealso:: setTranslateY
.. seealso:: setTranslateUnit
.. seealso:: setTranslateMapUnitScale
%End
/** Returns the transform x translation.
* @returns X distance translated along the x axis
* @see setTranslateX
* @see translateY
* @see translateUnit
* @see translateMapUnitScale
*/
double translateX() const;
%Docstring
Returns the transform x translation.
:return: X distance translated along the x axis
.. seealso:: setTranslateX
.. seealso:: translateY
.. seealso:: translateUnit
.. seealso:: translateMapUnitScale
:rtype: float
%End
/** Sets the transform y translation.
* @param translateY distance to translate along the y axis
* @see translateY
* @see setTranslateX
* @see setTranslateUnit
* @see setTranslateMapUnitScale
*/
void setTranslateY( const double translateY );
%Docstring
Sets the transform y translation.
\param translateY distance to translate along the y axis
.. seealso:: translateY
.. seealso:: setTranslateX
.. seealso:: setTranslateUnit
.. seealso:: setTranslateMapUnitScale
%End
/** Returns the transform y translation.
* @returns Y distance translated along the y axis
* @see setTranslateY
* @see translateX
* @see translateUnit
* @see translateMapUnitScale
*/
double translateY() const;
%Docstring
Returns the transform y translation.
:return: Y distance translated along the y axis
.. seealso:: setTranslateY
.. seealso:: translateX
.. seealso:: translateUnit
.. seealso:: translateMapUnitScale
:rtype: float
%End
/** Sets the units used for the transform translation.
* @param unit units for translation
* @see translateUnit
* @see setTranslateX
* @see setTranslateY
* @see setTranslateMapUnitScale
*/
void setTranslateUnit( const QgsUnitTypes::RenderUnit unit );
%Docstring
Sets the units used for the transform translation.
\param unit units for translation
.. seealso:: translateUnit
.. seealso:: setTranslateX
.. seealso:: setTranslateY
.. seealso:: setTranslateMapUnitScale
%End
/** Returns the units used for the transform translation.
* @returns units for translation
* @see setTranslateUnit
* @see translateX
* @see translateY
* @see translateMapUnitScale
*/
QgsUnitTypes::RenderUnit translateUnit() const;
%Docstring
Returns the units used for the transform translation.
:return: units for translation
.. seealso:: setTranslateUnit
.. seealso:: translateX
.. seealso:: translateY
.. seealso:: translateMapUnitScale
:rtype: QgsUnitTypes.RenderUnit
%End
/** Sets the map unit scale used for the transform translation.
* @param scale map unit scale for translation
* @see translateMapUnitScale
* @see setTranslateX
* @see setTranslateY
* @see setTranslateUnit
*/
void setTranslateMapUnitScale( const QgsMapUnitScale &scale );
%Docstring
Sets the map unit scale used for the transform translation.
\param scale map unit scale for translation
.. seealso:: translateMapUnitScale
.. seealso:: setTranslateX
.. seealso:: setTranslateY
.. seealso:: setTranslateUnit
%End
/** Returns the map unit scale used for the transform translation.
* @returns map unit scale for translation
* @see setTranslateMapUnitScale
* @see translateX
* @see translateY
* @see translateUnit
*/
const QgsMapUnitScale &translateMapUnitScale() const;
%Docstring
Returns the map unit scale used for the transform translation.
:return: map unit scale for translation
.. seealso:: setTranslateMapUnitScale
.. seealso:: translateX
.. seealso:: translateY
.. seealso:: translateUnit
:rtype: QgsMapUnitScale
%End
/** Sets the x axis scaling factor.
* @param scaleX factor to scale x axis by, where 1.0 = no scaling
* @see scaleX
* @see setScaleY
*/
void setScaleX( const double scaleX );
%Docstring
Sets the x axis scaling factor.
\param scaleX factor to scale x axis by, where 1.0 = no scaling
.. seealso:: scaleX
.. seealso:: setScaleY
%End
/** Returns the x axis scaling factor.
* @returns x axis scaling factor, where 1.0 = no scaling
* @see setScaleX
* @see scaleY
*/
double scaleX() const;
%Docstring
Returns the x axis scaling factor.
:return: x axis scaling factor, where 1.0 = no scaling
.. seealso:: setScaleX
.. seealso:: scaleY
:rtype: float
%End
/** Sets the y axis scaling factor.
* @param scaleY factor to scale y axis by, where 1.0 = no scaling
* @see scaleX
*/
void setScaleY( const double scaleY );
%Docstring
Sets the y axis scaling factor.
\param scaleY factor to scale y axis by, where 1.0 = no scaling
.. seealso:: scaleX
%End
/** Returns the y axis scaling factor.
* @returns y axis scaling factor, where 1.0 = no scaling
* @see setScaleY
* @see scaleX
*/
double scaleY() const;
%Docstring
Returns the y axis scaling factor.
:return: y axis scaling factor, where 1.0 = no scaling
.. seealso:: setScaleY
.. seealso:: scaleX
:rtype: float
%End
/** Sets the transform rotation.
* @param rotation degrees to rotate, clockwise
* @see rotation
*/
void setRotation( const double rotation );
%Docstring
Sets the transform rotation.
\param rotation degrees to rotate, clockwise
.. seealso:: rotation
%End
/** Returns the transform rotation.
* @returns rotation in degrees clockwise
* @see setRotation
*/
double rotation() const;
%Docstring
Returns the transform rotation.
:return: rotation in degrees clockwise
.. seealso:: setRotation
:rtype: float
%End
/** Sets the x axis shearing factor.
* @param shearX x axis shearing
* @see shearX
* @see setShearY
*/
void setShearX( const double shearX );
%Docstring
Sets the x axis shearing factor.
\param shearX x axis shearing
.. seealso:: shearX
.. seealso:: setShearY
%End
/** Returns the x axis shearing factor.
* @returns x axis shearing
* @see setShearX
* @see shearY
*/
double shearX() const;
%Docstring
Returns the x axis shearing factor.
:return: x axis shearing
.. seealso:: setShearX
.. seealso:: shearY
:rtype: float
%End
/** Sets the y axis shearing factor.
* @param shearY y axis shearing
* @see shearY
* @see setShearX
*/
void setShearY( const double shearY );
%Docstring
Sets the y axis shearing factor.
\param shearY y axis shearing
.. seealso:: shearY
.. seealso:: setShearX
%End
/** Returns the y axis shearing factor.
* @returns y axis shearing
* @see setShearY
* @see shearX
*/
double shearY() const;
%Docstring
Returns the y axis shearing factor.
:return: y axis shearing
.. seealso:: setShearY
.. seealso:: shearX
:rtype: float
%End
/** Sets whether to reflect along the x-axis
* @param reflectX true to reflect horizontally
* @see reflectX
* @see setReflectY
*/
void setReflectX( const bool reflectX );
%Docstring
Sets whether to reflect along the x-axis
\param reflectX true to reflect horizontally
.. seealso:: reflectX
.. seealso:: setReflectY
%End
/** Returns whether transform will be reflected along the x-axis
* @returns true if transform will reflect horizontally
* @see setReflectX
* @see reflectY
*/
bool reflectX() const;
%Docstring
Returns whether transform will be reflected along the x-axis
:return: true if transform will reflect horizontally
.. seealso:: setReflectX
.. seealso:: reflectY
:rtype: bool
%End
/** Sets whether to reflect along the y-axis
* @param reflectY true to reflect horizontally
* @see reflectY
* @see setReflectX
*/
void setReflectY( const bool reflectY );
%Docstring
Sets whether to reflect along the y-axis
\param reflectY true to reflect horizontally
.. seealso:: reflectY
.. seealso:: setReflectX
%End
/** Returns whether transform will be reflected along the y-axis
* @returns true if transform will reflect horizontally
* @see setReflectY
* @see reflectX
*/
bool reflectY() const;
%Docstring
Returns whether transform will be reflected along the y-axis
:return: true if transform will reflect horizontally
.. seealso:: setReflectY
.. seealso:: reflectX
:rtype: bool
%End
protected:
@ -201,3 +244,12 @@ class QgsTransformEffect : QgsPaintEffect
virtual QRectF boundingRect( const QRectF &rect, const QgsRenderContext &context ) const;
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/effects/qgstransformeffect.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/

View File

@ -82,7 +82,7 @@ class CORE_EXPORT QgsEffectStack : public QgsPaintEffect
* transferred to the stack object.
* \see insertEffect
*/
void appendEffect( QgsPaintEffect *effect );
void appendEffect( QgsPaintEffect *effect SIP_TRANSFER );
/** Inserts an effect at a specified index within the stack.
* \param index position to insert the effect
@ -90,19 +90,19 @@ class CORE_EXPORT QgsEffectStack : public QgsPaintEffect
* transferred to the stack object.
* \see appendEffect
*/
bool insertEffect( const int index, QgsPaintEffect *effect );
bool insertEffect( const int index, QgsPaintEffect *effect SIP_TRANSFER );
/** Replaces the effect at a specified position within the stack.
* \param index position of effect to replace
* \param effect QgsPaintEffect to replace with. Ownership of the effect will be
* transferred to the stack object.
*/
bool changeEffect( const int index, QgsPaintEffect *effect );
bool changeEffect( const int index, QgsPaintEffect *effect SIP_TRANSFER );
/** Removes an effect from the stack and returns a pointer to it.
* \param index position of effect to take
*/
QgsPaintEffect *takeEffect( const int index );
QgsPaintEffect *takeEffect( const int index SIP_TRANSFERBACK );
/** Returns a pointer to the list of effects currently contained by
* the stack

View File

@ -141,7 +141,7 @@ class CORE_EXPORT QgsImageOperation
* \param properties DistanceTransformProperties object with parameters
* for the distance transform operation
*/
static void distanceTransform( QImage &image, const DistanceTransformProperties &properties );
static void distanceTransform( QImage &image, const QgsImageOperation::DistanceTransformProperties &properties );
/** Performs a stack blur on an image. Stack blur represents a good balance between
* speed and blur quality.

View File

@ -51,6 +51,47 @@ class QgsRenderContext;
class CORE_EXPORT QgsPaintEffect
{
#ifdef SIP_RUN
SIP_CONVERT_TO_SUBCLASS_CODE
if ( sipCpp->type() == "drawSource" && dynamic_cast<QgsDrawSourceEffect *>( sipCpp ) != NULL )
{
sipType = sipType_QgsDrawSourceEffect;
}
else if ( sipCpp->type() == "effectStack" && dynamic_cast<QgsEffectStack *>( sipCpp ) != NULL )
{
sipType = sipType_QgsEffectStack;
}
else if ( sipCpp->type() == "blur" && dynamic_cast<QgsBlurEffect *>( sipCpp ) != NULL )
{
sipType = sipType_QgsBlurEffect;
}
else if ( sipCpp->type() == "dropShadow" && dynamic_cast<QgsDropShadowEffect *>( sipCpp ) != NULL )
{
sipType = sipType_QgsDropShadowEffect;
}
else if ( sipCpp->type() == "outerGlow" && dynamic_cast<QgsOuterGlowEffect *>( sipCpp ) != NULL )
{
sipType = sipType_QgsOuterGlowEffect;
}
else if ( sipCpp->type() == "innerGlow" && dynamic_cast<QgsInnerGlowEffect *>( sipCpp ) != NULL )
{
sipType = sipType_QgsInnerGlowEffect;
}
else if ( sipCpp->type() == "transform" && dynamic_cast<QgsTransformEffect *>( sipCpp ) != NULL )
{
sipType = sipType_QgsTransformEffect;
}
else if ( sipCpp->type() == "color" && dynamic_cast<QgsColorEffect *>( sipCpp ) != NULL )
{
sipType = sipType_QgsColorEffect;
}
else
{
sipType = 0;
}
SIP_END
#endif
public:
/** Drawing modes for effects. These modes are used only when effects are

View File

@ -85,8 +85,9 @@ typedef QgsPaintEffectWidget *( *QgsPaintEffectWidgetFunc )();
* \brief Convenience metadata class that uses static functions to create an effect and its widget.
*
* \since QGIS 2.9
* \note not available in Python bindings
*/
class CORE_EXPORT QgsPaintEffectMetadata : public QgsPaintEffectAbstractMetadata
class CORE_EXPORT QgsPaintEffectMetadata : public QgsPaintEffectAbstractMetadata SIP_SKIP
{
public: