/** * Destroy the image and release any native resources. * Calls on a destroyed image have undefined results * * @throws SlickException Indicates a failure to release resources on the graphics card */ public void destroy() throws SlickException { if (isDestroyed()) { return; } destroyed = true; texture.release(); GraphicsFactory.releaseGraphicsForImage(this); }
/** * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer) */ public void init(GameContainer container) throws SlickException { testImage = new Image("testdata/logo.png"); preloaded = new Image("testdata/logo.png"); testFont = new AngelCodeFont("testdata/hiero.fnt","testdata/hiero.png"); target = new Image(400,300); cut = new Image(100,100); gTarget = target.getGraphics(); offscreenPreload = preloaded.getGraphics(); offscreenPreload.drawString("Drawing over a loaded image", 5, 15); offscreenPreload.setLineWidth(5); offscreenPreload.setAntiAlias(true); offscreenPreload.setColor(Color.blue.brighter()); offscreenPreload.drawOval(200, 30, 50, 50); offscreenPreload.setColor(Color.white); offscreenPreload.drawRect(190,20,70,70); offscreenPreload.flush(); if (GraphicsFactory.usingFBO()) { using = "FBO (Frame Buffer Objects)"; } else if (GraphicsFactory.usingPBuffer()) { using = "Pbuffer (Pixel Buffers)"; } System.out.println(preloaded.getColor(50,50)); }
/** * Entry point to our test * * @param argv The arguments to pass into the test */ public static void main(String[] argv) { try { GraphicsFactory.setUseFBO(false); AppGameContainer container = new AppGameContainer(new ImageGraphicsTest()); container.setDisplayMode(800,600,false); container.start(); } catch (SlickException e) { e.printStackTrace(); } }
/** * Destroy the image and release any native resources. * Calls on a destroyed image have undefined results * * @throws SlickException Indicates a failure to release resources on the graphics card */ public void destroy() throws SlickException { if (isDestroyed()) { return; } flushPixelData(); destroyed = true; texture.release(); GraphicsFactory.releaseGraphicsForImage(this); }
/** * Destroy the image and release any native resources. * Calls on a destroyed image have undefined results * */ public void destroy() { if (isDestroyed()) { return; } flushPixelData(); destroyed = true; texture.release(); GraphicsFactory.releaseGraphicsForImage(this); }
/** * Get a graphics context that can be used to draw to this image * * @return The graphics context used to render to this image * @throws SlickException Indicates a failure to create a graphics context */ public Graphics getGraphics() throws SlickException { return GraphicsFactory.getGraphicsForImage(this); }
/** * Get a graphics context that can be used to draw to this image * * @return The graphics context used to render to this image * @throws SlickException Indicates a failure to create a graphics context */ Graphics getGraphics() throws SlickException { return GraphicsFactory.getGraphicsForImage(this); }