I am implementing a version of the Graz Visualisation box with Vertical Feedback bars. However, I am struggling to with the draw function.
I have located the graphical elements:
Code: Select all
gint w = gint(fabs(width * fabs(usedScale) / 2));
w = (w > (width / 2)) ? (width / 2) : w;
gint x = width / 2;
const gint h = height / 6;
const gint y = (height / 2) - (h / 2);
if (m_BarScale < 0)
{
x -= w;
gdk_pixbuf_render_to_drawable(m_LeftBar, m_DrawingArea->window, nullptr, gdk_pixbuf_get_width(m_LeftBar) - w, 0, x, y, w, h, GDK_RGB_DITHER_NONE, 0, 0);
}
else
{
gdk_pixbuf_render_to_drawable(m_RightBar, m_DrawingArea->window, nullptr, 0, 0, x, y, w, h, GDK_RGB_DITHER_NONE, 0, 0);
}
My solution looks like this:
Code: Select all
if (m_BarScale < 0)
{
x -= w;
gdk_pixbuf_render_to_drawable(m_LeftBar, m_DrawingArea->window, nullptr, 0, gdk_pixbuf_get_height(m_LeftBar) - w, y, x, h, w, GDK_RGB_DITHER_NONE, 0, 0);
}
else
{
gdk_pixbuf_render_to_drawable(m_RightBar, m_DrawingArea->window, nullptr, 0, 0, y, x, h, w, GDK_RGB_DITHER_NONE, 0, 0);
}
Unfortunately, built and tested in Openvibe this leads to the following error message in the console:
Code: Select all
(openvibe-designer.exe.22928) Gdk-CRITICAL **: gdk_drawable_real-draw_pixbuf: assertion 'src_y >= 0 && src_y + height <= gdk_pixbuf_get_height (pixbuf)' failed
Thanks.
Best,
Colin