ScannerI2Info.java 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. package com.epson.lib.escani2;
  2. import com.epson.lib.escani2.EscanI2Lib;
  3. import java.io.Serializable;
  4. public class ScannerI2Info implements Serializable {
  5. public static final int ALIGNMENT_UNDEFINED = 255;
  6. public int adfAlignment;
  7. public int adfDuplexType;
  8. public boolean adfInstalled;
  9. public int adfSensorHeight;
  10. public int adfSensorWidth;
  11. public int adfType;
  12. public int flatbedAlignment;
  13. public boolean flatbedInstalled;
  14. public int flatbedSensorHeight;
  15. public int flatbedSensorWidth;
  16. public int imageSensorHeight;
  17. public int imageSensorWidth;
  18. public String productName;
  19. public int getSensorSizeBaseResolution() {
  20. return 100;
  21. }
  22. public int getAlignment(EscanI2Lib.InputUnit inputUnit) {
  23. switch (inputUnit) {
  24. case ADF:
  25. if (!this.adfInstalled) {
  26. return 255;
  27. }
  28. return this.adfAlignment;
  29. case FLATBED:
  30. if (!this.flatbedInstalled) {
  31. return 255;
  32. }
  33. return this.flatbedAlignment;
  34. default:
  35. return 255;
  36. }
  37. }
  38. public int[] getSensorPixelSize(EscanI2Lib.InputUnit inputUnit, int i, int i2) {
  39. int[] sensorSize = getSensorSize(inputUnit);
  40. int sensorSizeBaseResolution = getSensorSizeBaseResolution();
  41. if (i != sensorSizeBaseResolution) {
  42. sensorSize[0] = (int) ((((double) sensorSize[0]) * ((double) i)) / ((double) sensorSizeBaseResolution));
  43. }
  44. if (i2 != sensorSizeBaseResolution) {
  45. sensorSize[1] = (int) ((((double) sensorSize[1]) * ((double) i2)) / ((double) sensorSizeBaseResolution));
  46. }
  47. return sensorSize;
  48. }
  49. public int[] getSensorSize(EscanI2Lib.InputUnit inputUnit) {
  50. if (C09741.$SwitchMap$com$epson$lib$escani2$EscanI2Lib$InputUnit[inputUnit.ordinal()] != 1) {
  51. if (!this.flatbedInstalled) {
  52. return null;
  53. }
  54. return new int[]{this.flatbedSensorWidth, this.flatbedSensorHeight};
  55. } else if (!this.adfInstalled) {
  56. return null;
  57. } else {
  58. return new int[]{this.adfSensorWidth, this.adfSensorHeight};
  59. }
  60. }
  61. public boolean isAdfAlignmentInvalid() {
  62. return this.adfAlignment == 255;
  63. }
  64. }