Das AKtion Handbuch
Zurück |  | Vor

# KXAnim

## Name

KXAnimChildren -- Ein XAnim-Wrapper, damit Sie das Abspielen von Videos in Ihre Anwendungen integrieren können.

## Synopsis

    Public Members

          KXAnim (QWidget *parent, const char *name=0)
          ~KXAnim ()
          void setFile (QString file)
          void setAutoResize (bool val)
          bool getAutoResize ()
          void updateSize ()
          void setLoop (bool val)
          bool getLoop ()
          QString getVideoFileName ()
          int getVideoHeight ()
          int getVideoWidth ()
          float getVideoSpeed ()
          int getVideoFrames ()
          QString getVideoCodec ()
          QString getErrorCode ()
          QString getErrorString ()
          bool isPlaying ()
          bool isActive ()
          void resetXAnimDefaults ()
          void setAudio (bool val)
          void setAudioSync (bool val)
          void setInitialVolume (int val)
          enum colorMap { static332, lookupTable, grayScale, none }
          void setColorMapping (colorMap val)
          void setColorAhead (int val)
          void setGammaDisplay (float val)
          void setResizing (bool val)
          void setScaleFactor (float val)
          void setScaleHFactor (float val)
          void setScaleVFactor (float val)
          void setScaleWidth (int val)
          void setScaleHeight (int val)
          void setScaleDisplayToBuffer (bool val)
          void setScaleFactorB (float val)
          void setScaleHFactorB (float val)
          void setScaleVFactorB (float val)
          void setScaleWidthB (int val)
          void setScaleHeightB (int val)
          void setScaleBufferToDisplay (bool val)
          void setLoading (int val)
          void setX11Shared (bool val)
          void setMultiBuffer (bool val)
          void setUsePixmap (bool val)
          void setX11VisualClass ( const char *val)
          void setPauseAt (int val)
          void setExtraParameters (const char *val)
          void setExecutable (const char *val)

    Public Slots

          void play ()
          void pause ()
          void stop ()
          void stepForward ()
          void stepBack ()
          void stepForwardWA ()
          void stepBackWA ()
          void toggleSound ()
          void volumeIncrement ()
          void volumeDecrement ()
          void setVolume (int v)
          void faster ()
          void slower ()
          void resetSpeed ()

    Protected Members

          void changeProperty ( const char * c)
          virtual void closeEvent ( QCloseEvent *)
          virtual void mousePressEvent ( QMouseEvent *)

    Signals

          void stopped ()
          void mouseClick ( QMouseEvent *)

## Detailed Description of `KXAnim`

#include <kxanim.h>

Inherits: `QWidget`

Widget class for video playing

This widget is an xanim wrapper to easily allow the video playing on your applications.

``KXAnim`(QWidget *parent, const char *name=0);`

[public]

  Constructor. The parent argument is NOT optional.

``void setFile`(QString file);`

[public]

  Use this method to tell the player the name of the file to play. The file will not start to play until you call the `play()` slot. You need to call `stop()` before you can set a new filename.

  After call this method, you should wait for an stopped signal. Just then, the information about the file will be available.

  Also check for KXAnim::getErrorNumber and `getErrorString` to know if there was some error.

``void setAutoResize`(bool `val`);`

[public]

  If `val`==true, the widget will resize by himself after the `setFile()` to fit to the size of the video. If `val`==false, the video size will be adjusted to fit to the widget size.

  The size of the widget is automatically updated by `setFile` and play But if you need to know the effective size of the widget *before* you call `play`, you need to call `updateSize` manually.

  Default is true

``bool getAutoResize`();`

[public]

  Returns the auto-resize state (see `setAutoResize` ).

``void updateSize`();`

[public]

  Updates the widget size to fit video size (taking care of the scale factors that applies). See `setAutoResize` .

``void setLoop`(bool `val`);`

[public]

  If `val`==true, the video will loop forever.

  Default is true

``bool getLoop`();`

[public]

  Returns the loop state ( see `setLoop` ).

``QString getVideoFileName`();`

[public]

  Returns the current video file name (or an empty string, if there's no video yet).

``int getVideoHeight`();`

[public]

  Returns the video height (in pixels).

``int getVideoWidth`();`

[public]

  Returns the video height (in pixels).

``float getVideoSpeed`();`

[public]

  Returns the video playback speed (in frames per second).

``int getVideoFrames`();`

[public]

  Returns the number of frames in the video.

``QString getVideoCodec`();`

[public]

  Returns the string that describes the video codec.

``QString getErrorCode`();`

[public]

  Returns the the error code number. You should check this number after a `setFile`. If the code is zero , the there were no errors. To get a string containing a description see `getErrorCode`.

``QString getErrorString`();`

[public]

  Returns the string that describes the error during `setFile`.

``bool isPlaying`();`

[public]

  Returns true is the video is in play mode. Otherwise it returns false.

``bool isActive`();`

[public]

  Returns true is the video is active. Otherwise it returns false. The widget is NOT Active only when it's stopped. Therefore, you can use this method to check if the video is REALLY stopped.

``void resetXAnimDefaults`();`

[public]

  This method reset all the configuration parameters to their default values.

``void setAudio`(bool val);`

[public]

  If `val`==true, enables sound output.

  Default is true

``void setAudioSync`(bool val);`

[public]

  If `val`==true, allows xanim skip video frames for audio sync.

  Default is true

``void setInitialVolume`(int val);`

[public]

  Sets the initial audio volume.

  Default is 40

enum colorMap ( static332, lookupTable, grayScale, none ) [public]

  See setColorMapping .

``void setColorMapping`(colorMap val);`

[public]

  Tells `KXAnim` which type of color mapping to use for non truecolor displays.

  If `val`==KXAnim::static322, xanim will convert truecolor anims to static322.

  If `val`==KXAnim::lookupTable, xanim will sample the color of truecolor animations ahead of time and forms a color lookup table.

  If `val`==KXAnim::grayScale, xanim will convert TrueColor animations to gray scale.

  Those three option are ignored for TrueColor and DirectColor displays.

  if `val`==KXAnim::none, xanim will use the default color mapping.

  Default is KXAnim::none

``void setColorAhead`(int val);`

[public]

  This sets the number of frames ahead to use for the look up table when using KXAnim::lookupTable in `setColorMapping`.

  Default is 5

``void setGammaDisplay`(float val);`

[public]

  Set gamma of display. Gamma's greater than 1.0 typically brighten the animation.

  Default is 1.0

``void setResizing`(bool val);`

[public]

  If `val`==true, the video size can be changed "on the fly".

  Default is true

``void setScaleFactor`(float val);`

[public]

  Scale the size of anim by "`val`" before displaying.

  Default is 1.0 (no scaling)

``void setScaleHFactor`(float val);`

[public]

  Scale the horizontal size of anim by "`val`" before displaying.

  Default is 1.0 (no scaling)

``void setScaleVFactor`(float val);`

[public]

  Scale the vertical size of anim by "`val`" before displaying.

  Default is 1.0 (no scaling)

``void setScaleWidth`(int val);`

[public]

  Scale the animation to have width "`val`" before displaying.

  Default is 0 (no scaling)

``void setScaleHeight`(int val);`

[public]

  Scale the animation to have height "`val`" before displaying.

  Default is 0 (no scaling)

``void setScaleDisplayToBuffer`(bool val);`

[public]

  Copy display scaling factors to buffering scaling factors.

  Default is false.

``void setScaleFactorB`(float val);`

[public]

  Scale the size of anim by "`val`" before buffering it.

  Default is 1.0 (no scaling)

``void setScaleHFactorB`(float val);`

[public]

  Scale the horizontal size of anim by "`val`" before buffering it.

  Default is 1.0 (no scaling)

``void setScaleVFactorB`(float val);`

[public]

  Scale the vertical size of anim by "`val`" before buffering it.

  Default is 1.0 (no scaling)

``void setScaleWidthB`(int val);`

[public]

  Scale the animation to have width "`val`" before buffering it.

  Default is 0 (no scaling)

``void setScaleHeightB`(int val);`

[public]

  Scale the animation to have height "`val`" before buffering it.

  Default is 0 (no scaling)

``void setScaleBufferToDisplay`(bool val);`

[public]

  Copy buffering scaling factors to display scaling factors.

  Default is false.

``void setLoading`(int val);`

[public]

  0: `KXAnim` will load the entire video into memory.

  1: `KXAnim` will load and decompress the animation entirely into memory before displaying.

  2: `KXAnim` will read each sector only when needed

  Default is 2.

``void setX11Shared`(bool val);`

[public]

  If `val`==true, `KXAnim` will use X11 shared memory (this is mutually exclusive with `setPreload` .

  Default is false.

``void setMultiBuffer`(bool val);`

[public]

  If `val`==true, `KXAnim` will use X11 Buffering (if present) to smooth animations by double-buffering.

  Default is true.

``void setUsePixmap`(bool val);`

[public]

  If `val`==true, `KXAnim` will use Pixmap instead of Image in X11shared. This option has no effect if the animation is buffered.

  Default is false.

``void setX11VisualClass`(const char *val);`

[public]

  Select the best "X11 Visual of Class..." when displaying the animation. val can be anyone of the following strings and is case insensitive:

  default
  staticgray
  grayscale
  staticcolor
  pseudocolor
  truecolor
  directcolor

  Default is "default".

``void setPauseAt`(int val);`

[public]

  This will pause XAnim at frame "`val`". `val`=-1 disables this option.

  Default is -1 (no pause).

``void setExtraParameters`(const char *val);`

[public]

  Use this method to pass any extra parameters you want to xanim (separated by spaces).

``void setExecutable`(const char *val);`

[public]

  Use this method to set the executable name for xanim. Default is "xanim", but you can change it, for instance, if you don't have xanim in the path.

``void play`();`

[public slot]

  Start playing the video.

``void pause`();`

[public slot]

  Pauses the video playing (xanim is still runnig).

``void stop`();`

[public slot]

  Stops the video and exit xanim (don't worry about it, it's transparent for the class user).

  | Calling this slot doesn't mean that the video will stop immediately. Use the stopped signal to know exactly when the player is set to the inactive mode (see `isActive` ).

``void stepForward`();`

[public slot]

  Single step forward one frame. Pauses the video playing.

``void stepBack`();`

[public slot]

  Single step back one frame. Pauses the video playing.

``void stepForwardWA`();`

[public slot]

  Single step forward one frame staying with anim. Pauses the video playing.

``void stepBackWA`();`

[public slot]

  Single step back one frame staying with anim. Pauses the video playing.

``void toggleSound`();`

[public slot]

  Toggle sound between ON/OFF.

``void volumeIncrement`();`

[public slot]

  Increment volume by 1.

``void volumeDecrement`();`

[public slot]

  Decrement volume by 1.

``void setVolume`(int v);`

[public slot]

  Setup volume where `v` is a number from 0 to 100.

``void faster`();`

[public slot]

  Increase animation playback speed.

``void slower`();`

[public slot]

  Decrease animation playback speed.

``void resetSpeed`();`

[public slot]

  Reset animation playback speed to original values.

``void changeProperty`(const char * c);`

[protected]

  Don't use it! This is internally used for the communication with xanim.

``void stopped`();`

[signal]

  This signal is emitted after a call to the `stop()` slot, and means that the player has really stopped playing (that xanim is inactive) (see `stop`).

``void mouseClick`(QMouseEvent *);`

[signal]

  This signal is emitted when the user clicks into the widget.

Zurück | Anfang | Vor
Entwicklerdokumentation für AKtion (in Englisch) | Hoch | Fragen und Antworten