LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

PlotBitmap rises CPU

I use the PlotBitpmap function and I considered the hints I read in this forum:

- disabling the  ATTR_REFRESH_GRAPH before calling PlotBitmap

- setting the width and height to 0.0  like PlotBitmap(handle, PANEL_GRAPH, x, y, 0.0, 0.0, NULL);

- discarding the Bitmap after plotting

 

With small bitmaps everthing works fine. But I want to plot a semi transparent bitmap created with NewBitmapEx() which height is about 870px. With some graphic cards (like the ATI Radeon 9250) the Plotbitmap function causes a percent rise of the CPU about 40% an my application hangs up.With other graphic cards I have no problems too.

  

What may cause this problem?

 

Thanks in advance

 

0 Kudos
Message 1 of 4
(3,785 Views)

Hello Inomed1,

 

which version of CVI do you use?

 

Maybe the problem comes from the graphicscard-driver. So please download the newest driver and test it again. 

 

If this doesn't solve the problem please send a small example.

 

Thank you.

 

With best regards,

 

Ralf N.

Application Engineering

Germany 

0 Kudos
Message 2 of 4
(3,769 Views)

Hello Ralf N.

 

thanks for your reply.

 

- I use the LabWindows CVI 8.5.1 

- I installed the newest driver of my graphic card, but I have the same problem, too.

 

Here is my example code:

 

 

static void PlotAlphaBitmap (int windowHandle, int *plotHandle, double x, double y, int width, int height, int colorDepth)
{
int size;
int bmpId;
int bitmap;
unsigned char *pixels;
unsigned char *mask;
unsigned char *alpha;

SetCtrlAttribute (windowHandle, PANEL_GRAPH, ATTR_REFRESH_GRAPH, 0);

if (*plotHandle > 0)
{
SetCtrlBitmap(windowHandle, PANEL_GRAPH, *plotHandle, 0);
DeleteGraphPlot(windowHandle, PANEL_GRAPH, *plotHandle, VAL_DELAYED_DRAW);
*plotHandle = -1;
}

size = sizeof(unsigned char) * width * height * colorDepth;

pixels = (unsigned char*) malloc(size);
mask = (unsigned char*) malloc(size);
alpha = (unsigned char*) malloc(size);

memset(pixels, 0xff, size);
memset(mask, 0xff, size);
memset(alpha, 0x40, size);

bitmap = NewBitmapEx(-1, colorDepth, width, height, NULL, pixels, mask, alpha, &bmpId);
*plotHandle = PlotBitmap(windowHandle, PANEL_GRAPH, x, y, 0.0, 0.0, NULL);

if (bitmap >= 0 && *plotHandle > 0)
SetCtrlBitmap(windowHandle, PANEL_GRAPH, *plotHandle, bmpId);

SetCtrlAttribute (windowHandle, PANEL_GRAPH, ATTR_REFRESH_GRAPH, 1);

DiscardBitmap(bmpId);
free(pixels);
free(mask);
free(alpha);
}

 

 With best regards

 

 

0 Kudos
Message 3 of 4
(3,750 Views)

Hello Inomed1,

 

thanks for the reply.

 

At first glance it's not a obvious problem... 

 

So it would be the best if you send me a simplified CVI-project (with all necessary files) so that we can reproduce the issue here. 

 

Does it hang the first time when you call the PlotAlphaBitmap()-function or after serveral calls? 

With which graphic-cards did you test the project?

 

Till the next time.

 

With best regards

 

Ralf N.

Applications Engineering

0 Kudos
Message 4 of 4
(3,731 Views)