Skip to content

Commit ef094b2

Browse files
authored
ofSetColor without template (#7788)
1 parent f2c12f8 commit ef094b2

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

libs/openFrameworks/graphics/ofGraphics.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,23 @@ void ofSetFloatColor(const ofFloatColor& acolor){
601601
ofSetFloatColor( acolor.r, acolor.g, acolor.b, acolor.a);
602602
}
603603

604+
//----------------------------------------------------------
605+
void ofSetColor(const ofColor & acolor) {
606+
float limit = ofColor::limit();
607+
ofSetFloatColor((float)acolor.r / limit, (float)acolor.g / limit, (float)acolor.b / limit, (float)acolor.a / limit);
608+
}
609+
610+
//----------------------------------------------------------
611+
void ofSetColor(const ofFloatColor & acolor) {
612+
ofSetFloatColor(acolor);
613+
}
614+
615+
//----------------------------------------------------------
616+
void ofSetColor(const ofShortColor & acolor) {
617+
float limit = ofShortColor::limit();
618+
ofSetFloatColor((float)acolor.r / limit, (float)acolor.g / limit, (float)acolor.b / limit, (float)acolor.a / limit);
619+
}
620+
604621
//----------------------------------------------------------
605622
void ofSetHexColor(int hexColor){
606623
int r = (hexColor >> 16) & 0xff;

libs/openFrameworks/graphics/ofGraphics.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ void ofSetFloatColor(float gray);
6060
void ofSetFloatColor(const ofFloatColor & acolor, float a);
6161
void ofSetFloatColor(const ofFloatColor & acolor);
6262

63-
template <typename T>
64-
void ofSetColor(const ofColor_<T> & acolor) {
65-
float limit = ofColor_<T>::limit();
66-
ofSetFloatColor(acolor.r / limit, acolor.g / limit, acolor.b / limit, acolor.a / limit);
67-
}
63+
64+
void ofSetColor(const ofColor & acolor);
65+
void ofSetColor(const ofFloatColor & acolor);
66+
void ofSetColor(const ofShortColor & acolor);
67+
6868

6969
/// Sets the draw color with r,g,b, passed in as a hex. Hex is a conventient
7070
/// way to write colors.

0 commit comments

Comments
 (0)