KHtml

imagepainter.h
1 /*
2  Progressive image displaying library.
3 
4  Copyright (C) 2004,2005 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 IMAGE_PAINTER_H
26 #define IMAGE_PAINTER_H
27 
28 class QPainter;
29 
30 #include <QSize>
31 
32 namespace khtmlImLoad
33 {
34 
35 class Image;
36 
37 /**
38  An image painter let's one paint an image at the given size.
39 */
41 {
42 public:
43  /**
44  Creates an image painter for the given image...
45  */
46  ImagePainter(Image *image);
47 
48  /**
49  Creates an image painter for the given image,
50  of given size
51  */
52  ImagePainter(Image *image, QSize size);
53 
54  ImagePainter(const ImagePainter &src);
55  ImagePainter &operator=(const ImagePainter &src);
56 
57  /**
58  Sets the size of the image.
59  */
60  void setSize(QSize size);
61 
62  /**
63  Sets the image to the default size
64  */
65  void setDefaultSize();
66 
67  /**
68  Cleans up
69  */
70  ~ImagePainter();
71 
72  /**
73  Paints a portion of the image frame on the painter 'p' at dx and dy.
74  The source rectangle starts at sx, sy and has dimension width * height
75  */
76  void paint(int dx, int dy, QPainter *p, int sx = 0, int sy = 0,
77  int width = -1, int height = -1);
78 private:
79  // Note: we actually request/ref scaled version from Image
80  // lazily. This is because we may be constructed before there
81  // is anything to scale, so we check when painting..
82  Image *image;
83  QSize size;
84  bool sizeRefd;
85 };
86 
87 }
88 
89 #endif
An image represents a static picture or an animation, that may be incrementally loaded.
Definition: image.h:51
An image painter let&#39;s one paint an image at the given size.
Definition: imagepainter.h:40
void paint(int dx, int dy, QPainter *p, int sx=0, int sy=0, int width=-1, int height=-1)
Paints a portion of the image frame on the painter &#39;p&#39; at dx and dy.
ImagePainter(Image *image)
Creates an image painter for the given image...
void setDefaultSize()
Sets the image to the default size.
void setSize(QSize size)
Sets the size of the image.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sat Oct 16 2021 22:47:55 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.