Team Fortress 2 Source Code as on 22/4/2020
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.

63 lines
1.4 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef MEMORYBITMAP_H
  8. #define MEMORYBITMAP_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include <vgui/VGUI.h>
  13. #include <vgui/IImage.h>
  14. #include <Color.h>
  15. namespace vgui
  16. {
  17. typedef unsigned long HTexture;
  18. //-----------------------------------------------------------------------------
  19. // Purpose: Holds a single image created from a chunk of memory, internal to vgui only
  20. //-----------------------------------------------------------------------------
  21. class MemoryBitmap: public IImage
  22. {
  23. public:
  24. MemoryBitmap(unsigned char *texture,int wide, int tall);
  25. ~MemoryBitmap();
  26. // IImage implementation
  27. virtual void Paint();
  28. virtual void GetSize(int &wide, int &tall);
  29. virtual void GetContentSize(int &wide, int &tall);
  30. virtual void SetPos(int x, int y);
  31. virtual void SetSize(int x, int y);
  32. virtual void SetColor(Color col);
  33. // methods
  34. void ForceUpload(unsigned char *texture,int wide, int tall); // ensures the bitmap has been uploaded
  35. HTexture GetID(); // returns the texture id
  36. const char *GetName();
  37. bool IsValid()
  38. {
  39. return _valid;
  40. }
  41. private:
  42. // HTexture _id;
  43. bool _uploaded;
  44. bool _valid;
  45. unsigned char *_texture;
  46. int _pos[2];
  47. Color _color;
  48. int _w,_h; // size of the texture
  49. int m_iTextureID;
  50. };
  51. } // namespace vgui
  52. #endif // MEMORYBITMAP_H