1
Graphics / Blending colors
« on: April 09, 2016, 09:27:19 pm »
Hi. I have are simple task. Mix the three colors (Cyan, Magenta, Yellow) to obtain black color. How i can get this?
My try dosent working right.
My try dosent working right.
int main() {
sf::RenderWindow window (sf::VideoMode(winW, winH), "CMYK CMYK CMYK");
sf::Color cl_c(0, 255, 255, 85); //Cyan
sf::Color cl_m(255, 0, 255, 85); //Magenta
sf::Color cl_y(255, 255, 0, 85); //Yellow
sf::CircleShape c1(50);
c1.setPosition(70, 30);
c1.setFillColor(cl_c);
sf::CircleShape c2(50);
c2.setPosition(150, 20);
c2.setFillColor(cl_m);
sf::CircleShape c3(50);
c3.setPosition(100, 60);
c3.setFillColor(cl_y);
sf::Event event;
while (window.isOpen()) {
while (window.pollEvent(event)) {
if (event.type == sf::Event::Closed) {
window.close();
return 0;
}
window.clear(sf::Color::White);
window.draw(c1);
window.draw(c2);
window.draw(c3);
window.display();
}
}
return 0;
}
sf::RenderWindow window (sf::VideoMode(winW, winH), "CMYK CMYK CMYK");
sf::Color cl_c(0, 255, 255, 85); //Cyan
sf::Color cl_m(255, 0, 255, 85); //Magenta
sf::Color cl_y(255, 255, 0, 85); //Yellow
sf::CircleShape c1(50);
c1.setPosition(70, 30);
c1.setFillColor(cl_c);
sf::CircleShape c2(50);
c2.setPosition(150, 20);
c2.setFillColor(cl_m);
sf::CircleShape c3(50);
c3.setPosition(100, 60);
c3.setFillColor(cl_y);
sf::Event event;
while (window.isOpen()) {
while (window.pollEvent(event)) {
if (event.type == sf::Event::Closed) {
window.close();
return 0;
}
window.clear(sf::Color::White);
window.draw(c1);
window.draw(c2);
window.draw(c3);
window.display();
}
}
return 0;
}