Package dwlab.shapes.maps

Examples of dwlab.shapes.maps.DoubleMap


 
  public static void main() {
    Platform.setClearingColor( 0.25d, 0.5d, 0d );

    clearScreen();
    DoubleMap doubleMap = new DoubleMap( mapSize, mapSize );
    drawDoubleMap( doubleMap );
    printText( "Step 1: creating Double map and set its resolution" );
    swapBuffers();
    waitForKey();

    clearScreen();
    doubleMap.perlinNoise( 16, 16, 0.25, 0.5, 4 );
    drawDoubleMap( doubleMap );
    printText( "Step 2: filling DoubleMap with Perlin noise" );
    swapBuffers();
    waitForKey();

    clearScreen();
    World.fromFile( "res/tileset.lw" );
    TileSet tileSet = World.editorData.tilesets.getFirst();
    TileMap tileMap = TileMap.create( tileSet, mapSize, mapSize );
    tileMap.setSize( 400d / 25d, 400d / 25d );
    Project.printText( "Step 3: loading world, extract tileset from there and" );
    Project.printText( "creating tilemap with same size and this tileset", 1 );
    drawDoubleMap( doubleMap );
    swapBuffers();
    waitForKey();

    clearScreen();
    doubleMap.extractTo( tileMap, 0.5d, 1d, filledTileNum );
    Project.printText( "Step 4: setting tiles number of tilemap to FilledTileNum" );
    Project.printText( "if corresponding value of Double map is higher than 0.5", 1 );
    tileMap.draw();
    drawSignature();
    swapBuffers();
View Full Code Here


    LWJGL.init();
    main();
  }
 
  public static void main() {
    DoubleMap sourceMap = new DoubleMap( mapSize, mapSize );
    sourceMap.drawCircle( mapSize * 0.375d, mapSize * 0.375d, mapSize * 0.35d, 0.6d );
    draw( sourceMap.toNewImage(), "Source map" );

    DoubleMap targetMap = new DoubleMap( mapSize, mapSize );
    targetMap.drawCircle( mapSize * 0.625d, mapSize * 0.625d, mapSize * 0.35d, 0.8d );
    draw( targetMap.toNewImage(), "Target map" );

    DoubleMap doubleMap = new DoubleMap( mapSize, mapSize );
    doubleMap.paste( targetMap );
    doubleMap.paste( sourceMap, 0, 0, DoubleMap.PasteMode.ADD );
    doubleMap.limit();
    draw( doubleMap.toNewImage(), "Adding source map to target map" );

    doubleMap.paste( targetMap );
    doubleMap.paste( sourceMap, 0, 0, DoubleMap.PasteMode.MULTIPLY );
    draw( doubleMap.toNewImage(), "Multiplying source map with target map" );

    doubleMap.paste( targetMap );
    doubleMap.paste( sourceMap, 0, 0, DoubleMap.PasteMode.MAXIMUM );
    draw( doubleMap.toNewImage(), "Maximum of source map and target map" );

    doubleMap.paste( targetMap );
    doubleMap.paste( sourceMap, 0, 0, DoubleMap.PasteMode.MINIMUM );
    draw( doubleMap.toNewImage(), "Minimum of source map and target map" );

    ImageBuffer buffer = sourceMap.toNewImageBuffer( DoubleMap.Channel.RED );
    targetMap.paste( buffer, DoubleMap.Channel.GREEN );
    draw( buffer.toImage(), "Pasting maps to different color channels" );
  }
View Full Code Here

TOP

Related Classes of dwlab.shapes.maps.DoubleMap

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.