From 4acd97fe0d3b9c079d72098dfb492060e4ec7795 Mon Sep 17 00:00:00 2001 From: cxl Date: Wed, 12 Dec 2012 20:01:29 +0000 Subject: [PATCH] .rainbow gtk InvertColor git-svn-id: svn://ultimatepp.org/upp/trunk@5648 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- rainbow/Gtk/DrawOp.cpp | 12 ++++++++++-- rainbow/GtkMain/main.cpp | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/rainbow/Gtk/DrawOp.cpp b/rainbow/Gtk/DrawOp.cpp index 0e1ccdb17..241c95a7c 100644 --- a/rainbow/Gtk/DrawOp.cpp +++ b/rainbow/Gtk/DrawOp.cpp @@ -105,9 +105,17 @@ void SystemDraw::DrawRectOp(int x, int y, int cx, int cy, Color color) { if(IsNull(color)) return; - SetColor(color); cairo_rectangle(cr, x, y, cx, cy); - cairo_fill(cr); + if(color == InvertColor()) { + SetColor(White()); + cairo_set_operator(cr, CAIRO_OPERATOR_DIFFERENCE); + cairo_fill(cr); + cairo_set_operator(cr, CAIRO_OPERATOR_OVER); + } + else { + SetColor(color); + cairo_fill(cr); + } } void SystemDraw::DrawLineOp(int x1, int y1, int x2, int y2, int width, Color color) diff --git a/rainbow/GtkMain/main.cpp b/rainbow/GtkMain/main.cpp index 300e71eee..59b7488df 100644 --- a/rainbow/GtkMain/main.cpp +++ b/rainbow/GtkMain/main.cpp @@ -105,6 +105,7 @@ struct MyApp : TopWindow { w.DrawText(100, y, log[i]); y += fcy; } + w.DrawRect(0, 0, 50, fcy * 3, InvertColor()); } MyApp() {