Skip to content

Commit

Permalink
Implement internal representation of Color.
Browse files Browse the repository at this point in the history
This will help represent the component values of colors with respect to their colorspace
  • Loading branch information
msft-Jeyaram committed Apr 27, 2017
1 parent 0c80b69 commit b53962f
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions Frameworks/include/CGColorInternal.h
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;
}
};

0 comments on commit b53962f

Please sign in to comment.