Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

GJavaOutput Class Reference

Java (applet) output processor. More...

Inheritance diagram for GJavaOutput:

GOutput List of all members.

Public Member Functions

void GJavaOutput ()
 Constructs an applet output processor.

void setup (Object doc, String appletName)
 Java output printing parametrs setup function (needed only for print functions).

String get (GCanvas gcanvas)
 Returns the image canvas string to be passed to Java.

void print (GCanvas gcanvas)
 Passes the image canvas String to a given applet.


Public Attributes

Integer generation_time
 Time (in ms.) used for the generation of the image string to be passed to the applet.

Integer alpha
 Alpha chanel value.

String appletName
 The name of an applet providing setImage function.

Object doc
 Javascript document object (usually this.document).


Detailed Description

Java (applet) output processor.

This output processor can be used to pass your canvas to a Java applet for rendering.


Member Function Documentation

String GJavaOutput::get GCanvas  gcanvas  )  [inline]
 

Returns the image canvas string to be passed to Java.

Returns:
String representing the bytes of the image separated by spaces;
Parameters:
gcanvas 2D image canvas.

void GJavaOutput::print GCanvas  gcanvas  )  [inline]
 

Passes the image canvas String to a given applet.

Parameters:
gcanvas 2D image canvas.

void GJavaOutput::setup Object  doc,
String  appletName
[inline]
 

Java output printing parametrs setup function (needed only for print functions).

Parameters:
doc Document object (usually this.document).
appletName Reciving java applet name.


Member Data Documentation

String GJavaOutput::appletName
 

The name of an applet providing setImage function.

Example of an applet providing setImage function:

-----------------------------------------------------------

import java.applet.Applet; import java.awt.Graphics; import java.awt.Image; import java.awt.Component; import java.lang.Integer; import java.util.StringTokenizer;

public class ImageOutput extends Applet { Image JSImage = null;

public void init() { // some initialisation here }

public void paint(Graphics g) { if (this.JSImage != null) { g.drawImage(this.JSImage, 0, 0, this); } }

public void setImage(int w, int h, String pixels) { int pix[] = new int[w * h]; StringTokenizer st = new StringTokenizer(pixels," "); int index = 0; while (st.hasMoreTokens()) { pix[index++]=Integer.parseInt(st.nextToken()); } this.JSImage = createImage(new java.awt.image.MemoryImageSource(w, h, pix, 0, w)); repaint(); } }

-----------------------------------------------------------
Javascript is used to passed a String of the image bytes separated by space. Array would be a better choice, but it seems that MS IE fails to pass JavaScript Array to Java correctly.

Needed only for print function.

Object GJavaOutput::doc
 

Javascript document object (usually this.document).

Needed only for print function.


The documentation for this class was generated from the following file:
This is a documentation for JSGraphics, a powerfull JavaScript graphics library
© 2003 by Kitya Karlson
Produced using DoxyGen.