Stellarium  1.2
Public Member Functions | Protected Attributes
ScreenImage Class Reference

Public Member Functions

 ScreenImage (const QString &filename, qreal x, qreal y, bool show=false, qreal scale=1., qreal alpha=1., float fadeDuration=1.)
 Load an image. More...
 
virtual bool draw (const StelCore *core)
 Draw the image. More...
 
virtual void update (double deltaTime)
 Empty dummy. The various animations are updated by other means.
 
virtual void setFadeDuration (float duration)
 Set the duration used for the fade in / fade out of the image.
 
virtual void setFlagShow (bool b)
 Show or hide the image (it will fade in/out) More...
 
virtual bool getFlagShow (void) const
 Get the display status of the image.
 
virtual void setAlpha (qreal a)
 Set the image alpha for when it is in full "on" (after fade in). More...
 
virtual void setXY (qreal x, qreal y, float duration=0.)
 Set the x, y position of the image. More...
 
virtual void addXY (qreal x, qreal y, float duration=0.)
 Set the x, y position of the image relative to the current position. More...
 
virtual int imageHeight (void) const
 
virtual int imageWidth (void) const
 
virtual void setScale (qreal scale)
 Set the image scale relative to the size originally loaded. More...
 
virtual void setScale (qreal scaleX, qreal scaleY, float duration=0.)
 Set the image scale relative to the size originally loaded. More...
 
virtual qreal imageScaleX (void) const
 
virtual qreal imageScaleY (void) const
 

Protected Attributes

QGraphicsPixmapItem * tex
 
QTimeLine * moveTimer
 
QTimeLine * fadeTimer
 
QTimeLine * scaleTimer
 
QGraphicsItemAnimation * anim
 
QGraphicsItemAnimation * scaleAnim
 

Constructor & Destructor Documentation

◆ ScreenImage()

ScreenImage::ScreenImage ( const QString &  filename,
qreal  x,
qreal  y,
bool  show = false,
qreal  scale = 1.,
qreal  alpha = 1.,
float  fadeDuration = 1. 
)
Parameters
filenamethe partial path of the file to load. This will be searched for in the scripts directory using StelFileMgr.
xthe screen x-position for the texture (in pixels), measured from the left side of the screen.
ythe screen x-position for the texture (in pixels), measured from the top of the screen.
showthe initial display status of the image (false == hidden).
scalescale factor for the image. 1 = original size, 0.5 = 50% size etc. Note that this also controls the final resolution of the image! Scale smaller that 1 leads to reduced resolution, larger than 1 of course creates upsampling artifacts. The scaling that happens after loading is a simple stretch of this loaded pixmap. In order to get a small image on screen which you might want to grow later, load with this scale=1 and setScale() later.
fadeDurationthe time it takes for screen images to fade in/out/change alpha in seconds.

Member Function Documentation

◆ addXY()

virtual void ScreenImage::addXY ( qreal  x,
qreal  y,
float  duration = 0. 
)
virtual
Parameters
xthe offset in the x-axis
ythe offset in the y-axis
durationhow long for the movement to take in seconds

◆ draw()

virtual bool ScreenImage::draw ( const StelCore core)
virtual
Parameters
corethe StelCore object

◆ setAlpha()

virtual void ScreenImage::setAlpha ( qreal  a)
virtual
Parameters
athe new alpha (transparency) for the image. 1.0 = totally transparent, 0.0 = fully opaque.
durationthe time for the change in alpha to take effect.

◆ setFlagShow()

virtual void ScreenImage::setFlagShow ( bool  b)
virtual
Parameters
bif true, the image will be shown, else it will be hidden

◆ setScale() [1/2]

virtual void ScreenImage::setScale ( qreal  scale)
virtual
Parameters
scalenew (target) horizontal and vertical scale factor. Native size=1.

◆ setScale() [2/2]

virtual void ScreenImage::setScale ( qreal  scaleX,
qreal  scaleY,
float  duration = 0. 
)
virtual
Parameters
scaleXnew (target) horizontal scale factor. Native size=1.
scaleYnew (target) vertical scale factor. Native size=1.
durationhow long for the resize to take in seconds

◆ setXY()

virtual void ScreenImage::setXY ( qreal  x,
qreal  y,
float  duration = 0. 
)
virtual
Parameters
xnew x position
ynew y position
durationhow long for the movement to take in seconds