Advertisement
Guest User

Untitled

a guest
Aug 16th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. /**
  2. * Custom Map Exporting
  3. * @param mapToExport
  4. * The map to export
  5. */
  6. public static void exportMap(File file, CIAFactbookMapper mapToExport) {
  7. mapper = mapToExport;
  8. int height = mapper.getRenderer().getHeight();
  9. int width = mapper.getRenderer().getWidth();
  10. //BufferedImage mapImage = (BufferedImage)mapper.getRenderer().createImage(width, height);
  11.  
  12. BufferedImage mapImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
  13. Graphics2D g2 = mapImage.createGraphics();
  14.  
  15. mapper.paintComponents(g2);
  16.  
  17. try {
  18. ImageIO.write(mapImage, ".jpg", file);
  19. } catch (IOException e) {
  20. CIAFactbookMapper.throwError("Image Export Error! Please Try Again!");
  21. }
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement