DD::Image::DrawIop Class Reference

Inherits DD::Image::PixelIop.

List of all members.

Public Types

enum  {
  NORAMP, LINEAR, SMOOTH0, SMOOTH1,
  SMOOTH
}

Public Member Functions

void calculate_guides ()
virtual bool draw_engine (int y, int x, int r, float *buffer)=0
 DrawIop (Node *node)
void input_knobs (Knob_Callback)
void output_knobs (Knob_Callback, bool ramp=true)
int optional_input () const
int minimum_inputs () const
int maximum_inputs () const
Opdefault_input (int) const
float uses_input (int) const
const char * input_label (int, char *) const
unsigned node_color () const

Public Attributes

ChannelSet channelset
ChannelSet premult
float color1 [4]
float color0 [4]
 Colors for the ramp.
int ramp_type
double x0
double y0
double x1
double y1
 Control points for ramp.
float X
float Y
 Slopes of lines through the control points.
float deltaX
 Rate of color change horizontally.
float opacity_
Channel maskChannelMask_
Channel maskChannelInput_
bool replace
bool invert
bool invert_mask
bool inject
int cliptype

Protected Member Functions

void _validate (bool)
void _validate (bool, int x, int y, int r, int t)
void pixel_engine (const Row &, int y, int x, int r, ChannelMask, Row &)
void in_channels (int, ChannelSet &) const
HandlesMode doAnyHandles (ViewerContext *)
void build_handles (ViewerContext *)
void draw_handle (ViewerContext *)
int knob_changed (Knob *)

Detailed Description

This is a base class for operations that draw a black and white image (such as a shape, text, PostScript, etc). This base class provides a wrapper so that the image can be drawn into any channel, inverted, or merged or intersected with an input channel.


Member Function Documentation

void DrawIop::_validate ( bool  for_real) [protected, virtual]

This default version of _validate() assumes the drawing completely fills the union of the incoming bounding box and format. The bbox controls can be used to reduce the output size. Most subclasses should figure out the actual area they will draw and call the other _validate().

Reimplemented from DD::Image::Iop.

References DD::Image::IopInfo::black_outside(), DD::Image::IopInfoOwner::format(), DD::Image::IopInfoOwner::info(), DD::Image::IopInfoOwner::info_, DD::Image::Iop::input0(), DD::Image::Box::merge(), DD::Image::Box::r(), DD::Image::Box::t(), DD::Image::Op::validate(), DD::Image::Box::x(), and DD::Image::Box::y().

void DrawIop::_validate ( bool  for_real,
int  x,
int  y,
int  r,
int  t 
) [protected]
void DrawIop::pixel_engine ( const Row in,
int  y,
int  x,
int  r,
ChannelMask  channels,
Row row 
) [protected, virtual]

The engine calls draw_engine() to get the black/white image and then merges the result with the input channels and using the settings of the color and invert flags. Somewhat complex as it tries hard to detect and mark lines that are cleared to zero, because other operators that use the output as a mask can save time when they know it is zero.

Implements DD::Image::PixelIop.

References ARRAY, DD::Image::IopInfoOwner::black_outside(), DD::Image::Iop::channel(), clamp(), color0, DD::Image::colourIndex(), DD::Image::ChannelSet::contains(), DD::Image::Row::copy(), DD::Image::Op::debug(), deltaX, draw_engine(), DD::Image::Row::erase(), DD::Image::IopInfoOwner::format(), DD::Image::Iop::get(), DD::Image::IopInfoOwner::info(), DD::Image::Iop::input1(), DD::Image::Format::pixel_aspect(), DD::Image::Row::pre_copy(), DD::Image::Box::r(), DD::Image::IopInfoOwner::t(), DD::Image::Box::t(), DD::Image::Row::writable(), DD::Image::Box::x(), DD::Image::IopInfoOwner::x(), Y, DD::Image::IopInfoOwner::y(), DD::Image::Box::y(), and y1.

void DD::Image::DrawIop::draw_handle ( ViewerContext ) [protected, virtual]

Draws dotted lines to indicate the ramp.

Reimplemented from DD::Image::Op.

int DrawIop::knob_changed ( Knob k) [protected, virtual]

Shows only the relevant maskChannel control depending on whether the mask input is connected and being used. This avoids questions about what happens when you set both of them (the answer is that the maskChannelInput is used and the mask input is ignored).

Reimplemented from DD::Image::Op.

References DD::Image::Knob::hide(), DD::Image::Knob::inputChange, DD::Image::Knob::is(), DD::Image::Op::knob(), DD::Image::Op::node_input(), DD::Image::Knob::show(), DD::Image::Knob::showPanel, and DD::Image::Knob::visible().

bool DD::Image::DrawIop::draw_engine ( int  y,
int  x,
int  r,
float *  buffer 
) [pure virtual]

The subclass only needs to provide this method that produces the image in monochrome, writing the locations between x and r in the buffer with values between 0.0 and 1.0.

This should return true if the row intersects the drawing. It can return false to indicate the row did not intersect the picture, in this case the buffer does not need to be filled with zeros and DrawIop will process the line much faster.

Referenced by pixel_engine().

void DrawIop::input_knobs ( Knob_Callback  f)
void DrawIop::output_knobs ( Knob_Callback  f,
bool  ramp = true 
)

Your subclass should call this to insert knobs that should be after the controls for your shape.

References DD::Image::AColor_knob(), color0, DD::Image::Enumeration_knob(), DD::Image::Knob::HIDDEN, DD::Image::Obsolete_knob(), DD::Image::SetFlags(), DD::Image::Tab_knob(), and DD::Image::XY_knob().