您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
  2. * Copyright 2014-2023 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. //
  20. // Cursor - structure containing information describing
  21. // the current cursor shape
  22. //
  23. #ifndef __RFB_CURSOR_H__
  24. #define __RFB_CURSOR_H__
  25. #include <vector>
  26. #include <rfb/PixelBuffer.h>
  27. namespace rfb {
  28. class Cursor {
  29. public:
  30. Cursor(int width, int height, const Point& hotspot, const uint8_t* data);
  31. Cursor(const Cursor& other);
  32. ~Cursor();
  33. int width() const { return width_; };
  34. int height() const { return height_; };
  35. const Point& hotspot() const { return hotspot_; };
  36. const uint8_t* getBuffer() const { return data; };
  37. // getBitmap() returns a monochrome version of the cursor
  38. std::vector<uint8_t> getBitmap() const;
  39. // getMask() returns a simple mask version of the alpha channel
  40. std::vector<uint8_t> getMask() const;
  41. // crop() crops the cursor down to the smallest possible size, based on the
  42. // mask.
  43. void crop();
  44. protected:
  45. int width_, height_;
  46. Point hotspot_;
  47. uint8_t* data;
  48. };
  49. class RenderedCursor : public PixelBuffer {
  50. public:
  51. RenderedCursor();
  52. Rect getEffectiveRect() const { return buffer.getRect(offset); }
  53. virtual const uint8_t* getBuffer(const Rect& r, int* stride) const;
  54. void update(PixelBuffer* framebuffer, Cursor* cursor, const Point& pos);
  55. protected:
  56. ManagedPixelBuffer buffer;
  57. Point offset;
  58. };
  59. }
  60. #endif