VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
rwColor.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2015 MaK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
9 
10 #pragma once
11 
13 #include <readerWriter/rwInt.h>
14 #include "vrfutil/vrfutilDefines.h"
15 #include "geometry/color.h"
16 
17 
20 {
21 public:
22 
23  //Default constructor
24  DtRwColor();
25 
26  //Real constructors
27  DtRwColor(const DtString& name,
28  DtReaderWriterRegistry* parentRegistry = NULL);
29  DtRwColor(const DtSymbolString& name,
30  DtReaderWriterRegistry* parentRegistry = NULL);
31  DtRwColor(int r, int g, int b, int a);
32 
33  //Copy constructor
34  DtRwColor(const DtRwColor& orig);
35  DtRwColor& operator=(const DtRwColor& orig);
36 
37  DtRwColor(const DtColor& orig);
38  DtRwColor& operator=(const DtColor& orig);
39 
40  virtual void setRed(int v) {myRed = v;};
41  virtual int red() const {return myRed;};
42 
43  virtual void setGreen(int v) {myGreen = v;};
44  virtual int green() const {return myGreen;};
45 
46  virtual void setBlue(int v) {myBlue = v;};
47  virtual int blue() const {return myBlue;};
48 
49  virtual void setAlpha(int v) {myAlpha = v;};
50  virtual int alpha() const {return myAlpha;};
51 
52  virtual void setRgba(unsigned v);
53  virtual unsigned rgba() const;
54 
55  virtual void setArgb(unsigned v);
56  virtual unsigned argb() const;
57 
58  virtual bool operator==(const DtRwColor&) const;
59  virtual bool operator!=(const DtRwColor& rhs) const { return !(*this == rhs); };
60 
61  virtual DtColor color() const {return DtColor(myRed, myGreen, myBlue, myAlpha);};
62 
66  virtual const char* readerWriterType() const;
67 
69  static const char* theXmlType();
70 
71  virtual const char* xmlType() const
72  {
73  return theXmlType();
74  }
75 
76  static float convertRgbaToFloat(int colorValue);
77 
78 protected:
83 
84 };
85 
86 namespace DtBufferSerialize
87 {
88  DT_DLL_vrfutil int getSize(const DtRwColor& val);
89  DT_DLL_vrfutil char *encode(const DtRwColor& val, char *buffer);
90  DT_DLL_vrfutil const char *decode(DtRwColor &val, const char *buffer) ;
91 }
bool operator==(const DtReaderWriter &) const
Equivalence operator.
virtual const char * readerWriterType() const
Used to supply a string type that this reader writer type is. This can be used in place of dynamic-ca...
DT_DLL_readerWriter int getSize(const DtString &val)
The number of bytes required to encode the value.
DtRwInt myGreen
Definition: rwColor.h:80
This class allows one to collect and compare strings using an index number instead of having to do st...
Definition: symbolString.h:27
virtual bool operator!=(const DtRwColor &rhs) const
Definition: rwColor.h:59
virtual void setAlpha(int v)
Definition: rwColor.h:49
DtRwInt myRed
Definition: rwColor.h:79
Definition: readerWriter.h:85
Definition: readerWriterRegistry.h:39
Definition: color.h:25
DtRwInt myBlue
Definition: rwColor.h:81
virtual void setGreen(int v)
Definition: rwColor.h:43
Reader-Writer color specified by red, green, blue components.
Definition: rwColor.h:19
virtual DtColor color() const
Definition: rwColor.h:61
virtual int alpha() const
Definition: rwColor.h:50
Description: Readable, Writable int.
Definition: rwInt.h:25
virtual void setRed(int v)
Definition: rwColor.h:40
virtual const char * xmlType() const
Definition: rwColor.h:71
DT_DLL_readerWriter char * encode(const DtFilename &val, char *buffer)
Serializes the provided value val into buffer. buffer must have at least the number of bytes returned...
virtual int blue() const
Definition: rwColor.h:47
#define DT_DLL_vrfutil
This file is used to determine how to build Disable inconsistent dll linkage warning Visual Studio 6...
Definition: vrfutilDefines.h:34
const DtReaderWriter & operator=(const DtReaderWriter &orig)
assignment operator
DT_DLL_readerWriter const char * decode(DtString &val, const char *buffer)
Decodes a value from buffer and places the result in val of the type specified by val...
static const char * theXmlType()
The type that is used when archiving to an XML stream.
virtual void setBlue(int v)
Definition: rwColor.h:46
virtual int green() const
Definition: rwColor.h:44
virtual int red() const
Definition: rwColor.h:41
DtRwInt myAlpha
Definition: rwColor.h:82

Document ID: Generated on Wed Mar 27 22:49:11 EDT 2024 from SVN revision 264633
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)