1 /***************************************************************************
2 * This file is part of Tecorrec. *
3 * Copyright 2008 James Hogan <james@albanarts.com> *
5 * Tecorrec is free software: you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation, either version 2 of the License, or *
8 * (at your option) any later version. *
10 * Tecorrec is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with Tecorrec. If not, write to the Free Software Foundation, *
17 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18 ***************************************************************************/
25 * @brief A single abstract image channel.
28 #include "tcPixelData.h"
34 class tcChannelConfigWidget
;
36 /// A single abstract image channel.
42 * Constructors + destructor
45 /// Primary constructor.
46 tcChannel(const QString
& name
, const QString
& description
);
55 /// Get the channel name.
56 const QString
& name() const;
58 /// Get the channel description;
59 const QString
& description() const;
61 /// Set the channel name.
62 void setName(const QString
& name
);
64 /// Set the channel description.
65 void setDescription(const QString
& description
);
68 * Main image interface
71 /// Get configuration widget.
72 virtual tcChannelConfigWidget
* configWidget();
74 /// Get GL texture ID of thumbnail of the channel.
75 virtual GLuint
thumbnailTexture();
77 /// Get a reference to the pixel data of a portion of the image.
78 Reference
<tcAbstractPixelData
> portion(double* x1
, double* y1
, double* x2
, double* y2
);
80 /// Get GL texture ID of portion of the channel.
81 GLuint
portionTexture(double* x1
, double* y1
, double* x2
, double* y2
);
86 * Interface for derived class to implement
89 /// Round coordinates to sensible values.
90 virtual void roundPortion(double* x1
, double* y1
, double* x2
, double* y2
) = 0;
92 /// Load a portion of pixel data from the channel source, wherever that may be.
93 virtual tcAbstractPixelData
* loadPortion(double x1
, double y1
, double x2
, double y2
) = 0;
96 * Interface for derived classes
99 /** Invalidate this channel.
100 * For example if one of the inputs has changed.
104 /** Revalidate the channel, indicating that the data has changed.
105 * For example after the content has been recalculated after an invalidation.
115 /// Name of the channel.
118 /// Description of the channel.
119 QString m_description
;
121 /// Pixel data of a portion of the channel.
122 Reference
<tcAbstractPixelData
> m_portion
;
124 /// Portion coordinates.
125 double m_portionPosition
[2][2];