From 5df9741224eb4ac3c7a88cdc06e20ea62aacdd4d Mon Sep 17 00:00:00 2001 From: Comment Date: Tue, 30 Jul 2013 17:03:09 +0100 Subject: draw node functional --- rotord/bin/settings.xml | 2 +- rotord/src/nodes_drawing.h | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/rotord/bin/settings.xml b/rotord/bin/settings.xml index c0b5781..f0d7c61 100644 --- a/rotord/bin/settings.xml +++ b/rotord/bin/settings.xml @@ -1,2 +1,2 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/rotord/src/nodes_drawing.h b/rotord/src/nodes_drawing.h index 05135d6..ff96d9e 100644 --- a/rotord/src/nodes_drawing.h +++ b/rotord/src/nodes_drawing.h @@ -34,10 +34,14 @@ namespace Rotor { image->setup(frame.w,frame.h); //do this twice or use a goto } //draw onto new or input image - image->convert32(); //pad frame out to 32 bits for cairo + //image->convert32(); //pad frame out to 32 bits for cairo //turns out cairo doesn't draw at all if the stride definition is wrong //crashes like this though - cairo_surface_t * cs = cairo_image_surface_create_for_data (image->RGBdata, + cv::Mat chans; + cv::cvtColor(image->rgb, chans, CV_RGB2RGBA, 4); + + + cairo_surface_t * cs = cairo_image_surface_create_for_data (chans.data, CAIRO_FORMAT_RGB24, image->w, image->h, @@ -57,7 +61,8 @@ namespace Rotor { cairo_show_text (cr, "hello world!"); cairo_fill(cr); - image->convert24(); //convert frame back to 24 bits + //image->convert24(); //convert frame back to 24 bits + cv::cvtColor(chans,image->rgb,CV_RGBA2RGB,3); return image; } private: -- cgit v1.2.3