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 /// A single abstract image channel.
40 * Constructors + destructor
43 /// Primary constructor.
44 tcChannel(const QString
& name
, const QString
& description
);
53 /// Get the channel name.
54 const QString
& name() const;
56 /// Get the channel description;
57 const QString
& description() const;
59 /// Set the channel name.
60 void setName(const QString
& name
);
62 /// Set the channel description.
63 void setDescription(const QString
& description
);
66 * Main image interface
69 /// Get GL texture ID of thumbnail of the channel.
70 virtual GLuint
thumbnailTexture() = 0;
72 /// Get a reference to the pixel data of a portion of the image.
73 Reference
<tcAbstractPixelData
> portion(double* x1
, double* y1
, double* x2
, double* y2
);
75 /// Get GL texture ID of portion of the channel.
76 GLuint
portionTexture(double* x1
, double* y1
, double* x2
, double* y2
);
81 * Interface for derived class to implement
84 /// Round coordinates to sensible values.
85 virtual void roundPortion(double* x1
, double* y1
, double* x2
, double* y2
) = 0;
87 /// Load a portion of pixel data from the channel source, wherever that may be.
88 virtual tcAbstractPixelData
* loadPortion(double x1
, double y1
, double x2
, double y2
) = 0;
91 * Interface for derived classes
94 /** Invalidate this channel.
95 * For example if one of the inputs has changed.
99 /** Revalidate the channel, indicating that the data has changed.
100 * For example after the content has been recalculated after an invalidation.
110 /// Name of the channel.
113 /// Description of the channel.
114 QString m_description
;
116 /// Pixel data of a portion of the channel.
117 Reference
<tcAbstractPixelData
> m_portion
;
119 /// Portion coordinates.
120 double m_portionPosition
[2][2];