Inheritance diagram for CanvasMask::

Public Methods | |
| CanvasMask (Image im, double x, double y) | |
| CanvasMask (int[] pixels, double x, double y, int w, int h) | |
| CanvasMask (Image im, double x, double y, Color color, float trans, double ccs_scale) | |
| void | draw (Graphics g) |
| Draw CanvasObject on 'g', using internal CCS values. More... | |
| Object | clone () |
| Return an identical copy of this CanvasObject. More... | |
| boolean | isInside (double x, double y) |
| boolean | isNear (double x, double y) |
| void | setDimension (double w, double h) |
| Resize CanvasObject to width 'w' and height 'h'. More... | |
| void | doPixelFit (double zoomFactor) |
| Round internal ICS values to nearest natural number. More... | |
| void | setColor (Color newColor) |
| void | setTransparency (float trans) |
| Image | getMask () |
| boolean | isInsideCcs (int x, int y) |
| To be removed. More... | |
| boolean | isNearCcs (int x, int y) |
| To be removed. More... | |
| void | setDimension (int w, int h) |
| int | changePoint (int index, int x, int y) |
Static Public Attributes | |
| final int | NO_PIX = 0x00000000 |
Protected Methods | |
| void | initMask (int[] pixels, int w, int h, Color color) |
| void | initMask (Image im, Color color) |
Protected Attributes | |
| Image | image = null |
|
||||||||||||||||
|
|
|
||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||
|
|
|
|
Draw CanvasObject on 'g', using internal CCS values.
Reimplemented from CanvasObject.
00070 {
00071 if (image != null) {
00072 setupDrawMode(g);
00073 if (!getTransformOK()) {
00074 transformICStoCCS();
00075 }
00076 g.drawImage(image, getX1Ccs(), getY1Ccs(), getWidthCcs(), getHeightCcs(), null);
00077 }
00078 }
|
|
|
Return an identical copy of this CanvasObject.
Reimplemented from CanvasObject.
00082 {
00083 return (new CanvasMask(image, getX1()+0.5, getY1()+0.5,
00084 drawColor, transparency, getZoomFactor()));
00085 }
|
|
||||||||||||
|
00089 {
00090 return inBoundingBox(x, y);
00091 }
|
|
||||||||||||
|
00095 {
00096 return isInside(x, y);
00097 }
|
|
||||||||||||
|
Resize CanvasObject to width 'w' and height 'h'. Parameters are assumed Image Coordinate System values. Reimplemented from ScribbleObject.
00101 {
00102 // overrule super.setDimension(w, h), and do nothing
00103
00104 return;
00105 }
|
|
|
Round internal ICS values to nearest natural number. Although the ICS values are changed, they are not converted to 'integer' internally. Reimplemented from ScribbleObject.
|
|
|
Reimplemented from ScribbleFigure.
00122 {
00123 if (newColor == NO_COLOR) {
00124 return;
00125 }
00126 if (getWidth() > 0. && getHeight() > 0.) {
00127 drawColor = newColor;
00128 int width = (int)(getWidth() + 0.5);
00129 int height = (int)(getHeight() + 0.5);
00130 ImageBuffer ib = new ImageBuffer(image, width, height);
00131 int[] pixels = ib.getPixels();
00132
00133 for (int i=0; i<pixels.length; i++) {
00134 if (pixels[i] != NO_PIX) {
00135 pixels[i] = drawColor.getRGB();
00136 }
00137 }
00138
00139 ib.fill(pixels, width, height);
00140 image = ib.toImage();
00141 }
00142 }
|
|
|
Reimplemented from ScribbleFigure.
00146 {
00147 super.setTransparency(trans);
00148 int scaled = (((int)(transparency * 255)) << 24) | 0x00FFFFFF;
00149
00150 if (getWidth() > 0. && getHeight() > 0.) {
00151 int width = (int)(getWidth() + 0.5);
00152 int height = (int)(getHeight() + 0.5);
00153 ImageBuffer ib = new ImageBuffer(image, width, height);
00154 int[] pixels = ib.getPixels();
00155
00156 for (int i=0; i<pixels.length; i++) {
00157 if (pixels[i] != NO_PIX) {
00158 pixels[i] = (pixels[i] | 0xFF000000) & scaled;
00159 }
00160 }
00161
00162 ib.fill(pixels, width, height);
00163 image = ib.toImage();
00164 }
00165 }
|
|
|
00169 {
00170 return image;
00171 }
|
|
||||||||||||
|
To be removed.
Reimplemented from CanvasObject.
00189 {
00190 return inBoundingBoxCcs(x, y);
00191 }
|
|
||||||||||||
|
To be removed.
Reimplemented from CanvasObject.
00195 {
00196 return isInsideCcs(x, y);
00197 }
|
|
||||||||||||
|
Reimplemented from ScribbleObject.
00201 {
00202 // overrule super.setDimension(w, h), and do nothing
00203
00204 return;
00205 }
|
|
||||||||||||||||
|
Reimplemented from ScribbleFigure.
00209 {
00210 // overrule super.changePoint(index, x, y), and do nothing
00211
00212 return index;
00213 }
|
|
||||||||||||||||||||
|
00227 {
00228 ImageBuffer ib = new ImageBuffer(pixels, w, h);
00229 initMask(ib.toImage(), color);
00230 }
|
|
||||||||||||
|
00234 {
00235 resizeable = false;
00236 hasLineWidth = false;
00237 hasNoColor = false;
00238 image = im;
00239 if (image != null) {
00240 setWidth(image.getWidth(null));
00241 setHeight(image.getHeight(null));
00242 setColor(color);
00243 }
00244 transformICStoCCS();
00245 }
|
|
|
|
|
|
|
1.2.12 written by Dimitri van Heesch,
© 1997-2001