/usr/include/OverlayUnidraw/ovipcmds.h is in ivtools-dev 1.2.11a1-11.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 | /*
* Copyright (c) 1998,1999 Vectaport Inc.
* Copyright (c) 1997 Vectaport Inc. and R.B. Kissh & Associates
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the names of the copyright holders not be used in
* advertising or publicity pertaining to distribution of the software
* without specific, written prior permission. The copyright holders make
* no representations about the suitability of this software for any purpose.
* It is provided "as is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
* IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL,
* INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
* FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
#ifndef ipcmds_h
#define ipcmds_h
#include <ComTerp/comfunc.h>
#include <ComTerp/comterpserv.h>
#include <Unidraw/Commands/macro.h>
#include <OverlayUnidraw/ovraster.h>
typedef float ColorIntensity;
class RasterOvComp;
class OverlayRaster;
class Raster;
class OverlayRasterRect;
//: ComTerp specialized for image processing operations.
// command interpreter that takes a pointer to an editor, and
// uses it execute interpreted commands on a raster component.
class RasterTerp : public ComTerpServ {
public:
RasterTerp(Editor*);
~RasterTerp();
int execute(RasterOvComp* comp, const CopyString& exp);
// parse and interpret 'exp' on 'comp'.
Editor* editor();
protected:
Editor* _editor;
};
//: ComFunc base class to hold a raster component.
class RasterFunc : public ComFunc {
public:
RasterFunc(ComTerp*);
~RasterFunc();
static void SetComp(RasterOvComp*);
// set raster component for use of derived classes.
protected:
static Clipboard _comps;
};
//: ComFunc to linearly scale a gray-level raster.
class ScaleGrayFunc : public RasterFunc {
public:
ScaleGrayFunc(RasterTerp*);
virtual void execute();
// execute a ScaleGrayCmd on a gray-level raster.
static const char* Tag();
// command name.
static const char* CommandString(
ColorIntensity mingray, ColorIntensity maxgray
);
// generates command string.
protected:
RasterTerp* _rterp;
};
//: ComFunc to pseudo-color a gray-level raster.
class PseudocolorFunc : public RasterFunc {
public:
PseudocolorFunc(RasterTerp*);
virtual void execute();
// execute a PseudocolorCmd on a gray-level raster.
static const char* Tag();
// command name.
static const char* CommandString(
ColorIntensity mingray, ColorIntensity maxgray
);
// generates command string.
protected:
RasterTerp* _rterp;
};
//: ComFunc to log-scale a gray-level raster.
class LogScaleFunc : public RasterFunc {
public:
LogScaleFunc(RasterTerp*);
virtual void execute();
// execute a LogScaleCmd on a gray-level raster.
static const char* Tag();
// command name.
static const char* CommandString(
ColorIntensity mingray, ColorIntensity maxgray
);
// generates command string.
protected:
RasterTerp* _rterp;
};
//: ComFunc to embed a gray-level ramp in a gray-level raster.
class GrayRampFunc : public RasterFunc {
public:
GrayRampFunc(RasterTerp*);
virtual void execute();
// execute a GrayRampCmd on a gray-level raster.
static const char* Tag();
// command name.
static const char* CommandString(RampAlignment);
// generates command string.
protected:
static const char* rpos[];
// relative position of the gray-level ramp -- ramp alignment.
RasterTerp* _rterp;
};
// ---------------------------------------------------------------------------
//: base class for image processing commands.
// The classes derived from ProcessingCmd (ScaleGrayCmd, PseudocolorCmd,
// LogScaleCmd, GrayRampCmd) are image processing operators useful for controlling
// the appearance of an image in a drawing editor or similar display. They are
// not necessarily intended for use in computational imaging algorithms.
class ProcessingCmd : public MacroCmd {
public:
ProcessingCmd(ControlInfo*);
ProcessingCmd(Editor*);
~ProcessingCmd();
void Execute();
// take selected raster, or foremost raster if none is selected,
// wrap up the image processing command with necessary cut/paste commands,
// and invoke the whole thing.
virtual boolean PrepareToExecute(GraphicComp*);
// wrapping the image processing command with necessary cut/paste commands.
virtual OverlayRaster* Process(OverlayRaster*, CopyString& scmd);
// do the actual processing in derived classes.
void GetResult(Clipboard&) const;
// load clipboard with results.
virtual boolean Reversible();
// conditional.
protected:
Clipboard* _comps;
boolean _prepared;
boolean _ed_constructor;
boolean _reversible;
};
//: utility command for storing image processing command string.
class ImageCmd : public Command {
public:
ImageCmd();
ImageCmd(ControlInfo*);
ImageCmd(ControlInfo* c, const CopyString& str);
ImageCmd(Editor* ed, const CopyString& str);
virtual ~ImageCmd();
virtual Command* Copy();
virtual ClassId GetClassId();
virtual boolean IsA(ClassId);
const CopyString& Cmd() const;
protected:
CopyString _cstr;
};
//: command for linear-scaling of gray-level raster.
class ScaleGrayCmd : public ProcessingCmd {
public:
ScaleGrayCmd(
ControlInfo*, ColorIntensity mingray, ColorIntensity maxgray
);
ScaleGrayCmd(ControlInfo*);
ScaleGrayCmd(
Editor* ed, ColorIntensity mingray, ColorIntensity maxgray
);
ScaleGrayCmd(Editor* ed);
virtual ~ScaleGrayCmd();
virtual OverlayRaster* Process(OverlayRaster*, CopyString& scmd);
virtual Command* Copy();
virtual ClassId GetClassId();
virtual boolean IsA(ClassId);
protected:
ColorIntensity _mingray, _maxgray;
};
//: command for pseudo-coloring of gray-level raster.
class PseudocolorCmd : public ProcessingCmd {
public:
PseudocolorCmd(
ControlInfo*, ColorIntensity mingray, ColorIntensity maxgray
);
PseudocolorCmd(ControlInfo*);
PseudocolorCmd(
Editor* ed, ColorIntensity mingray, ColorIntensity maxgray
);
PseudocolorCmd(Editor* ed);
virtual ~PseudocolorCmd();
virtual OverlayRaster* Process(OverlayRaster*, CopyString& scmd);
virtual Command* Copy();
virtual ClassId GetClassId();
virtual boolean IsA(ClassId);
protected:
ColorIntensity _mingray, _maxgray;
};
//: command for logarithmic-scaling of gray-level raster.
class LogScaleCmd : public ProcessingCmd {
public:
LogScaleCmd(ControlInfo*, ColorIntensity mingray, ColorIntensity maxgray);
LogScaleCmd(ControlInfo*);
LogScaleCmd(Editor* ed, ColorIntensity mingray, ColorIntensity maxgray);
LogScaleCmd(Editor* ed);
virtual ~LogScaleCmd();
virtual OverlayRaster* Process(OverlayRaster*, CopyString& scmd);
virtual Command* Copy();
virtual ClassId GetClassId();
virtual boolean IsA(ClassId);
protected:
ColorIntensity _mingray;
ColorIntensity _maxgray;
};
//: command for embedding gray-level ramp in a gray-level raster.
class GrayRampCmd : public ProcessingCmd {
public:
GrayRampCmd(ControlInfo*, IntCoord x, IntCoord y);
GrayRampCmd(ControlInfo*, RampAlignment);
GrayRampCmd(Editor* ed, IntCoord x, IntCoord y);
GrayRampCmd(Editor* ed, RampAlignment);
virtual ~GrayRampCmd();
virtual OverlayRaster* Process(OverlayRaster*, CopyString& scmd);
virtual Command* Copy();
virtual ClassId GetClassId();
virtual boolean IsA(ClassId);
protected:
IntCoord _x, _y;
RampAlignment _align;
boolean _use_align;
};
#endif
|