// 1440回0.25度ごと回転させて、半径5で球を描画
1440 * { ry 0.25 } 1 * { x 5 color #7799ff } sphere
// 白色の地面
{ y -1 s 200 0.1 200 color white } box
Structure Synthでの出力画像

Sunflowでの出力画像
import java.io.*;
import javax.media.opengl.*;
import com.sun.opengl.util.*;
public class JoglSample17
{
// 出力画像サイズ
private static int width = 300;
private static int height = 300;
public static void main(String args[])
throws IOException
{
GLDrawableFactory gldf =
GLDrawableFactory.getFactory();
GLCapabilities glc = new GLCapabilities();
glc.setDoubleBuffered(false);
GLPbuffer buf = gldf.createGLPbuffer(
glc, null, width, height, null);
buf.addGLEventListener(
new GLEventListener(){
// 初期化
public void init(GLAutoDrawable dr)
{
GL gl = dr.getGL();
// 背景色
gl.glClearColor(
(float)0xf0/(float)0xff,
(float)0xf0/(float)0xff,
(float)0xf0/(float)0xff,
1f);
}
public void display(GLAutoDrawable dr)
{
GL gl = dr.getGL();
GLUT glut = new GLUT();
gl.glViewport(0, 0, width, height);
// 透視投影
gl.glMatrixMode(GL.GL_PROJECTION);
gl.glLoadIdentity();
float ratio = (float)height/(float)width;
gl.glFrustum(-1.0f, 1.0f, -ratio, ratio,
5.0f, 40.0f);
gl.glMatrixMode(GL.GL_MODELVIEW);
gl.glLoadIdentity();
gl.glTranslatef(0.0f, -1.0f, -15.0f);
gl.glEnable(GL.GL_LIGHTING);
gl.glEnable(GL.GL_LIGHT0);
gl.glEnable(gl.GL_COLOR_MATERIAL);
gl.glEnable(GL.GL_NORMALIZE);
gl.glEnable(GL.GL_DEPTH_TEST);
gl.glEnable(GL.GL_CULL_FACE);
gl.glClear(GL.GL_COLOR_BUFFER_BIT |GL.GL_DEPTH_BUFFER_BIT );
gl.glPushMatrix();
// 面の色を設定
gl.glColor3f(
(float)0x77/(float)0xff,
(float)0x99/(float)0xff,
(float)0xff/(float)0xff
);
// X軸回転
gl.glRotatef(-70.0f, 1.0f, 0.0f, 0.0f);
// Y軸回転
gl.glRotatef(10.0f, 0.0f, 1.0f, 0.0f);
// 円錐を描画
glut.glutSolidCone(2.0f, 3.5f, 16, 4);
gl.glPopMatrix();
}
public void reshape(
GLAutoDrawable dr,
int x, int y,
int width, int height){}
public void displayChanged(
GLAutoDrawable dr,
boolean modeChanged,
boolean deviceChanged){}
}
);
GLContext context = buf.createContext(null);
context.makeCurrent();
buf.display();
Screenshot.writeToFile(
new File("sample1175a.png"), width, height, true);
context.release();
context.destroy();
}
}

import java.awt.*
import groovy.swing.j2d.swf.*
def gr = new SWFRenderer()
gr.renderToFile("sample1055a.swf", 200, 200){
raceCarShape( x:0, y:40, width:200, height:120,
fill: new Color(0xbb, 0xdd, 0xff, 0xff),
borderColor: new Color(0x11, 0x33, 0x77, 0xff) )
}


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ja"
xml:lang="ja" dir="ltr">
<head>
<title>sample1154(ImageMagick6.5.2)</title>
</head>
<body>
<?php
$im = new Imagick("sf2.jpg");
$im->modulateImage(100, 50, 100);
$im->spreadImage(3);
$im->motionBlurImage(0,7,270);
$im->tintImage(new ImagickPixel("#bbddff"),new ImagickPixel("#f0f0f0"));
$im->writeImage('sample1154a.png');
$im->destroy();
?>
<img src="sample1154a.png" /><br />
</body>
</html>

import java.awt.*
import groovy.swing.j2d.swf.*
def gr = new SWFRenderer()
gr.renderToFile("sample1054a.swf", 200, 200){
quadCurve( x1:200, y1:0, ctrlx:0, ctrly: 100,
x2:200, y2:200,
borderColor: new Color(0x11, 0x33, 0x77, 0xff) )
}



import java.io.*;
import javax.media.opengl.*;
import com.sun.opengl.util.*;
public class JoglSample16
{
// 出力画像サイズ
private static int width = 300;
private static int height = 300;
public static void main(String args[])
throws IOException
{
GLDrawableFactory gldf =
GLDrawableFactory.getFactory();
GLCapabilities glc = new GLCapabilities();
glc.setDoubleBuffered(false);
GLPbuffer buf = gldf.createGLPbuffer(
glc, null, width, height, null);
buf.addGLEventListener(
new GLEventListener(){
// 初期化
public void init(GLAutoDrawable dr)
{
GL gl = dr.getGL();
// 背景色
gl.glClearColor(
(float)0xf0/(float)0xff,
(float)0xf0/(float)0xff,
(float)0xf0/(float)0xff,
1f);
}
public void display(GLAutoDrawable dr)
{
GL gl = dr.getGL();
GLUT glut = new GLUT();
gl.glViewport(0, 0, width, height);
// 透視投影
gl.glMatrixMode(GL.GL_PROJECTION);
gl.glLoadIdentity();
float ratio = (float)height/(float)width;
gl.glFrustum(-1.0f, 1.0f, -ratio, ratio,
5.0f, 40.0f);
gl.glMatrixMode(GL.GL_MODELVIEW);
gl.glLoadIdentity();
gl.glTranslatef(0.0f, 0.0f, -10.0f);
gl.glEnable(GL.GL_LIGHTING);
gl.glEnable(GL.GL_LIGHT0);
gl.glEnable(gl.GL_COLOR_MATERIAL);
gl.glEnable(GL.GL_NORMALIZE);
gl.glEnable(GL.GL_DEPTH_TEST);
gl.glEnable(GL.GL_CULL_FACE);
gl.glClear(GL.GL_COLOR_BUFFER_BIT |GL.GL_DEPTH_BUFFER_BIT );
gl.glPushMatrix();
// 面の色を設定
gl.glColor3f(
(float)0x77/(float)0xff,
(float)0x99/(float)0xff,
(float)0xff/(float)0xff
);
// X軸回転
gl.glRotatef(45.0f, 1.0f, 0.0f, 0.0f);
// Y軸回転
gl.glRotatef(25.0f, 0.0f, 1.0f, 0.0f);
// 立方体を描画
glut.glutSolidCube(2.0f);
gl.glPopMatrix();
}
public void reshape(
GLAutoDrawable dr,
int x, int y,
int width, int height){}
public void displayChanged(
GLAutoDrawable dr,
boolean modeChanged,
boolean deviceChanged){}
}
);
GLContext context = buf.createContext(null);
context.makeCurrent();
buf.display();
Screenshot.writeToFile(
new File("sample1174a.png"), width, height, true);
context.release();
context.destroy();
}
}

import java.awt.*
import groovy.swing.j2d.swf.*
def gr = new SWFRenderer()
gr.renderToFile("sample1053a.swf", 200, 200){
iceCreamShape( x:0, y:40, width: 200, height:120,
fill: new Color(0xbb, 0xdd, 0xff, 0xff),
borderColor: new Color(0x11, 0x33, 0x77, 0xff) )
}

require 'RMagick'
include Magick
images = ImageList.new("sf.jpg")
images.alpha = ActivateAlphaChannel
images2 = ImageList.new
images2.new_image(20, 20){
self.background_color = "none"
}
dr = Draw.new
dr.fill = "white"
dr.roundrectangle(0,0,18,18,4,4);
dr.draw(images2)
images3 = ImageList.new()
images3.new_image(images.columns, images.rows,
TextureFill.new(images2))
images3.alpha = ActivateAlphaChannel
images3.virtual_pixel_method = TileVirtualPixelMethod
images3[0] = images3.distort(ScaleRotateTranslateDistortion, [20])
images.composite(images3, CenterGravity, 0, 0,
DstInCompositeOp).write("sample1148a.png")
exit

import java.awt.*
import groovy.swing.j2d.swf.*
def gr = new SWFRenderer()
gr.renderToFile("sample1052a.swf", 200, 200){
footShape( x:0, y:30, width:200, height:140,
fill: new Color(0xbb, 0xdd, 0xff, 0xff),
borderColor: new Color(0x11, 0x33, 0x77, 0xff) )
}

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ja"
xml:lang="ja" dir="ltr">
<head>
<title>sample1153(ImageMagick6.5.2)</title>
</head>
<body>
<?php
$im = new Imagick("sf2.jpg");
$im->modulateImage(80, 180, 100);
$im->sketchImage(10,0,135);
$im->spreadImage(2);
$im->oilPaintImage(2);
$im->writeImage('sample1153a.png');
$im->destroy();
?>
<img src="sample1153a.png" /><br />
</body>
</html>


import java.awt.*
import groovy.swing.j2d.swf.*
def gr = new SWFRenderer()
gr.renderToFile("sample1052a.swf", 200, 200){
fishShape( x:0, y:40, width:200, height:120,
fill: new Color(0xbb, 0xdd, 0xff, 0xff),
borderColor: new Color(0x11, 0x33, 0x77, 0xff) )
}



import java.io.*;
import javax.media.opengl.*;
import com.sun.opengl.util.*;
public class JoglSample15
{
// 出力画像サイズ
private static int width = 300;
private static int height = 300;
public static void main(String args[])
throws IOException
{
GLDrawableFactory gldf =
GLDrawableFactory.getFactory();
GLCapabilities glc = new GLCapabilities();
glc.setDoubleBuffered(false);
GLPbuffer buf = gldf.createGLPbuffer(
glc, null, width, height, null);
buf.addGLEventListener(
new GLEventListener(){
// 初期化
public void init(GLAutoDrawable dr)
{
GL gl = dr.getGL();
// 背景色
gl.glClearColor(
(float)0x77/(float)0xff,
(float)0x99/(float)0xff,
(float)0xff/(float)0xff,
1f);
}
public void display(GLAutoDrawable dr)
{
GL gl = dr.getGL();
GLUT glut = new GLUT();
gl.glViewport(0, 0, width, height);
// 透視投影
gl.glMatrixMode(GL.GL_PROJECTION);
gl.glLoadIdentity();
float ratio = (float)height/(float)width;
gl.glFrustum(-1.0f, 1.0f, -ratio, ratio,
5.0f, 40.0f);
gl.glMatrixMode(GL.GL_MODELVIEW);
gl.glLoadIdentity();
gl.glTranslatef(0.0f, 0.0f, -10.0f);
gl.glClear(GL.GL_COLOR_BUFFER_BIT);
gl.glPushMatrix();
// ワイヤーフレームで四角形を描画
gl.glBegin(GL.GL_LINE_LOOP);
gl.glVertex2f(-1,-1);
gl.glVertex2f(1,-1);
gl.glVertex2f(1,1);
gl.glVertex2f(-1,1);
gl.glEnd();
gl.glPopMatrix();
}
public void reshape(
GLAutoDrawable dr,
int x, int y,
int width, int height){}
public void displayChanged(
GLAutoDrawable dr,
boolean modeChanged,
boolean deviceChanged){}
}
);
GLContext context = buf.createContext(null);
context.makeCurrent();
buf.display();
Screenshot.writeToFile(
new File("sample1173a.png"), width, height, true);
context.release();
context.destroy();
}
}

import java.awt.*
import groovy.swing.j2d.swf.*
def gr = new SWFRenderer()
gr.renderToFile("sample1051a.swf", 200, 200){
donut( cx:100, cy:100, ir:50, or:90,
fill: new Color(0xbb, 0xdd, 0xff, 0xff),
borderColor: new Color(0x11, 0x33, 0x77, 0xff) )
}


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ja"
xml:lang="ja" dir="ltr">
<head>
<title>sample1152(ImageMagick6.5.2)</title>
</head>
<body>
<?php
/* 画像サイズ */
$sw = 200;
$sh = 200;
/* 円の半径 */
$minr = 5;
$maxr = 20;
/* 線の太さ */
$minsw = 3;
$maxsw = 6;
/* 円の数 */
$noc = 30;
/* 円の色 */
$cc = array(
"#7799ff80",
"#ffd02080",
"#ff705080",
"#c0ff9080"
);
$im = new Imagick();
$im->newImage($sw, $sh, "none");
$im->setImageMatte(true);
$idraw = new ImagickDraw();
$idraw->setFillColor("none");
for($lc=0;$lc<$noc;$lc++){
$idraw->setStrokeColor($cc[rand(0,count($cc)-1)]);
$idraw->setStrokeWidth(rand($minsw, $maxsw));
$rad = rand($minr, $maxr);
$idraw->ellipse(rand(0,$sw),rand(0,$sh),
$rad, $rad,0,360);
}
$im->drawImage($idraw);
$im->writeImage('sample1152a.png');
$idraw->destroy();
$im->destroy();
?>
<img src="sample1152a.png" /><br />
</body>
</html>
import java.awt.*
import groovy.swing.j2d.swf.*
def gr = new SWFRenderer()
gr.renderToFile("sample1050a.swf", 200, 200){
dolphinShape( x:0, y:20, width:200, height:160,
fill: new Color(0xbb, 0xdd, 0xff, 0xff),
borderColor: new Color(0x11, 0x33, 0x77, 0xff) )
}



import java.io.*;
import javax.media.opengl.*;
import com.sun.opengl.util.*;
public class JoglSample14
{
// 出力画像サイズ
private static int width = 300;
private static int height = 300;
public static void main(String args[])
throws IOException
{
GLDrawableFactory gldf =
GLDrawableFactory.getFactory();
GLCapabilities glc = new GLCapabilities();
glc.setDoubleBuffered(false);
GLPbuffer buf = gldf.createGLPbuffer(
glc, null, width, height, null);
buf.addGLEventListener(
new GLEventListener(){
// 初期化
public void init(GLAutoDrawable dr)
{
GL gl = dr.getGL();
// 背景色
gl.glClearColor(
(float)0x77/(float)0xff,
(float)0x99/(float)0xff,
(float)0xff/(float)0xff,
1f);
}
public void display(GLAutoDrawable dr)
{
GL gl = dr.getGL();
GLUT glut = new GLUT();
gl.glViewport(0, 0, width, height);
// 透視投影
gl.glMatrixMode(GL.GL_PROJECTION);
gl.glLoadIdentity();
float ratio = (float)height/(float)width;
gl.glFrustum(-1.0f, 1.0f, -ratio, ratio,
5.0f, 40.0f);
gl.glMatrixMode(GL.GL_MODELVIEW);
gl.glLoadIdentity();
gl.glTranslatef(0.0f, 0.0f, -15.0f);
gl.glClear(GL.GL_COLOR_BUFFER_BIT);
// ラインスタイルを設定
gl.glEnable(GL.GL_LINE_STIPPLE);
gl.glLineStipple(2, (short)0x3333);
gl.glPushMatrix();
// X軸回転
gl.glRotatef(45.0f, 1.0f, 0.0f, 0.0f);
// Y軸回転
gl.glRotatef(10.0f, 0.0f, 1.0f, 0.0f);
// ワイヤフレームで12面体を描画
glut.glutWireDodecahedron();
gl.glPopMatrix();
}
public void reshape(
GLAutoDrawable dr,
int x, int y,
int width, int height){}
public void displayChanged(
GLAutoDrawable dr,
boolean modeChanged,
boolean deviceChanged){}
}
);
GLContext context = buf.createContext(null);
context.makeCurrent();
buf.display();
Screenshot.writeToFile(
new File("sample1172a.png"), width, height, true);
context.release();
context.destroy();
}
}
import java.awt.*
import groovy.swing.j2d.swf.*
def gr = new SWFRenderer()
gr.renderToFile("sample1049a.swf", 200, 200){
cubicCurve( x1: 40, y1:200, ctrlx1:0, ctrly1:50,
ctrlx2:200, ctrly2: 0, x2:160, y2:200,
borderColor: new Color(0x11, 0x33, 0x77, 0xff) )
}



import java.io.*;
import javax.media.opengl.*;
import com.sun.opengl.util.*;
public class JoglSample13
{
// 出力画像サイズ
private static int width = 300;
private static int height = 300;
public static void main(String args[])
throws IOException
{
GLDrawableFactory gldf =
GLDrawableFactory.getFactory();
GLCapabilities glc = new GLCapabilities();
glc.setDoubleBuffered(false);
GLPbuffer buf = gldf.createGLPbuffer(
glc, null, width, height, null);
buf.addGLEventListener(
new GLEventListener(){
// 初期化
public void init(GLAutoDrawable dr)
{
GL gl = dr.getGL();
// 背景色
gl.glClearColor(
(float)0x77/(float)0xff,
(float)0x99/(float)0xff,
(float)0xff/(float)0xff,
1f);
}
public void display(GLAutoDrawable dr)
{
GL gl = dr.getGL();
GLUT glut = new GLUT();
gl.glViewport(0, 0, width, height);
// 透視投影
gl.glMatrixMode(GL.GL_PROJECTION);
gl.glLoadIdentity();
float ratio = (float)height/(float)width;
gl.glFrustum(-1.0f, 1.0f, -ratio, ratio,
5.0f, 40.0f);
gl.glMatrixMode(GL.GL_MODELVIEW);
gl.glLoadIdentity();
gl.glTranslatef(0.0f, 0.0f, -15.0f);
gl.glClear(GL.GL_COLOR_BUFFER_BIT);
// ワイヤーフレームの線の太さを設定
gl.glLineWidth(4f);
gl.glPushMatrix();
// X軸回転
gl.glRotatef(45.0f, 1.0f, 0.0f, 0.0f);
// Y軸回転
gl.glRotatef(20.0f, 0.0f, 1.0f, 0.0f);
// ワイヤーフレームで円錐を描画
glut.glutWireCone(2.0f, 3f, 16, 4);
gl.glPopMatrix();
}
public void reshape(
GLAutoDrawable dr,
int x, int y,
int width, int height){}
public void displayChanged(
GLAutoDrawable dr,
boolean modeChanged,
boolean deviceChanged){}
}
);
GLContext context = buf.createContext(null);
context.makeCurrent();
buf.display();
Screenshot.writeToFile(
new File("sample1171a.png"), width, height, true);
context.release();
context.destroy();
}
}
import java.awt.*
import groovy.swing.j2d.swf.*
def gr = new SWFRenderer()
gr.renderToFile("sample1048a.swf", 200, 200){
cross( cx: 100, cy: 100, width:20, radius:50,
fill: new Color(0xbb, 0xdd, 0xff, 0xff),
borderColor: new Color(0x11, 0x33, 0x77, 0xff) )
}



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ja"
xml:lang="ja" dir="ltr">
<head>
<title>sample1105(ImageMagick6.5.2)</title>
</head>
<body>
<?php
$im = new Imagick("sf.jpg");
$im->setImageVirtualPixelMethod(Imagick::VIRTUALPIXELMETHOD_TILE);
$points = array(0.25, 60);
//$im->distortImage(Imagick::DISTORTION_SCALEROTATETRANSLATE,
// $points, false);
// ScaleRotateTranslateDistortion in distort.h
$im->distortImage(3, $points, false);
$im->writeImage('sample1105a.png');
$im->destroy();
?>
<img src="sample1105a.png" /><br />
</body>
</html>
import java.awt.*
import groovy.swing.j2d.swf.*
def gr = new SWFRenderer()
gr.renderToFile("sample1047a.swf", 200, 200){
butterflyShape( x: 0, y: 0, width: 200, height: 200,
fill: new Color(0xbb, 0xdd, 0xff, 0xff),
borderColor: new Color(0x11, 0x33, 0x77, 0xff) )
}

import java.io.*;
import javax.media.opengl.*;
import com.sun.opengl.util.*;
public class JoglSample12
{
// 出力画像サイズ
private static int width = 300;
private static int height = 300;
public static void main(String args[])
throws IOException
{
GLDrawableFactory gldf =
GLDrawableFactory.getFactory();
GLCapabilities glc = new GLCapabilities();
glc.setDoubleBuffered(false);
GLPbuffer buf = gldf.createGLPbuffer(
glc, null, width, height, null);
buf.addGLEventListener(
new GLEventListener(){
// 初期化
public void init(GLAutoDrawable dr)
{
GL gl = dr.getGL();
// 背景色
gl.glClearColor(
(float)0xff/(float)0xff,
(float)0xff/(float)0xff,
(float)0xff/(float)0xff,
1f);
}
public void display(GLAutoDrawable dr)
{
GL gl = dr.getGL();
GLUT glut = new GLUT();
gl.glViewport(0, 0, width, height);
// 透視投影
gl.glMatrixMode(GL.GL_PROJECTION);
gl.glLoadIdentity();
float ratio = (float)height/(float)width;
gl.glFrustum(-1.0f, 1.0f, -ratio, ratio,
5.0f, 40.0f);
gl.glMatrixMode(GL.GL_MODELVIEW);
gl.glLoadIdentity();
gl.glTranslatef(0.0f, 0.0f, -15.0f);
gl.glClear(GL.GL_COLOR_BUFFER_BIT);
// ワイヤーフレームの色を設定
gl.glColor3f((float)0x77/(float)0xff,
(float)0x99/(float)0xff,
(float)0xff/(float)0xff);
gl.glPushMatrix();
// X軸回転
gl.glRotatef(45.0f, 1.0f, 0.0f, 0.0f);
// Y軸回転
gl.glRotatef(20.0f, 0.0f, 1.0f, 0.0f);
// ワイヤーフレームでティーポットを描画する
glut.glutWireTeapot(1.5f);
gl.glPopMatrix();
}
public void reshape(
GLAutoDrawable dr,
int x, int y,
int width, int height){}
public void displayChanged(
GLAutoDrawable dr,
boolean modeChanged,
boolean deviceChanged){}
}
);
GLContext context = buf.createContext(null);
context.makeCurrent();
buf.display();
Screenshot.writeToFile(
new File("sample1170a.png"), width, height, true);
context.release();
context.destroy();
}
}
import java.awt.*
import groovy.swing.j2d.swf.*
// groovy 1.6.0, JDK6 update12
def gr = new SWFRenderer()
gr.renderToFile("sample1046a.swf", 200, 200){
balloon( x: 80, y: 20, width: 100, height: 100,
fill: color("#bbddff"),
tabLocation: "left",
tabDisplacement: 0.8,
tabHeight: 10,
tabWidth: 10,
fill: new Color(0xbb, 0xdd, 0xff, 0xff),
borderColor: new Color(0x11, 0x33, 0x77, 0xff) )
}