~ubuntu-branches/ubuntu/wily/opencollada/wily-proposed

« back to all changes in this revision

Viewing changes to COLLADAStreamWriter/include/COLLADASWColor.h

  • Committer: Package Import Robot
  • Author(s): Matteo F. Vescovi
  • Date: 2015-05-14 17:23:27 UTC
  • Revision ID: package-import@ubuntu.com-20150514172327-f862u8envms01fra
Tags: upstream-0.1.0~20140703.ddf8f47+dfsg1
ImportĀ upstreamĀ versionĀ 0.1.0~20140703.ddf8f47+dfsg1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    Copyright (c) 2008-2009 NetAllied Systems GmbH
 
3
 
 
4
    This file is part of COLLADAStreamWriter.
 
5
 
 
6
    Licensed under the MIT Open Source License,
 
7
    for details please see LICENSE file or the website
 
8
    http://www.opensource.org/licenses/mit-license.php
 
9
*/
 
10
 
 
11
#ifndef __COLLADASTREAMWRITER_COLOR_H__
 
12
#define __COLLADASTREAMWRITER_COLOR_H__
 
13
 
 
14
#include "COLLADASWPrerequisites.h"
 
15
 
 
16
 
 
17
namespace COLLADASW
 
18
{
 
19
 
 
20
    class Color
 
21
    {
 
22
 
 
23
    private:
 
24
 
 
25
        double mR;
 
26
        double mG;
 
27
        double mB;
 
28
        double mA;
 
29
        String mSid;
 
30
 
 
31
    public:
 
32
 
 
33
        Color ( double r, double g, double b, double a, String sid="" )
 
34
            : mR ( r ), mG ( g ), mB ( b ), mA ( a ), mSid ( sid ) {}
 
35
 
 
36
        /** Creates a color with opacity 1.*/
 
37
        Color ( double r, double g, double b, String sid="" )
 
38
            : mR ( r ), mG ( g ), mB ( b ), mA ( 1 ), mSid ( sid ) {}
 
39
 
 
40
        /** Creates an invalid color*/
 
41
        Color( )
 
42
            : mR ( -1 ), mG ( -1 ), mB ( -1 ), mA ( -1 ), mSid ( "" ) {}
 
43
 
 
44
        /** Sets the values of color*/
 
45
        void set ( double r, double g, double b, double a, String sid="" );
 
46
 
 
47
        /** Return true if the color is valid, false otherwise*/
 
48
        bool isValid() const;
 
49
 
 
50
        /** Returns the red component*/
 
51
        double getRed() const
 
52
        {
 
53
            return mR;
 
54
        }
 
55
 
 
56
        /** Returns the green component*/
 
57
        double getGreen() const
 
58
        {
 
59
            return mG;
 
60
        }
 
61
 
 
62
        /** Returns the blue component*/
 
63
        double getBlue() const
 
64
        {
 
65
            return mB;
 
66
        }
 
67
 
 
68
        /** Returns the alpha component*/
 
69
        double getAlpha() const
 
70
        {
 
71
            return mA;
 
72
        }
 
73
 
 
74
        /** A white color object*/
 
75
        static const Color WHITE;
 
76
 
 
77
        /** A black color object*/
 
78
        static const Color BLACK;
 
79
 
 
80
    };
 
81
 
 
82
} //namespace COLLADASW
 
83
 
 
84
 
 
85
#endif //__COLLADASTREAMWRITER_COLOR_H__