本文整理汇总了Java中uk.co.mmscomputing.device.scanner.ScannerIOMetadata类的典型用法代码示例。如果您正苦于以下问题:Java ScannerIOMetadata类的具体用法?Java ScannerIOMetadata怎么用?Java ScannerIOMetadata使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ScannerIOMetadata类属于uk.co.mmscomputing.device.scanner包,在下文中一共展示了ScannerIOMetadata类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: update
import uk.co.mmscomputing.device.scanner.ScannerIOMetadata; //导入依赖的package包/类
public void update(ScannerIOMetadata.Type type, ScannerIOMetadata metadata){
try{
if(type.equals(ScannerIOMetadata.ACQUIRED)){
BufferedImage image=metadata.getImage();
System.out.println("Have an image now!");
if(writeImage){
writer.writeToSequence(new IIOImage(image,null,null),null);
}
}else if(type.equals(ScannerIOMetadata.STATECHANGE)){
System.out.println(metadata.getStateStr());
if(metadata.isFinished()){
writer.endWriteSequence();
((ImageOutputStream)writer.getOutput()).close();
}
}else if(type.equals(ScannerIOMetadata.EXCEPTION)){
metadata.getException().printStackTrace();
}
}catch(Exception e){
e.printStackTrace();
}
}
示例2: update
import uk.co.mmscomputing.device.scanner.ScannerIOMetadata; //导入依赖的package包/类
public void update(ScannerIOMetadata.Type type, ScannerIOMetadata metadata){
try{
if(type.equals(ScannerIOMetadata.ACQUIRED)){
BufferedImage image=metadata.getImage();
System.out.println("Have an image now!");
File file = new File(dir,"testIO.pdf");file.delete();
ImageIO.write(image, "pdf", file);
// if(writeImage){
// writer.writeToSequence(new IIOImage(image,null,null),null);
// }
}else if(type.equals(ScannerIOMetadata.STATECHANGE)){
System.out.println(metadata.getStateStr());
if(metadata.isFinished()){ // You will get here only if you close source properly!
// writer.endWriteSequence();
// ((ImageOutputStream)writer.getOutput()).close(); // Don't forget this!
}
}else if(type.equals(ScannerIOMetadata.EXCEPTION)){
metadata.getException().printStackTrace();
}
}catch(Exception e){
e.printStackTrace();
}
}
示例3: update
import uk.co.mmscomputing.device.scanner.ScannerIOMetadata; //导入依赖的package包/类
public void update(ScannerIOMetadata.Type type, ScannerIOMetadata metadata){
if(type.equals(ScannerIOMetadata.ACQUIRED)){
BufferedImage image=metadata.getImage();
System.out.println("Have an image now!");
try{
File file = new File(filename);
System.out.println("Image Path: "+file.getAbsolutePath());
ImageIO.write(image, "jpg", file);
}catch(Exception e){
e.printStackTrace();
}
}else if(type.equals(ScannerIOMetadata.NEGOTIATE)){
ScannerDevice device=metadata.getDevice();
/*
try{
// device.setShowUserInterface(false);
device.setShowProgressBar(true);
device.setRegionOfInterest(20,40,300,200);
device.setResolution(100.0);
}catch(Exception e){
e.printStackTrace();
}
*/
}else if(type.equals(ScannerIOMetadata.STATECHANGE)){
System.err.println(metadata.getStateStr());
}else if(type.equals(ScannerIOMetadata.EXCEPTION)){
metadata.getException().printStackTrace();
}
}
示例4: update
import uk.co.mmscomputing.device.scanner.ScannerIOMetadata; //导入依赖的package包/类
public void update(ScannerIOMetadata.Type type, ScannerIOMetadata metadata){
if(type.equals(ScannerIOMetadata.ACQUIRED)){
BufferedImage image=metadata.getImage();
System.out.println("Have an image now!");
try{
ImageIO.write(image, "jpg", new File(filename+index+".jpg"));
index++;
// new uk.co.mmscomputing.concurrent.Semaphore(0,true).tryAcquire(2000,null);
}catch(Exception e){
e.printStackTrace();
}
}else if(type.equals(ScannerIOMetadata.NEGOTIATE)){
ScannerDevice device=metadata.getDevice();
/*
try{
device.setResolution(100);
// device.setRegionOfInterest(0.0,0.0,40.0,50.0); // top-left corner 40x50 mm
device.setRegionOfInterest(0,0,400,500); // top-left corner 400x500 pixels
device.setShowUserInterface(false);
device.setShowProgressBar(false);
}catch(Exception e){
e.printStackTrace();
}
*/
}else if(type.equals(ScannerIOMetadata.STATECHANGE)){
System.err.println(metadata.getStateStr());
}else if(type.equals(ScannerIOMetadata.EXCEPTION)){
metadata.getException().printStackTrace();
}
}
示例5: update
import uk.co.mmscomputing.device.scanner.ScannerIOMetadata; //导入依赖的package包/类
public void update(ScannerIOMetadata.Type type, ScannerIOMetadata metadata) {
if (type.equals(ScannerIOMetadata.ACQUIRED)) {
BufferedImage image = metadata.getImage();
System.out.println("Have an image now!");
try {
ImageIO.write(image, "jpg", new File("test.jpg"));
// new
// uk.co.mmscomputing.concurrent.Semaphore(0,true).tryAcquire(2000,null);
} catch (Exception e) {
e.printStackTrace();
}
} else if (type.equals(ScannerIOMetadata.NEGOTIATE)) {
// ScannerDevice device = metadata.getDevice();
// try{
// device.setResolution(100);
//// device.setRegionOfInterest(0.0,0.0,40.0,50.0); // top-left
// corner 40x50 mm
// device.setRegionOfInterest(0,0,400,500); // top-left corner
// 400x500 pixels
// device.setShowUserInterface(false);
// device.setShowProgressBar(false);
// }catch(Exception e){
// e.printStackTrace();
// }
} else if (type.equals(ScannerIOMetadata.STATECHANGE)) {
System.err.println(metadata.getStateStr());
} else if (type.equals(ScannerIOMetadata.EXCEPTION)) {
metadata.getException().printStackTrace();
}
}
示例6: update
import uk.co.mmscomputing.device.scanner.ScannerIOMetadata; //导入依赖的package包/类
/**
* @see uk.co.mmscomputing.device.scanner.ScannerListener#update(uk.co.mmscomputing.device.scanner.ScannerIOMetadata.Type,
* uk.co.mmscomputing.device.scanner.ScannerIOMetadata)
*/
@Override
public void update (ScannerIOMetadata.Type type, ScannerIOMetadata metadata) {
if (type.equals(ScannerIOMetadata.ACQUIRED)) {
System.out.println("--ACQUIRE--");
BufferedImage image = metadata.getImage();
System.out.println("Have an image now!");
try {
File output = new File("test.jpg");
ImageIO.write(image, "jpg", output);
SCANNED_PICTURES.put("id", output.getAbsolutePath());
// new
// uk.co.mmscomputing.concurrent.Semaphore(0,true).tryAcquire(2000,null);
} catch (Exception e) {
e.printStackTrace();
}
} else if (type.equals(ScannerIOMetadata.NEGOTIATE)) {
System.out.println("--NEGOTIATE--");
// ScannerDevice device = metadata.getDevice();
// try{
// device.setResolution(100);
// // device.setRegionOfInterest(0.0,0.0,40.0,50.0); // top-left
// corner 40x50 mm
// device.setRegionOfInterest(0,0,400,500); // top-left corner
// 400x500 pixels
// device.setShowUserInterface(false);
// device.setShowProgressBar(false);
// }catch(Exception e){
// e.printStackTrace();
// }
} else if (type.equals(ScannerIOMetadata.STATECHANGE)) {
System.out.println("--STATECHANGE--");
System.out.println(metadata.getStateStr());
} else if (type.equals(ScannerIOMetadata.EXCEPTION)) {
System.out.println("--EXCEPTION--");
metadata.getException().printStackTrace();
}
}