You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Encodings.java 3.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
  2. * Copyright (C) 2011 D. R. Commander. All Rights Reserved.
  3. * Copyright (C) 2012 Brian P. Hinz
  4. *
  5. * This is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This software is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this software; if not, write to the Free Software
  17. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
  18. * USA.
  19. */
  20. package com.tigervnc.rfb;
  21. public class Encodings {
  22. public static final int encodingRaw = 0;
  23. public static final int encodingCopyRect = 1;
  24. public static final int encodingRRE = 2;
  25. public static final int encodingCoRRE = 4;
  26. public static final int encodingHextile = 5;
  27. public static final int encodingTight = 7;
  28. public static final int encodingZRLE = 16;
  29. public static final int encodingMax = 255;
  30. public static final int pseudoEncodingXCursor = -240;
  31. public static final int pseudoEncodingCursor = -239;
  32. public static final int pseudoEncodingDesktopSize = -223;
  33. public static final int pseudoEncodingExtendedDesktopSize = -308;
  34. public static final int pseudoEncodingDesktopName = -307;
  35. public static final int pseudoEncodingClientRedirect = -311;
  36. public static final int pseudoEncodingFence = -312;
  37. public static final int pseudoEncodingContinuousUpdates = -313;
  38. public static final int pseudoEncodingCursorWithAlpha = -314;
  39. // TightVNC-specific
  40. public static final int pseudoEncodingLastRect = -224;
  41. public static final int pseudoEncodingQualityLevel0 = -32;
  42. public static final int pseudoEncodingQualityLevel9 = -23;
  43. public static final int pseudoEncodingCompressLevel0 = -256;
  44. public static final int pseudoEncodingCompressLevel9 = -247;
  45. // TurboVNC-specific
  46. public static final int pseudoEncodingFineQualityLevel0 = -512;
  47. public static final int pseudoEncodingFineQualityLevel100 = -412;
  48. public static final int pseudoEncodingSubsamp1X = -768;
  49. public static final int pseudoEncodingSubsamp4X = -767;
  50. public static final int pseudoEncodingSubsamp2X = -766;
  51. public static final int pseudoEncodingSubsampGray = -765;
  52. public static final int pseudoEncodingSubsamp8X = -764;
  53. public static final int pseudoEncodingSubsamp16X = -763;
  54. // VMware-specific
  55. public static final int pseudoEncodingVMwareCursor = 0x574d5664;
  56. public static int encodingNum(String name) {
  57. if (name.equalsIgnoreCase("raw")) return encodingRaw;
  58. if (name.equalsIgnoreCase("copyRect")) return encodingCopyRect;
  59. if (name.equalsIgnoreCase("RRE")) return encodingRRE;
  60. if (name.equalsIgnoreCase("coRRE")) return encodingCoRRE;
  61. if (name.equalsIgnoreCase("hextile")) return encodingHextile;
  62. if (name.equalsIgnoreCase("Tight")) return encodingTight;
  63. if (name.equalsIgnoreCase("ZRLE")) return encodingZRLE;
  64. return -1;
  65. }
  66. public static String encodingName(int num) {
  67. switch (num) {
  68. case encodingRaw: return "raw";
  69. case encodingCopyRect: return "copyRect";
  70. case encodingRRE: return "RRE";
  71. case encodingCoRRE: return "CoRRE";
  72. case encodingHextile: return "hextile";
  73. case encodingTight: return "Tight";
  74. case encodingZRLE: return "ZRLE";
  75. default: return "[unknown encoding]";
  76. }
  77. }
  78. }