Vertical Feedback Bar Graz Visualisation
Posted: Tue Mar 23, 2021 3:06 pm
Hello,
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:
Changing the variables w, h, x and y results in incomplete build later on. Therefore, I have not changed the variable names, but instead defined height as width and width as height. This should correctly change the data for vertical feedback display. As a result however, x, y, w, and h need to be switched wenn gdk_pixbuf_render_to_drawable is called, as x is now the y coordinate etc.
My solution looks like this:
Notice I have also switched the source-inputs from "gdk_pixbuf_get_width(m_LeftBar) - w, 0" to "0, gdk_pixbuf_get_height(m_LeftBar) - w". Again switching the height for the width input.
Unfortunately, built and tested in Openvibe this leads to the following error message in the console:
So about 70% of the frames are not drawn. However, the 30% that get drawn do seem correct. Unfortunately I have no idea what this error means and how to fix it. I'd be happy about any help.
Thanks.
Best,
Colin
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