programac

Páginas: 2 (370 palabras) Publicado: 14 de abril de 2013
package ch.epfl.flamemaker.flame;

import java.io.FileNotFoundException;
import java.io.PrintStream;
import java.util.ArrayList;

import ch.epfl.flamemaker.geometry2d.AffineTransformation;import ch.epfl.flamemaker.geometry2d.Point;
import ch.epfl.flamemaker.geometry2d.Rectangle;
import ch.epfl.flamemaker.color.*;
import ch.epfl.flamemaker.flame.*;

public class FlamePPMMaker {/**
* @param args
*/
public static void main(String[] args) {

// TODO Auto-generated method stub
int [] [] variation;
PrintStream file = null;
Palette palette;ArrayList colorList = new ArrayList();
colorList.add(Color.RED);
colorList.add(Color.GREEN);
colorList.add(Color.BLUE);
palette = new InterpolatedPalette(colorList);

double[]variation1 = {1, 0.1, 0, 0.4, 0, 0};
double[] variation2 = {0, 0, 0, 0, 0.8, 1};
double[] variation3 = {1, 0, 0, 0, 0, 0};

ArrayList transformationList = new ArrayList();transformationList.add(new FlameTransformation(new AffineTransformation(-0.4113504, -0.7124804, -0.4, 0.7124795, -0.4113508, 0.8), variation1));
transformationList.add(new FlameTransformation(newAffineTransformation(-0.3957339, 0,-1.6,0, -0.3957337, 0.2), variation2));
transformationList.add(new FlameTransformation(new AffineTransformation(0.4810169, 0, 1, 0, 0.4810169 ,0.9), variation3));Flame popo = new Flame(transformationList);


FlameAccumulator image = popo.compute(new Rectangle (new Point(-0.25, 0), 5, 4), 500, 400, 50);

try {

file = newPrintStream("popo.ppm") ;
}

catch(FileNotFoundException e) {


}


file.println("P3");
file.println(image.width() + " " + image.height());file.println("255");

int packedRGB;

for( int i=0 ; i< image.height(); i++){
for (int j=0; j < image.width();j++) {
packedRGB = image.color(palette, Color.BLACK, j, i).asPackedRGB();...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • PROGRAMAC DE S
  • Programac.
  • PROGRAMAC ANUAL 1 ED FISICA
  • MODELO DE PROGRAMAC LIMA
  • Este Art Culo Trata Sobre El Lenguaje De Programac N

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS