Inheritance diagram for CanvasCorbaBlob2d::
Public Methods | |
CanvasCorbaBlob2d (HxCorba.Blob2d blob) | |
Constructor. More... | |
void | draw (Graphics g) |
Implements CanvasObject "interface". More... | |
HxCorba.Blob2d | getStub () |
void | setColor (Color color) |
Override CanvasFigure interface to update the color of the mask. More... | |
void | setTransparency (float trans) |
Override CanvasFigure interface to update the transparency of the mask. More... | |
void | setShowMask (boolean b) |
void | setShowChain (boolean b) |
Vector | getVisualChangeMethods () |
Overrides CanvasObject interface. More... | |
Protected Methods | |
Shape | getShape () |
Derived classes have to implement this method to supply the shape that represents the CanvasFigures. More... | |
boolean | hitOnStroke () |
Derived classes have to implement this method to indicate whether they are selected (hit) based on their stroke (border) or on their interior. More... |
|
00029 { 00030 super(0., 0., 0., 0.); 00031 _blob = blob; 00032 setInputSource(INP_CORBA); 00033 setObjectExtend(); 00034 updateChain(); 00035 updateMask(); 00036 } |
|
Implements CanvasObject "interface".
Reimplemented from CanvasFigure.
00040 { 00041 if (_showMask) { 00042 int[] ccs = new int[4]; 00043 Converter.ICStoCCS(_maskIcs, ccs, getZoomFactor()); 00044 g.drawImage(_bufIm, ccs[0], ccs[1], ccs[2] - ccs[0], 00045 ccs[3] - ccs[1], null); 00046 } 00047 if (_showChain) 00048 super.draw(g); 00049 } |
|
00053 { 00054 return _blob; 00055 } |
|
Override CanvasFigure interface to update the color of the mask. The color of the chain is set to the inverted color. Reimplemented from CanvasFigure.
00062 { 00063 if (color == null) 00064 return; 00065 00066 _maskColor = color; 00067 _chainColor = new Color(color.getRGB() ^ INV_PIX); 00068 00069 super.setColor(_chainColor); // chain is drawn by CanvasFigure 00070 00071 // We have to do the mask ourselves 00072 for (int i=0; i<_pixels.length; i++) { 00073 if (_pixels[i] != NO_PIX) { 00074 _pixels[i] = _maskColor.getRGB(); 00075 } 00076 } 00077 } |
|
Override CanvasFigure interface to update the transparency of the mask.
Reimplemented from CanvasFigure.
00083 { 00084 super.setTransparency(trans); // chain is handled by CanvasFigure 00085 00086 // We have to do the mask ourselves 00087 int scaled = (((int)(1.0 - getTransparency() * 255)) << 24) | 0x00FFFFFF; 00088 for (int i=0; i<_pixels.length; i++) { 00089 if (_pixels[i] != NO_PIX) { 00090 _pixels[i] = (_pixels[i] | 0xFF000000) & scaled; 00091 } 00092 } 00093 } |
|
00097 { 00098 _showMask = b; 00099 } |
|
00103 { 00104 _showChain = b; 00105 } |
|
Overrides CanvasObject interface. Extends the list of callable functions obtained from the parent with the functions for this class. Reimplemented from CanvasFigure.
00113 { 00114 Vector v = super.getVisualChangeMethods(); 00115 v.add(new CallableMethod("setShowMask", "boolean", "b", "boolean")); 00116 v.add(new CallableMethod("setShowChain", "boolean", "b", "boolean")); 00117 return v; 00118 } |
|
Derived classes have to implement this method to supply the shape that represents the CanvasFigures. It is used to draw to figure as well as determine which figure is selected (hit) by the cursor within a canvas. Reimplemented from CanvasFigure.
00129 { 00130 int[] xp = getAddXCcs(); 00131 int[] yp = getAddYCcs(); 00132 GeneralPath path = new GeneralPath(GeneralPath.WIND_NON_ZERO, xp.length); 00133 path.moveTo(xp[0], yp[0]); 00134 for (int i=1 ; i < xp.length ; i++) 00135 path.lineTo(xp[i], yp[i]); 00136 return path; 00137 } |
|
Derived classes have to implement this method to indicate whether they are selected (hit) based on their stroke (border) or on their interior.
Reimplemented from CanvasFigure.
00141 { 00142 return false; 00143 } |