~ubuntu-branches/ubuntu/oneiric/qwt/oneiric-proposed

« back to all changes in this revision

Viewing changes to qwt-5.1.2/src/qwt_plot_rasteritem.h

  • Committer: Bazaar Package Importer
  • Author(s): Fathi Boudra
  • Date: 2009-07-01 16:08:21 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20090701160821-gog44m4w7x2f4u6o
Tags: 5.2.0-1
* New upstream release.
* Add branch pull patch from svn r544.
* Bump Standards-Version to 3.8.2. No changes needed.
* Update installed manpages.
* Use qwt as base name for directory (drop version).
* Add missing warnings patch.
* Rewrite debian/rules: use dh.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
2
 
 * Qwt Widget Library
3
 
 * Copyright (C) 1997   Josef Wilgen
4
 
 * Copyright (C) 2002   Uwe Rathmann
5
 
 *
6
 
 * This library is free software; you can redistribute it and/or
7
 
 * modify it under the terms of the Qwt License, Version 1.0
8
 
 *****************************************************************************/
9
 
 
10
 
#ifndef QWT_PLOT_RASTERITEM_H
11
 
#define QWT_PLOT_RASTERITEM_H
12
 
 
13
 
#include <qglobal.h>
14
 
#include <qstring.h>
15
 
#include <qimage.h>
16
 
 
17
 
#include "qwt_plot_item.h" 
18
 
 
19
 
/*!
20
 
  \brief A class, which displays raster data
21
 
 
22
 
  Raster data is a grid of pixel values, that can be represented
23
 
  as a QImage. It is used for many types of information like
24
 
  spectrograms, cartograms, geographical maps ...
25
 
 
26
 
  Often a plot has several types of raster data organized in layers.
27
 
  ( f.e a geographical map, with weather statistics ).
28
 
  Using setAlpha() raster items can be stacked easily.
29
 
 
30
 
  QwtPlotRasterItem is only implemented for images of the following formats:
31
 
  QImage::Format_Indexed8, QImage::Format_ARGB32.
32
 
 
33
 
  \sa QwtPlotSpectrogram
34
 
*/
35
 
 
36
 
class QWT_EXPORT QwtPlotRasterItem: public QwtPlotItem
37
 
{
38
 
public:
39
 
    /*!
40
 
      - NoCache\n
41
 
        renderImage() is called, whenever the item has to be repainted
42
 
      - PaintCache\n
43
 
        renderImage() is called, whenever the image cache is not valid,
44
 
        or the scales, or the size of the canvas has changed. This type
45
 
        of cache is only useful for improving the performance of hide/show
46
 
        operations. All other situations are already handled by the
47
 
        plot canvas cache.
48
 
      - ScreenCache\n
49
 
        The screen cache is an image in size of the screen. As long as
50
 
        the scales don't change the target image is scaled from the cache.
51
 
        This might improve the performance
52
 
        when resizing the plot widget, but suffers from scaling effects.
53
 
 
54
 
      The default policy is NoCache
55
 
     */
56
 
    enum CachePolicy
57
 
    {
58
 
        NoCache,
59
 
        PaintCache,
60
 
        ScreenCache
61
 
    };
62
 
 
63
 
    explicit QwtPlotRasterItem(const QString& title = QString::null);
64
 
    explicit QwtPlotRasterItem(const QwtText& title);
65
 
    virtual ~QwtPlotRasterItem();
66
 
 
67
 
    void setAlpha(int alpha);
68
 
    int alpha() const;
69
 
 
70
 
    void setCachePolicy(CachePolicy);
71
 
    CachePolicy cachePolicy() const;
72
 
 
73
 
    void invalidateCache();
74
 
 
75
 
    virtual void draw(QPainter *p,
76
 
        const QwtScaleMap &xMap, const QwtScaleMap &yMap,
77
 
        const QRect &rect) const;
78
 
 
79
 
    virtual QSize rasterHint(const QwtDoubleRect &) const;
80
 
 
81
 
protected:
82
 
 
83
 
     /*!
84
 
      Renders an image for an area
85
 
 
86
 
      The format of the image must be QImage::Format_Indexed8,
87
 
      QImage::Format_RGB32 or QImage::Format_ARGB32
88
 
      
89
 
      \param xMap Maps x-values into pixel coordinates.
90
 
      \param yMap Maps y-values into pixel coordinates.
91
 
      \param area Requested area for the image in scale coordinates
92
 
     */
93
 
    virtual QImage renderImage(const QwtScaleMap &xMap, 
94
 
        const QwtScaleMap &yMap, const QwtDoubleRect &area
95
 
        ) const = 0;
96
 
 
97
 
private:
98
 
    QwtPlotRasterItem( const QwtPlotRasterItem & );
99
 
    QwtPlotRasterItem &operator=( const QwtPlotRasterItem & );
100
 
 
101
 
    void init();
102
 
 
103
 
    class PrivateData;
104
 
    PrivateData *d_data;
105
 
};
106
 
 
107
 
#endif