summaryrefslogtreecommitdiff
path: root/vguimatsurface/memorybitmap.h
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /vguimatsurface/memorybitmap.h
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'vguimatsurface/memorybitmap.h')
-rw-r--r--vguimatsurface/memorybitmap.h63
1 files changed, 63 insertions, 0 deletions
diff --git a/vguimatsurface/memorybitmap.h b/vguimatsurface/memorybitmap.h
new file mode 100644
index 0000000..408daad
--- /dev/null
+++ b/vguimatsurface/memorybitmap.h
@@ -0,0 +1,63 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//=============================================================================//
+
+#ifndef MEMORYBITMAP_H
+#define MEMORYBITMAP_H
+
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include <vgui/VGUI.h>
+#include <vgui/IImage.h>
+#include <Color.h>
+
+namespace vgui
+{
+
+typedef unsigned long HTexture;
+
+//-----------------------------------------------------------------------------
+// Purpose: Holds a single image created from a chunk of memory, internal to vgui only
+//-----------------------------------------------------------------------------
+class MemoryBitmap: public IImage
+{
+public:
+ MemoryBitmap(unsigned char *texture,int wide, int tall);
+ ~MemoryBitmap();
+
+ // IImage implementation
+ virtual void Paint();
+ virtual void GetSize(int &wide, int &tall);
+ virtual void GetContentSize(int &wide, int &tall);
+ virtual void SetPos(int x, int y);
+ virtual void SetSize(int x, int y);
+ virtual void SetColor(Color col);
+
+ // methods
+ void ForceUpload(unsigned char *texture,int wide, int tall); // ensures the bitmap has been uploaded
+ HTexture GetID(); // returns the texture id
+ const char *GetName();
+ bool IsValid()
+ {
+ return _valid;
+ }
+
+private:
+// HTexture _id;
+ bool _uploaded;
+ bool _valid;
+ unsigned char *_texture;
+ int _pos[2];
+ Color _color;
+ int _w,_h; // size of the texture
+ int m_iTextureID;
+};
+
+} // namespace vgui
+
+#endif // MEMORYBITMAP_H