Ignore:
Timestamp:
11/12/19 13:31:04 (5 years ago)
Author:
bnemhaus
Message:

org.expeditee.gui.managment.ResourceUtil.newImageWithName(Image, String) now handles the generation of new images when copy/pasting images that do not have a file (for example, from a web page or paint program)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/gui/management/ResourceUtil.java

    r1441 r1446  
    11package org.expeditee.gui.management;
    22
     3import java.io.File;
     4import java.io.IOException;
    35import java.nio.file.Path;
    46import java.nio.file.Paths;
    57import java.util.List;
    68
     9import org.expeditee.core.Image;
     10import org.expeditee.gui.DisplayController;
    711import org.expeditee.gui.Frame;
    812import org.expeditee.gui.FrameIO;
     13import org.expeditee.items.Text;
    914
    1015public class ResourceUtil {
     
    4449               
    4550                return null;
     51        }
     52       
     53        public static Text newImageWithName(Image img, String name) throws IOException {
     54                ResourceManager.images.getDirectories();// TODO: save this image out to the first directory in list instead of to IMAGES_PATH
     55                File out = new File(FrameIO.IMAGES_PATH + name);
     56                out.mkdirs();
     57                img.writeToDisk("png", out);
     58                Text item = DisplayController.getCurrentFrame().createNewText("@i: " + out.getName());
     59                return item;
    4660        }
    4761       
Note: See TracChangeset for help on using the changeset viewer.