Home |
Class PegAnimation HMI (Human-Machine Interface) Classes |
Class PegAnimationPegAnimation is an animated bitmap display class. It is designed to display animated GIF type images; however, any list of images can be created and used with the PegAnimation class. The PegAnimation class requires an array of PegAnimationFrame structures to define the animation images. This array is created automatically by WindowBuilder, or it can be created manually. typedef struct { PegBitmap * pMap; PEGINT iDelay; PEGINT xOffset; PEGINT yOffset; PEGINT Disposal; // 0 = Back fill, 1 = nothing, 4 = write prev } PegAnimationFrame; class PegAnimation: public PegThing { public: PegAnimation(const PegRect &Rect, PegAnimationFrame * pFrameList, PEGUINT wId = 0, PEGUINT wStyle = FF_NONE); PegAnimation(const PegRect &Rect, PEGUINT wId = 0, PEGUINT wStyle = FF_NONE); virtual ~PegAnimation(void); virtual PEGINT Message(const PegMessage &Mesg); virtual void Draw(void); void SetMode(PEGUINT Mode); void Start(PEGINT iFrame = -1); void Stop(void); void AssignFrameList(PegAnimationFrame * pFrameList); }; PegAnimationFrame's field pMap points to one of the images to display. iDelay is the time in milliseconds this image shall be displayed before the next image is shown. xOffset and yOffset specify the offset within the PegAnimation object of the image. Disposal controls how to erase the previous image. Supported values are 0 (background color fill), 1 (do nothing), and 4 (write previous). Style FlagsPegAnimation supports the standard frame styles FF_NONE, FF_THIN, FF_THICK, FF_RAISED, and FF_RECESSED. SignalsPegAnimation sends no signals. ConstructorsThe constructor creates a PegAnimation object. Parameter Size is the object size and position. pFrameList is the address of an array of PegAnimationFrame structures. The array is terminated with a structure having a NULL bitmap pointer. Method DrawPegAnimation overrides the Draw() function to draw the associated bitmap frames. Method MessagePegAnimation overrides the Message function to receive timer messages for drawing the animation frames. Method SetModeThis function is called to set the mode of operation. The following mode flags are supported and can be ORed together to produce the desired animation mode: PEG_AF_WRAP causes the animation to continuously wrap from the last frame to the first. If this mode flag is not set, the animation will run once when activated and terminate after displaying the last animation frame. PEG_AF_SHOWIDLE causes the animation to display the current animation frame even when the animation is idle (i.e. it is not cycling through the list of animation frames). If this flag is not set, the animation object displays no image when it is not running. PEG_AF_AUTOSTART causes the animation to automatically start running when it is visible. If this mode flag is not set, the animation is started via program control by calling the Start method (see below). Method StartStart is called to start the animation display sequence, if the PEG_AF_AUTOSTART mode is not set. If the iFrame parameter is -1, the animation starts at the current frame. The application can also pass a frame number >= 0 to begin the animation at any specified frame index. Method StopThis method stops the animation. The animation will display the last active frame if PEG_AF_SHOWIDLE mode is set, otherwise it will display no graphic when stopped. Method AssignFrameListThis function can be called to re-assign the animation frame list. The parameter is the address of an array of PegAnimationFrame stuctures. The array is terminated with a structure containing a NULL PegBitmap pointer. ExampleAn example of creating and using class PegAnimation can be found in program Animate.
|