r3drawp

r3drawp

Class

real/frio/r3drawp.h

Library

r3frio

Description:

DrawPort Class. Tool for resolution-idependent, aspect-ratio corrected drawing to any amount of data channels. Currently works only with raw image (R3CLID_RAWIMAGE) class (other images do not support direct&fast sub channel usage). See DTYPE class for sub channel access methods. All drawing methods take care of clipping.

See Also

oops/r3root.h

Super Class

r3Root

R3CLID_ROOT

JavaScript

r3Drawport

Class Identifier

R3CLID_DRAWPORT - 404

Methods

SELECTPEN, SETPEN, SETDRAWMODE, INITIALIZE, PIXEL, APIXEL, DISC, LINE, RECTANGLE, ASSIGN, ALLOCREADPEN, FREEREADPEN, READCHANNEL, BEGINFILLEDPOLY, ENDPOLY, POLYPOINT, MAPTOPIXELCOORDS, BEGINCHAIN, CHAINPOINT, ENDCHAIN, PIXELDISTANCE,

Attributes

Output, Image, Aspect, ErrorState, Wrap, LineType, ModuloFix, ZChannelName,

Registration

int R3RegisterDrawPortClass(R3APP *app);

Pen indexes

R3DRAWP_PEN0
R3DRAWP_PEN1
R3DRAWP_PEN2

Sub channel indexes. For example, 'Red' of 'Color' corresponds to R3DRAWP_SUBCH0

R3DRAWP_SUBCH0
R3DRAWP_SUBCH1
R3DRAWP_SUBCH2
R3DRAWP_SUBCH3
R3DPCH_COVERAGE

Image Drawing Modes.

R3DRAWPMODE_DISABLED
R3DRAWPMODE_REPLACE
R3DRAWPMODE_ADD
R3DRAWPMODE_MAX
R3DRAWPMODE_MIN
R3DRAWPMODE_MUL

R3DRAWPM_SELECTPEN

Method

SELECTPEN

Identifier

R3DRAWPM_SELECTPEN

Param 3:

R3INT, pen index.

JavaScript

obj.SELECTPEN(p3);

Description

Defines the current pen. SETPEN methods define channel values for this pen.

R3DRAWPM_SETPEN

Method

SETPEN

Identifier

R3DRAWPM_SETPEN

Param 1:

char*, channel name

Param 2:

R3INT, sub channel index.

Param 3:

R3FLOAT, channel value.

JavaScript

obj.SETPEN(p1, p2, p3);

Description

Defines a sub channel value for the current pen.

R3DRAWPM_SETDRAWMODE

Method

SETDRAWMODE

Identifier

R3DRAWPM_SETDRAWMODE

Param 1:

char*, channel name

Param 2:

R3INT, sub channel index.

Param 3:

R3INT, drawing mode, for example R3DRAWPMODE_REPLACE

JavaScript

obj.SETDRAWMODE(p1, p2, p3);

Description

Defines drawing mode for a sub channel. Note: drawing modes are common for all pens.

R3DRAWPM_INITIALIZE

Method

INITIALIZE

Identifier

R3DRAWPM_INITIALIZE

JavaScript

obj.INITIALIZE();

Description

Deallocates dynamical pens & drawmode definitions - clean restart for drawing

R3DRAWPM_PIXEL

Method

PIXEL

Identifier

R3DRAWPM_PIXEL

Param 1:

R3FLOAT, x coord

Param 3:

R3FLOAT, y coord

JavaScript

obj.PIXEL(p1, p3);

Description

Draw a single pixel using PEN0

R3DRAWPM_APIXEL

Method

APIXEL

Identifier

R3DRAWPM_APIXEL

Param 1:

R3FLOAT, x coord

Param 3:

R3FLOAT, y coord

JavaScript

obj.APIXEL(p1, p3);

Description

Draw a single antialiased pixel using PEN0

R3DRAWPM_DISC

Method

DISC

Identifier

R3DRAWPM_DISC

Param 1:

R3FLOAT, x coord

Param 2:

R3FLOAT, y coord

Param 3:

R3VECTOR, 3 radius values. If first rad is > 0, a ring is drawn.

JavaScript

obj.DISC(p1, p2, p3);

Description

Draw a disc with pens 0-2. Attributes are defined at 3 distances using pens 0-2

R3DRAWPM_LINE

Method

LINE

Identifier

R3DRAWPM_LINE

Param 1:

R3VECTOR, x1, y1, radius1

Param 3:

R3VECTOR, x1, y1, radius2

JavaScript

obj.LINE(p1, p3);

Description

Draw a line between 2 points. Pens 0 and 1 define line properties

R3DRAWPM_RECTANGLE

Method

RECTANGLE

Identifier

R3DRAWPM_RECTANGLE

Param 3:

R3VECTOR, bottomright (t unused)

JavaScript

obj.RECTANGLE(p3);

Description

Draws non antialiased rectangle between given topleft & bottomright corners.

R3DRAWPM_ASSIGN

Method

ASSIGN

Identifier

R3DRAWPM_ASSIGN

Param 1:

R3OBJ*, source drawport

Param 3:

R3OBJ*, destination drawport

JavaScript

obj.ASSIGN(p1, p3);

Description

Copies drawport to another. Only common channels which have drawmodes * defined are copied. Assignment obeys drawmodes of the destination drawport.

R3DRAWPM_ALLOCREADPEN

Method

ALLOCREADPEN

Identifier

R3DRAWPM_ALLOCREADPEN

Return

void*, a handle or NULL if channel not found or error occurs

Param 1:

char*, channel name

Param 3:

R3INT, sub channel index

JavaScript

rc = obj.ALLOCREADPEN(p1, p3);

Description

Allocates a handle for optimized sub channel reading

R3DRAWPM_FREEREADPEN

Method

FREEREADPEN

Identifier

R3DRAWPM_FREEREADPEN

Param 3:

void*, handle to be freed

JavaScript

obj.FREEREADPEN(p3);

Description

frees handle allocated by R3DRAWPM_ALLOCREADPEN

R3DRAWPM_READCHANNEL

Method

READCHANNEL

Identifier

R3DRAWPM_READCHANNEL

Param 1:

void*, a channel handle allocated by R3DRAWPM_ALLOCREADPEN

JavaScript

obj.READCHANNEL(p1, 0);

Description

Reads one sub channel value. Note: Draw modes & pens do not affect read values.

R3DRAWPM_BEGINFILLEDPOLY

Method

BEGINFILLEDPOLY

Identifier

R3DRAWPM_BEGINFILLEDPOLY

JavaScript

obj.BEGINFILLEDPOLY();

Description

start filled polygon drawing

R3DRAWPM_ENDPOLY

Method

ENDPOLY

Identifier

R3DRAWPM_ENDPOLY

JavaScript

obj.ENDPOLY();

Description

end filled polygon drawing

R3DRAWPM_POLYPOINT

Method

POLYPOINT

Identifier

R3DRAWPM_POLYPOINT

Param 3:

R3VECTOR, defines x & y coordinates. 3rd component unused.

JavaScript

obj.POLYPOINT(p3);

Description

new point in a filled polygon

R3DRAWPM_MAPTOPIXELCOORDS

Method

MAPTOPIXELCOORDS

Identifier

R3DRAWPM_MAPTOPIXELCOORDS

Param 2:

int, x

Param 3:

int, y

JavaScript

obj.MAPTOPIXELCOORDS(0, p2, p3);

Description

return vector in pixel coordinates

R3DRAWPM_BEGINCHAIN

Method

BEGINCHAIN

Identifier

R3DRAWPM_BEGINCHAIN

Param 3:

R3BOOL, if true draws a closed loop. Last & first point need not to be same.

JavaScript

obj.BEGINCHAIN(p3);

Description

Start chain drawing

R3DRAWPM_CHAINPOINT

Method

CHAINPOINT

Identifier

R3DRAWPM_CHAINPOINT

Param 3:

R3VECTOR, a new point & radius <x,y,radius>

JavaScript

obj.CHAINPOINT(p3);

Description

Add a new point to chain

R3DRAWPM_ENDCHAIN

Method

ENDCHAIN

Identifier

R3DRAWPM_ENDCHAIN

JavaScript

obj.ENDCHAIN();

Description

Ends chain drawing

R3DRAWPM_PIXELDISTANCE

Method

PIXELDISTANCE

Identifier

R3DRAWPM_PIXELDISTANCE

Param 1:

R3FLOAT, address of result R3FLOAT

Param 2:

R3VECTOR, (p1->r, p1->s) define float coordinates of 1st point

Param 3:

R3VECTOR, (p2->r, p2->s) define float coordinates of 2nd point

JavaScript

obj.PIXELDISTANCE(p1, p2, p3);

Description

return distance of two vectors measured in pixels

Output

Attribute

Output

Identifier

R3DRAWPA_Output

JavaScript type

Object

C type

R3OBJ*

Description

actual output object (sub class of R3CLID_OUTPUT)

Syntax


jsobj.SetOutput(value);
value = jsobj.GetOutput();


R3OBJ* value = ...;
R3SetAttrs(r3obj, R3DRAWPA_Output, value, R3TAG_END);
R3OBJ* value;
R3GetAttrs(r3obj, R3DRAWPA_Output, &value, R3TAG_END);

Image

Attribute

Image

Identifier

R3DRAWPA_Image

JavaScript type

Object

C type

R3OBJ*

Description

read only

Syntax


jsobj.SetImage(value);
value = jsobj.GetImage();


R3OBJ* value = ...;
R3SetAttrs(r3obj, R3DRAWPA_Image, value, R3TAG_END);
R3OBJ* value;
R3GetAttrs(r3obj, R3DRAWPA_Image, &value, R3TAG_END);

Aspect

Attribute

Aspect

Identifier

R3DRAWPA_Aspect

JavaScript type

Number

C type

R3FLOAT

Description

pixel height/width ratio

Syntax


jsobj.SetAspect(value);
value = jsobj.GetAspect();


R3FLOAT value = ...;
R3SetAttrs(r3obj, R3DRAWPA_Aspect, value, R3TAG_END);
R3FLOAT value;
R3GetAttrs(r3obj, R3DRAWPA_Aspect, &value, R3TAG_END);

ErrorState

Attribute

ErrorState

Identifier

R3DRAWPA_ErrorState

JavaScript type

Integer

C type

R3INT

Description

status attribute: if nonzero, an error has occurred

Syntax


jsobj.SetErrorState(value);
value = jsobj.GetErrorState();


R3INT value = ...;
R3SetAttrs(r3obj, R3DRAWPA_ErrorState, value, R3TAG_END);
R3INT value;
R3GetAttrs(r3obj, R3DRAWPA_ErrorState, &value, R3TAG_END);

Wrap

Attribute

Wrap

Identifier

R3DRAWPA_Wrap

JavaScript type

Boolean

C type

R3BOOL

Description

if set to TRUE coordinates wrap around borders, otherwise they are cut

Syntax


jsobj.SetWrap(value);
value = jsobj.GetWrap();


R3BOOL value = ...;
R3SetAttrs(r3obj, R3DRAWPA_Wrap, value, R3TAG_END);
R3BOOL value;
R3GetAttrs(r3obj, R3DRAWPA_Wrap, &value, R3TAG_END);

LineType

Attribute

LineType

Identifier

R3DRAWPA_LineType

JavaScript type

Integer

C type

R3INT

Description

see defines below

Syntax


jsobj.SetLineType(value);
value = jsobj.GetLineType();


R3INT value = ...;
R3SetAttrs(r3obj, R3DRAWPA_LineType, value, R3TAG_END);
R3INT value;
R3GetAttrs(r3obj, R3DRAWPA_LineType, &value, R3TAG_END);

ModuloFix

Attribute

ModuloFix

Identifier

R3DRAWPA_ModuloFix

JavaScript type

Boolean

C type

R3BOOL

Description

if set to TRUE drawing uses shortest modulo route

Syntax


jsobj.SetModuloFix(value);
value = jsobj.GetModuloFix();


R3BOOL value = ...;
R3SetAttrs(r3obj, R3DRAWPA_ModuloFix, value, R3TAG_END);
R3BOOL value;
R3GetAttrs(r3obj, R3DRAWPA_ModuloFix, &value, R3TAG_END);

ZChannelName

Attribute

ZChannelName

Identifier

R3DRAWPA_ZChannelName

JavaScript type

String

C type

char*

Description

optional name for a z buffer channel

Syntax


jsobj.SetZChannelName(value);
value = jsobj.GetZChannelName();


char* value = ...;
R3SetAttrs(r3obj, R3DRAWPA_ZChannelName, value, R3TAG_END);
char* value;
R3GetAttrs(r3obj, R3DRAWPA_ZChannelName, &value, R3TAG_END);

Line end/joining point styles (for controlling R3DRAWPM_LINE method):


r3appobj *

R3DCOND_STRAIGHT
R3DCOND_ROUND
R3DCOND_CLIP