Wrote some readme and added some feedback functionality. DepthMapNeedle now tells you, when exports are finished and so on.

This commit is contained in:
vanitasvitae 2015-04-12 00:28:15 +02:00
parent 77a2f0b6e7
commit 94993a907f
4 changed files with 35 additions and 12 deletions

View file

@ -30,32 +30,42 @@ public class JPEG extends Const
tail = this.getImageTail();
}
public void exportDepthMap()
public boolean exportDepthMap()
{
String out = filename;
if(out.endsWith(".jpg") || out.endsWith(".JPG")) out = out.substring(0, out.length()-4);
this.exportDepthMap(out+"_d.png");
return this.exportDepthMap(out+"_d.png");
}
public void exportDepthMap(String file)
public boolean exportDepthMap(String file)
{
byte[] b64 = ArrayUtils.unsign(extractDepthMap());
byte[] depth = Base64.getDecoder().decode(b64);
IO.write(depth, file);
if(depth != null)
{
IO.write(depth, file);
return true;
}
else return false;
}
public void exportSourceImage()
public boolean exportSourceImage()
{
String out = filename;
if(out.endsWith(".jpg") || out.endsWith(".JPG")) out = out.substring(0, out.length()-4);
this.exportSourceImage(out+"_s.jpg");
return this.exportSourceImage(out+"_s.jpg");
}
public void exportSourceImage(String file)
public boolean exportSourceImage(String file)
{
byte[] b64 = ArrayUtils.unsign(extractSourceImage());
byte[] src = Base64.getDecoder().decode(b64);
IO.write(src, file);
if(src != null)
{
IO.write(src, file);
return true;
}
else return false;
}
public byte[] extractDepthMap()
@ -139,10 +149,12 @@ public class JPEG extends Const
this.disassemble();
}
public void injectDepthMap(String filename)
public boolean injectDepthMap(String filename)
{
byte[] depth = Base64.getEncoder().encode(IO.read(new File(filename)));
xmpExt = JPEGUtils.replace(xmpExt, keyGDepthData, depth);
if(xmpExt != null) return true;
else return false;
}
public byte[] reassemble()