•Graphics To Java Image

Graphics object g constructed using RasterArray[ ] or Raster[ ] is converted to the Java Image by ToJavaImage[ ].

In[16]:=

ji = ToJavaImage[g, width/4, height/4]

Then the Java Image ji is shown again as Graphics.

In[17]:=

gg = ShowJavaImage[ji]

A Graphics object is not always constructed by RasterArray/Raster. For example, Plot[ ] has graphics primitive(s) such as Line[ ](s.).

In[18]:=

pl = Plot[Sin[x], {x, 0, 2 Pi}]

In this example a Line[ ] is used to generate Graphics.

In[19]:=

pl[[1]]

By putting a string "pl" to the ToJavaImage[ ], the Plot[ ] is converted to the Java Image.

In[20]:=

jpl = ToJavaImage["pl", 288, 288, 72]

The rasterized image data is shown by ShowJavaImage[ ].

In[21]:=

gpl = ShowJavaImage[jpl]


Converted by Mathematica  (July 17, 2003)