Warning, file /frameworks/khtml/src/imload/imagepainter.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 Progressive image displaying library. 0003 0004 Copyright (C) 2004,2005 Maks Orlovich (maksim@kde.org) 0005 0006 Permission is hereby granted, free of charge, to any person obtaining a copy 0007 of this software and associated documentation files (the "Software"), to deal 0008 in the Software without restriction, including without limitation the rights 0009 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 0010 copies of the Software, and to permit persons to whom the Software is 0011 furnished to do so, subject to the following conditions: 0012 0013 The above copyright notice and this permission notice shall be included in 0014 all copies or substantial portions of the Software. 0015 0016 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 0017 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 0018 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 0019 AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 0020 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 0021 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 0022 0023 */ 0024 0025 #ifndef IMAGE_PAINTER_H 0026 #define IMAGE_PAINTER_H 0027 0028 class QPainter; 0029 0030 #include <QSize> 0031 0032 namespace khtmlImLoad 0033 { 0034 0035 class Image; 0036 0037 /** 0038 An image painter let's one paint an image at the given size. 0039 */ 0040 class ImagePainter 0041 { 0042 public: 0043 /** 0044 Creates an image painter for the given image... 0045 */ 0046 ImagePainter(Image *image); 0047 0048 /** 0049 Creates an image painter for the given image, 0050 of given size 0051 */ 0052 ImagePainter(Image *image, QSize size); 0053 0054 ImagePainter(const ImagePainter &src); 0055 ImagePainter &operator=(const ImagePainter &src); 0056 0057 /** 0058 Sets the size of the image. 0059 */ 0060 void setSize(QSize size); 0061 0062 /** 0063 Sets the image to the default size 0064 */ 0065 void setDefaultSize(); 0066 0067 /** 0068 Cleans up 0069 */ 0070 ~ImagePainter(); 0071 0072 /** 0073 Paints a portion of the image frame on the painter 'p' at dx and dy. 0074 The source rectangle starts at sx, sy and has dimension width * height 0075 */ 0076 void paint(int dx, int dy, QPainter *p, int sx = 0, int sy = 0, 0077 int width = -1, int height = -1); 0078 private: 0079 // Note: we actually request/ref scaled version from Image 0080 // lazily. This is because we may be constructed before there 0081 // is anything to scale, so we check when painting.. 0082 Image *image; 0083 QSize size; 0084 bool sizeRefd; 0085 }; 0086 0087 } 0088 0089 #endif