#1
Posted
:
Monday, February 20, 2017 10:19:36 AM(UTC)
Groups: Registered
Posts: 119
Was thanked: 4 time(s) in 4 post(s)
Below you will find sample code for creating non-automated annotations using LEADTOOLS 19 in Java. This simply creates a blank RasterImage in which annotations are then created and rendered to the image.
Code:
static void createAnn(){
RasterCodecs codecs = new RasterCodecs();
RasterImage image = RasterImage.create(750, 900, 24, 150, RasterColor.fromHtml("White"));
System.out.println("RasterImage created successful");
double inch = 720;
AnnContainer container = new AnnContainer();
container.setSize(LeadSizeD.create(8.5 * inch, 11 * inch));
AnnRectangleObject rectangleObject = new AnnRectangleObject();
rectangleObject.setRect(LeadRectD.create(3 * inch, 3 * inch, 1 * inch, 1 * inch));
container.getChildren().add(rectangleObject);
System.out.println("Rect created successful");
AnnNoteObject noteObject = new AnnNoteObject();
noteObject.setRect(LeadRectD.create(0, 0, 800, 800));
noteObject.setText("LEADTOOLS");
container.getChildren().add(noteObject);
System.out.println("Note created successful");
// Burn the annotations on this image
AnnJavaRenderingEngine renderingEngine = new AnnJavaRenderingEngine();
renderingEngine.renderOnImage(container, image);
codecs.save(image, "C:\\Java_Render.tif", RasterImageFormat.TIF, 0);
System.out.println("Render successful");
}
Nick Villalobos
Developer Support Engineer
LEAD Technologies, Inc.
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.