forked from microsoft/WinObjC
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement internal representation of Color.
This will help represent the component values of colors with respect to their colorspace
- Loading branch information
1 parent
0c80b69
commit b53962f
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
//****************************************************************************** | ||
// | ||
// Copyright (c) Microsoft. All rights reserved. | ||
// | ||
// This code is licensed under the MIT License (MIT). | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
// THE SOFTWARE. | ||
// | ||
//****************************************************************************** | ||
#pragma once | ||
|
||
#include <CoreGraphics/CGColor.h> | ||
|
||
struct __CGColorQuad { | ||
CGFloat r; | ||
CGFloat g; | ||
CGFloat b; | ||
CGFloat a; | ||
|
||
bool operator==(const __CGColorQuad& other) const { | ||
return (r == other.r) && (g == other.g) && (b == other.b) && (a == other.a); | ||
} | ||
|
||
void Clear() { | ||
r = g = b = a = 0.0f; | ||
} | ||
|
||
void SetColorComponents(CGFloat red, CGFloat green, CGFloat blue, CGFloat alpha) { | ||
r = red; | ||
g = green; | ||
b = blue; | ||
a = alpha; | ||
} | ||
}; |