Changeset 1427 for trunk/src/org/expeditee/items
- Timestamp:
- 08/07/19 14:14:42 (5 years ago)
- Location:
- trunk/src/org/expeditee/items
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/items/Item.java
r1426 r1427 47 47 import org.expeditee.core.bounds.EllipticalBounds; 48 48 import org.expeditee.core.bounds.PolygonBounds; 49 import org.expeditee.encryption.core.EncryptedImage; 49 50 import org.expeditee.encryption.items.surrogates.EncryptionDetail; 50 51 import org.expeditee.encryption.items.surrogates.EncryptionDetail.Type; … … 4049 4050 } 4050 4051 4052 //Setup surrogate items. 4051 4053 Item copy = this.copy(); 4052 4054 if (copy.isAnnotation()) { … … 4075 4077 copy.setText("Encrypted"); 4076 4078 } 4079 4080 // Encrypt XRayables representative files and update pointer. 4081 Collection<? extends XRayable> xrayables = this.getEnclosures(); 4082 for (XRayable xray: xrayables) { 4083 if (xray instanceof Picture) { 4084 EncryptedImage.encryptImage((Picture) xray, labelResult.key); 4085 Text source = xray._source; 4086 String oldName = xray.getName(); 4087 String newName = oldName.substring(0, oldName.lastIndexOf('.')) + EncryptedImage.EXPEDITEE_ENCRYPTED_IMAGE_EXTENSION; 4088 source.setText(source.getText().replace(oldName, newName)); 4089 } 4090 } 4091 4077 4092 this.addToSurrogates(copy); 4078 4093 } -
trunk/src/org/expeditee/items/Picture.java
r1426 r1427 37 37 import org.expeditee.core.bounds.AxisAlignedBoxBounds; 38 38 import org.expeditee.core.bounds.PolygonBounds; 39 import org.expeditee.encryption.core.EncryptedImage; 40 import org.expeditee.encryption.items.surrogates.Label; 41 import org.expeditee.encryption.items.surrogates.Label.LabelResult; 39 42 import org.expeditee.gio.EcosystemManager; 40 43 import org.expeditee.gio.GraphicsManager; … … 42 45 import org.expeditee.gui.FrameIO; 43 46 import org.expeditee.gui.FrameUtils; 47 import org.expeditee.gui.MessageBay; 44 48 45 49 /** … … 62 66 public class Picture extends XRayable { 63 67 64 public static final String REDACTED_IMAGE_NAME = " redacted.png";68 public static final String REDACTED_IMAGE_NAME = "expeditee_noise.encrypted"; 65 69 66 70 private static final float CROPPING_COMPOSITE_ALPHA = 0.5f; … … 775 779 @Override 776 780 public boolean refresh() { 777 // ImageIcon is faster, but cannot handle some formats778 // (notably.bmp) hence, we try this first, then if it fails we try779 // ImageIO780 /*781 try {782 _image = new ImageIcon(_path).getImage();783 } catch (Exception e) {784 }785 786 // if ImageIcon failed to read the image787 if (_image == null || _image.getWidth() <= 0) {788 try {789 _image = ImageIO.read(new File(_path));790 } catch (IOException e) {791 // e.printStackTrace();792 Logger.Log(e);793 _image = null;794 return false;795 }796 }797 */798 799 781 if (isNoise()) { 800 _image = Image.getNoise();782 _image = EncryptedImage.getNoise(); 801 783 } else { 802 _image = Image.getImage(_path); 784 String encryptionLabel = _source.getEncryptionLabel(); 785 if (encryptionLabel == null || encryptionLabel.isEmpty()) { 786 _image = Image.getImage(_path); 787 } else { 788 LabelResult result = Label.getLabel(encryptionLabel); 789 if (result == LabelResult.SuccessResolveLabelToKey) { 790 _image = EncryptedImage.getImage(_path, result.key); 791 } else { 792 MessageBay.displayMessage(result.toString()); 793 _image = EncryptedImage.getNoise(); 794 } 795 } 803 796 } 804 797 -
trunk/src/org/expeditee/items/XRayable.java
r1426 r1427 25 25 import org.expeditee.core.Colour; 26 26 import org.expeditee.core.Point; 27 import org.expeditee.encryption.core.EncryptedImage; 27 28 import org.expeditee.encryption.items.surrogates.Label; 28 29 import org.expeditee.gui.DisplayController; 29 30 30 31 public abstract class XRayable extends Item { 31 32 32 33 33 protected Text _source = null;
Note:
See TracChangeset
for help on using the changeset viewer.