Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

Cursor.h 2.1KB

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