All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ext.plantuml.com.ctreber.acearth.gui.PixelCanvas Maven / Gradle / Ivy

Go to download

PlantUML is a component that allows to quickly write : * sequence diagram, * use case diagram, * class diagram, * activity diagram, * component diagram, * state diagram * object diagram

There is a newer version: 8059
Show newest version
package ext.plantuml.com.ctreber.acearth.gui;

import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.OutputStream;

import ext.plantuml.com.ctreber.acearth.renderer.RenderTarget;
import net.sourceforge.plantuml.security.SImageIO;

/**
 * 

* Swing compatible drawing surface for images and graphics. * *

* © 2002 Christian Treber, [email protected] * * @author Christian Treber, [email protected] * */ public class PixelCanvas implements RenderTarget { final private int fImageWidth; final private int fImageHeight; final private BufferedImage fEarthImage2; /** *

* Construct a canvas of the specified size. * * @param pWidth Width * @param pHeight Height */ public PixelCanvas(int pWidth, int pHeight) { fImageWidth = pWidth; fImageHeight = pHeight; fEarthImage2 = new BufferedImage(fImageWidth, fImageHeight, BufferedImage.TYPE_INT_RGB); } public Graphics2D getGraphics2D() { return fEarthImage2.createGraphics(); } public void setPixel(int pX, int pY, int pA, int pR, int pG, int pB) { setPixel(pX, pY, new Color(pR, pG, pB, pA)); } public void setPixel(int pX, int pY, Color pColor) { fEarthImage2.setRGB(pX, pY, pColor.getRGB()); } public int getImageWidth() { return fImageWidth; } public int getImageHeight() { return fImageHeight; } public void saveToImage(OutputStream os) throws IOException { SImageIO.write(fEarthImage2, "png", os); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy