Changes between Version 7 and Version 8 of plugin


Ignore:
Timestamp:
Dec 1, 2010, 9:20:24 PM (14 years ago)
Author:
bpt
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • plugin

    v7 v8  
    8484    }
    8585}
     86}}}
     87
     88=== A silly example ===
     89
     90Here is a plugin to draw a red nose on a face or faces delineated in the "standard" manner:
     91
     92{{{
     93
     94import Facemorph.*;
     95import Facemorph.psychomorph.*;
     96import java.awt.*;
     97import java.awt.geom.*;
     98import java.awt.image.*;
     99
     100
     101public 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
    86125}}}
    87126