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.

ZRLEEncoder.h 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
  2. * Copyright 2014 Pierre Ossman for Cendio AB
  3. *
  4. * This is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This software is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this software; if not, write to the Free Software
  16. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  17. * USA.
  18. */
  19. #ifndef __RFB_ZRLEENCODER_H__
  20. #define __RFB_ZRLEENCODER_H__
  21. #include <rdr/MemOutStream.h>
  22. #include <rdr/ZlibOutStream.h>
  23. #include <rfb/Encoder.h>
  24. namespace rfb {
  25. class ZRLEEncoder : public Encoder {
  26. public:
  27. ZRLEEncoder(SConnection* conn);
  28. virtual ~ZRLEEncoder();
  29. virtual bool isSupported();
  30. virtual void writeRect(const PixelBuffer* pb, const Palette& palette);
  31. virtual void writeSolidRect(int width, int height,
  32. const PixelFormat& pf,
  33. const rdr::U8* colour);
  34. protected:
  35. void writePaletteTile(const Rect& tile, const PixelBuffer* pb,
  36. const Palette& palette);
  37. void writePaletteRLETile(const Rect& tile, const PixelBuffer* pb,
  38. const Palette& palette);
  39. void writeRawTile(const Rect& tile, const PixelBuffer* pb,
  40. const Palette& palette);
  41. void writePalette(const PixelFormat& pf, const Palette& palette);
  42. void writePixels(const rdr::U8* buffer, const PixelFormat& pf,
  43. unsigned int count);
  44. protected:
  45. // Preprocessor generated, optimised methods
  46. void writePaletteTile(int width, int height,
  47. const rdr::U8* buffer, int stride,
  48. const PixelFormat& pf, const Palette& palette);
  49. void writePaletteTile(int width, int height,
  50. const rdr::U16* buffer, int stride,
  51. const PixelFormat& pf, const Palette& palette);
  52. void writePaletteTile(int width, int height,
  53. const rdr::U32* buffer, int stride,
  54. const PixelFormat& pf, const Palette& palette);
  55. void writePaletteRLETile(int width, int height,
  56. const rdr::U8* buffer, int stride,
  57. const PixelFormat& pf, const Palette& palette);
  58. void writePaletteRLETile(int width, int height,
  59. const rdr::U16* buffer, int stride,
  60. const PixelFormat& pf, const Palette& palette);
  61. void writePaletteRLETile(int width, int height,
  62. const rdr::U32* buffer, int stride,
  63. const PixelFormat& pf, const Palette& palette);
  64. protected:
  65. rdr::ZlibOutStream zos;
  66. rdr::MemOutStream mos;
  67. };
  68. }
  69. #endif