Package com.jme3.texture.Image

Examples of com.jme3.texture.Image.Format

@author Portet to jme3 by user starcom "Paul Kashofer Austria" @see ImageGraphics

     * Starts the application. Creating a display and running the main loop.
     */
    public void start(){

        if (settings == null){
            settings = new AppSettings(true);
        }
       
        context = JmeSystem.newContext(settings, JmeContext.Type.OffscreenSurface);
        context.setSystemListener(this);
        context.create(false);
View Full Code Here


      new ModelInfo(activeModel, app.getAssetLogger().getKeys(activeModel.getRelPath(workspace)));
    } catch (Exception e) {}
  }

  public static void createCanvas(){
    AppSettings settings = new AppSettings(true);
    settings.setWidth( Math.max(640, frame.getContentPane().getWidth()) );
    settings.setHeight( Math.max(480, frame.getContentPane().getHeight()) );

    app = new EditorApp();

    app.setPauseOnLostFocus(false);
    app.setSettings(settings);
    app.createCanvas();

    context = (JmeCanvasContext) app.getContext();
    canvas = context.getCanvas();
    canvas.setSize(settings.getWidth(), settings.getHeight());
  }
View Full Code Here

   * main for testing
   *
   * @param args
   */
  public static void main(String[] args) {
        AppSettings settings = new AppSettings(true);
        PolluxSettingsDialog.show(settings);
        System.out.println(settings.toString());
        System.exit(0);
  }
View Full Code Here

    }

    @Override
    public void start() {
     
        setSettings(new AppSettings(true));
        PolluxSettingsDialog.show(settings);
       
        super.start();
    }
View Full Code Here

    private static void checkImagesForCubeMap(Image... images) {
        if (images.length == 1) {
            return;
        }

        Format fmt = images[0].getFormat();
        int width = images[0].getWidth();
        int height = images[0].getHeight();
       
        ByteBuffer data = images[0].getData(0);
        int size = data != null ? data.capacity() : 0;
View Full Code Here

        viewPort = vp;

        // loadInitial()
        fsQuad = new Picture("HDR Fullscreen Quad");

        Format lumFmt = Format.RGB8;
        scene64FB = new FrameBuffer(64, 64, 1);
        scene64 = new Texture2D(64, 64, lumFmt);
        scene64FB.setColorTexture(scene64);
        scene64.setMagFilter(fbMagFilter);
        scene64.setMinFilter(fbMinFilter);
View Full Code Here

            }
        }


        // Allocate image data array
        Format format;
        byte[] rawData = null;
        int dl;
        if (pixelDepth == 32) {
            rawData = new byte[width * height * 4];
            dl = 4;
View Full Code Here

            scanline[i+1] = tmp;
        }
    }
   
    private Image load(InputStream in, boolean needYFlip) throws IOException{
        Format format = null;

        String fmtStr = readString(in);
        if (fmtStr.equals("PF")){
            format = Format.RGB32F;
        }else if (fmtStr.equals("Pf")){
            format = Format.Luminance32F;
        }else{
            throw new IOException("File is not PFM format");
        }

        String sizeStr = readString(in);
        int spaceIdx = sizeStr.indexOf(" ");
        if (spaceIdx <= 0 || spaceIdx >= sizeStr.length() - 1)
            throw new IOException("Invalid size syntax in PFM file");

        int width = Integer.parseInt(sizeStr.substring(0,spaceIdx));
        int height = Integer.parseInt(sizeStr.substring(spaceIdx+1));

        if (width <= 0 || height <= 0)
            throw new IOException("Invalid size specified in PFM file");
       
        String scaleStr = readString(in);
        float scale = Float.parseFloat(scaleStr);
        ByteOrder order = scale < 0 ? ByteOrder.LITTLE_ENDIAN : ByteOrder.BIG_ENDIAN;
        boolean needEndienFlip = order != ByteOrder.nativeOrder();

        // make sure all unneccessary stuff gets deleted from heap
        // before allocating large amount of memory
        System.gc();

        int bytesPerPixel = format.getBitsPerPixel() / 8;
        int scanLineBytes = bytesPerPixel * width;

        ByteBuffer imageData = BufferUtils.createByteBuffer(width * height * bytesPerPixel);
        byte[] scanline = new byte[width * bytesPerPixel];

 
View Full Code Here

        // some HDR images can get pretty big
        System.gc();

        // each pixel times size of component times # of components
        Format pixelFormat;
        if (writeRGBE){
            pixelFormat = Format.RGBA8;
        }else{
            pixelFormat = Format.RGB16F;
        }

        dataStore = BufferUtils.createByteBuffer(width * height * pixelFormat.getBitsPerPixel());

        int bytesPerPixel = pixelFormat.getBitsPerPixel() / 8;
        int scanLineBytes = bytesPerPixel * width;
        for (int y = height - 1; y >= 0; y--) {
            if (flipY)
                dataStore.position(scanLineBytes * y);

 
View Full Code Here

            }
        }
    }

    public static BufferedImage convert(Image image, boolean do16bit, boolean fullalpha, int mipLevel){
        Format format = image.getFormat();
        DecodeParams p = params.get(image.getFormat());
        if (p == null)
            throw new UnsupportedOperationException();

        int width = image.getWidth();
View Full Code Here

TOP

Related Classes of com.jme3.texture.Image.Format

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.