Counter Strike : Global Offensive Source Code
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.

68 lines
1.7 KiB

  1. //========= Copyright � 1996-2005, 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. virtual bool Evict() OVERRIDE{ return false; }
  34. virtual int GetNumFrames() OVERRIDE{ return 0; }
  35. virtual void SetFrame(int nFrame) OVERRIDE{}
  36. virtual void SetRotation(int iRotation) OVERRIDE{ return; };
  37. // methods
  38. void ForceUpload(unsigned char *texture,int wide, int tall); // ensures the bitmap has been uploaded
  39. HTexture GetID(); // returns the texture id
  40. const char *GetName();
  41. bool IsValid()
  42. {
  43. return _valid;
  44. }
  45. private:
  46. // HTexture _id;
  47. bool _uploaded;
  48. bool _valid;
  49. unsigned char *_texture;
  50. int _pos[2];
  51. Color _color;
  52. int _w,_h; // size of the texture
  53. int m_iTextureID;
  54. };
  55. } // namespace vgui
  56. #endif // MEMORYBITMAP_H