Thread: Dump Any Sprite From The Cache

Results 1 to 3 of 3
  1. #1 Dump Any Sprite From The Cache 
    Ex Rune-Scaper

    Join Date
    Jun 2008
    Posts
    3,534
    Thanks given
    457
    Thanks received
    1,257
    Rep Power
    990
    rippp
    Attached image
    Reply With Quote  
     

  2. #2  
    Bossman

    ISAI's Avatar
    Join Date
    Sep 2012
    Posts
    1,916
    Thanks given
    655
    Thanks received
    1,366
    Rep Power
    5000
    That's pretty damn cool, nice job Seven
    Reply With Quote  
     

  3. #3  
    Ex Rune-Scaper

    Join Date
    Jun 2008
    Posts
    3,534
    Thanks given
    457
    Thanks received
    1,257
    Rep Power
    990
    Quote Originally Posted by ISAI View Post
    That's pretty damn cool, nice job Seven
    Thanks

    Just posted an example

    Example dumping interface child sprites (group 5)

    Code:
    		for(int index = 0; index < Widget.widgets.length; index++) {
    			
    			Widget widget = Widget.widgets[index];
    			
    			if (widget == null) {
    				continue;
    			}
    			
    			if (widget.defaultSprite != null) {				
    				FileUtils.writeSprite(widget.defaultSprite, "./interfaces/default_sprites", widget.id + "_" + widget.group);
    			}
    			
    			if (widget.secondarySprite != null) {
    				FileUtils.writeSprite(widget.secondarySprite, "./interfaces/secondary_sprites", widget.id + "_" + widget.group);
    			}
    			
    		}
    You can also write an image of the current producing raster and output that as well.



    Code:
    FileUtils.writeImage(Raster.raster, "./test", "test");
    Code:
    	public static void writeImage(int[] raster, String directory, String output) {
    		
    		final File dir = new File(directory);		
    		
    		if (!dir.exists()) {
    			dir.mkdirs();
    		}
    
    		if (raster == null) {
    			return;
    		}
    
    		if (Raster.width <= 0 || Raster.height <= 0) {
    			return;
    		}
    
    		final int[] data = raster;
    
    		if (data != null && data.length > 0) {
    
    			final BufferedImage image = new BufferedImage(Raster.width, Raster.height,
    					BufferedImage.TYPE_INT_RGB);
    
    			if (image != null) {
    
    				final int[] pixels = ((DataBufferInt) image.getRaster().getDataBuffer()).getData();
    
    				System.arraycopy(data, 0, pixels, 0, data.length);
    				
    				try {
    					ImageIO.write(image, "png", new File(dir.toString() + File.separator + output + ".png"));
    				} catch (IOException e) {
    					e.printStackTrace();
    				}
    			}
    		}
    	}
    Attached image
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Dumping an Index from the Cache
    By Alpi in forum Buying
    Replies: 2
    Last Post: 05-19-2014, 06:15 AM
  2. Dumping an Index from the Cache
    By Alpi in forum Help
    Replies: 0
    Last Post: 05-18-2014, 11:09 PM
  3. Loading sprites from the Cache
    By Exion in forum Help
    Replies: 2
    Last Post: 10-15-2011, 05:47 PM
  4. Dumping examine info from the 377 cache?
    By Brown in forum Requests
    Replies: 3
    Last Post: 03-24-2009, 12:32 AM
  5. Replies: 19
    Last Post: 01-24-2008, 11:15 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •