| 86 | }}} |
| 87 | |
| 88 | === A silly example === |
| 89 | |
| 90 | Here is a plugin to draw a red nose on a face or faces delineated in the "standard" manner: |
| 91 | |
| 92 | {{{ |
| 93 | |
| 94 | import Facemorph.*; |
| 95 | import Facemorph.psychomorph.*; |
| 96 | import java.awt.*; |
| 97 | import java.awt.geom.*; |
| 98 | import java.awt.image.*; |
| 99 | |
| 100 | |
| 101 | public class test implements Batchable { |
| 102 | public boolean process(ImageZoomPanel izp, boolean single) { |
| 103 | BufferedImage bimg = DelineatorForm.checkBufferedImage(izp.getImage()); |
| 104 | Point2D.Float p = izp.getTemplate().getPoint(55); |
| 105 | Point2D.Float le = izp.getTemplate().getPoint(0); |
| 106 | Point2D.Float re = izp.getTemplate().getPoint(1); |
| 107 | double eyesep = le.distance(re)/6.0; |
| 108 | Graphics g = bimg.getGraphics(); |
| 109 | g.setColor(Color.red); |
| 110 | g.fillOval((int)(p.x-eyesep), (int)(p.y-eyesep), (int)(eyesep*2), (int)(eyesep*2)); |
| 111 | izp.setImage(bimg); |
| 112 | return true; |
| 113 | } |
| 114 | |
| 115 | public boolean initialise(PsychoMorphForm psychomorph) { |
| 116 | return true; |
| 117 | } |
| 118 | public void finish(){ |
| 119 | } |
| 120 | public String getName() { |
| 121 | return "Red Nose"; |
| 122 | } |
| 123 | } |
| 124 | |