arun
Location : india
Member since : Sep 9, 2004
Messages : 2
|
Sep 9, 2004 at 9:21 AM
Hi all,
My problem:
1) I have an Image(NO NEED CREATE) & I have to Write TEXT on that image.
2) But This I need to Test in Windows using websphere env since my destination is to use this image in UNIX, I have used PJA2.5 Toolkit and made all settings.
3)I am giving the sample program which i am using now for testing.
I want to know
1)I need to write servlet to capture the image or jsp is enough to do that,
2)My setting right to test or need some changes,
3)Is my program work in unix.
Here is my program
Properties prop = System.getProperties ();
prop.put ("awt.toolkit", "com.eteks.awt.PJAToolkit");
System.setProperties (prop);
Class cls = com.eteks.awt.PJAToolkit.class;
String s=Toolkit.getDefaultToolkit().toString();
System.out.println ("Loaded class " + cls +"<BR>"+"The default toolkit is"+"<BR>"+s);
Font font = new Font("Courier", Font.PLAIN, 12);
com.eteks.awt.PJAFontData fontData = new com.eteks.awt.PJAFontData (font, 0, 65535);
System.out.println ("Loaded class " + cls +"<BR>"+"The default toolkit is"+"<BR>"+s);
PJAImage loadImage = new PJAImage (new com.eteks.awt.image.GIFDecoder (new FileInputStream ("C:/Workspaces/MyFirst/was.extension.pjaWeb/Web Content/invoice/invoice.jpg"), true));
// ToolkitDemo.GraphicsDrawer drawers [] ={new ToolkitDemo.GraphicsImageDrawer ()};
PJABufferedImage thumbImage=new PJABufferedImage(750,1000,PJABufferedImage.TYPE_INT_RGB);
Image image=new com.eteks.awt.PJAImage (100, 100);
// Image image1 = imageBuilder.createImage (drawers[].getWidth (), drawers [].getHeight ());
Graphics gc = image.getGraphics ();
// PJAImage image=new PJAImage(100,100);
image=Toolkit.getDefaultToolkit().getImage("C:/Workspaces/MyFirst/was.extension.pjaWeb/Web Content/invoice/invoice.jpg");
MediaTracker tracker = new MediaTracker(new Frame());
tracker.addImage(image, 0);
//image=(PJAImage)PJAGraphicsManager.getDefaultGraphicsManager().getImage("C:/Workspaces/MyFirst/was.extension.pjaWeb/Web Content/invoice/invoice.jpg");
tracker.waitForAll ();
Graphics2D graphics2D =(Graphics2D)thumbImage.createGraphics();
graphics2D.drawImage(image, 0, 0, image.getWidth(null), image.getHeight(null), null);
graphics2D.setColor(Color.black);
// graphics2D.drawString(Toolkit.getDefaultToolkit(),100,100);
JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(response.getOutputStream());
encoder.encode(thumbImage);
//response.getOutputStream().close ();
and my .SH is
java -Xbootclasspath/a:../lib/pja.jar:/../rtgraphics.jar
-Dawt.toolkit=com.eteks.awt.PJAToolkit \
-Djava.awt.graphicsenv=com.eteks.java2d.PJAGraphicsEnvironment \
-Djava2d.font.usePlatformFont=false \
-Djava.awt.fonts=/usr/local/jdk1.2.2/jre/lib/fonts \
-Duser.home=.. \
-classpath ../lib/pjatools.jar \
ToolkitDemo
PLS let know the answer for this asap
Thanks in ADVANCE
arun
--- arun
|