KHtml

animprovider.h
1 /*
2  Large image displaying library.
3 
4  Copyright (C) 2004 Maks Orlovich ([email protected])
5 
6  Permission is hereby granted, free of charge, to any person obtaining a copy
7  of this software and associated documentation files (the "Software"), to deal
8  in the Software without restriction, including without limitation the rights
9  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10  copies of the Software, and to permit persons to whom the Software is
11  furnished to do so, subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in
14  all copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
20  AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 
23 */
24 
25 #ifndef ANIM_PROVIDER_H
26 #define ANIM_PROVIDER_H
27 
28 #include <khtml_settings.h>
29 
30 class QPainter;
31 
32 namespace khtmlImLoad
33 {
34 
35 class PixmapPlane;
36 class Image;
37 
38 /**
39  A base class for animation support. This should be implemented by decoders
40  wishing to implement animation. When this is installed, paint events
41  for the image are redirected here.
42 */
44 {
45 protected:
46  PixmapPlane *frame0;
47  PixmapPlane *curFrame;
48  Image *image;
49  bool shouldSwitchFrame; //Set by AnimTimer
50  KHTMLSettings::KAnimationAdvice animationAdvice;
51 
52  void nextFrame(); //Helper that goes to next frame or wraps around
53 public:
54  AnimProvider(PixmapPlane *plane, Image *img): frame0(plane), curFrame(plane),
55  image(img), shouldSwitchFrame(false),
56  animationAdvice(KHTMLSettings::KAnimationEnabled)
57  {}
58 
59  void switchFrame();
60 
61  virtual ~AnimProvider();
62 
63  //Must be implemented to create animation provider for the given
64  //plane describing the same animation
65  virtual AnimProvider *clone(PixmapPlane *newParentPlane) = 0;
66 
67  //Must be implemented to paint the given region. Note that clipping to the
68  //overall canvas will be performed already
69  virtual void paint(int dx, int dy, QPainter *p, int sx, int sy, int width, int height) = 0;
70 
71  /**
72  Enables or disables animations
73  */
74  void setShowAnimations(KHTMLSettings::KAnimationAdvice);
75 };
76 
77 }
78 
79 #endif
An image represents a static picture or an animation, that may be incrementally loaded.
Definition: image.h:51
A pixmap plane is responsible for drawing data of an image plane.
Definition: pixmapplane.h:41
A base class for animation support.
Definition: animprovider.h:43
void setShowAnimations(KHTMLSettings::KAnimationAdvice)
Enables or disables animations.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sat Oct 16 2021 22:47:50 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.