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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. void writePalette(const PixelFormat& pf, const Palette& palette);
  41. void writePixels(const rdr::U8* buffer, const PixelFormat& pf,
  42. unsigned int count);
  43. protected:
  44. // Preprocessor generated, optimised methods
  45. void writePaletteTile(int width, int height,
  46. const rdr::U8* buffer, int stride,
  47. const PixelFormat& pf, const Palette& palette);
  48. void writePaletteTile(int width, int height,
  49. const rdr::U16* buffer, int stride,
  50. const PixelFormat& pf, const Palette& palette);
  51. void writePaletteTile(int width, int height,
  52. const rdr::U32* buffer, int stride,
  53. const PixelFormat& pf, const Palette& palette);
  54. void writePaletteRLETile(int width, int height,
  55. const rdr::U8* buffer, int stride,
  56. const PixelFormat& pf, const Palette& palette);
  57. void writePaletteRLETile(int width, int height,
  58. const rdr::U16* buffer, int stride,
  59. const PixelFormat& pf, const Palette& palette);
  60. void writePaletteRLETile(int width, int height,
  61. const rdr::U32* buffer, int stride,
  62. const PixelFormat& pf, const Palette& palette);
  63. protected:
  64. rdr::ZlibOutStream zos;
  65. rdr::MemOutStream mos;
  66. };
  67. }
  68. #endif