LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

problems with size of bitmaps

Hi
we are using CVI 5.5 under XP and 2000 and we have a problem with creating pictures and plot them on graphs.

With

        // das Bild zusammenbauen
        rw = NewBitmap(-1, 24, Width, Height-1, 0, PictureBits, 0, &Handle);

we create a new bitmap. Example: Width = 570, Height = 340

To show it on the screen we use

        //
        GetBitmapData(Job.Picture.Handle, NULL, NULL, &xWidth, &yHeight, NULL, NULL, NULL);

        //
        Handle = PlotBitmap(jobpictureHandle, PICTURE_GRAPH, 0, 0, xWidth, yHeight, "");
or
        Handle = PlotBitmap(jobpictureHandle, PICTURE_GRAPH, 0, 0, 0, 0, "");

        //
        SetCtrlBitmap(jobpictureHandle, PICTURE_GRAPH, Handle, Job.Picture.Handle);

The problem is, that there are some lines missing on the picture. That means, if we want to create a picture with 340 line the picture in the screen does only have 300 lines. In both directions lines are missing.

Does any one know something about this?

Greetings
Oliver
0 Kudos
Message 1 of 6
(3,795 Views)

I cannot go back now to version 5.5, but looking in CVI6 online help I noticed that GetBitmapData returns height and width in pixels, while PlotBitmap expresses height and width in graph units, possibly different from pixels in either of X / Y directions. Moreover, it seems to me that if graph plotting area height and width are not the same as bitmap dimensions this could lead to some adaptation of the image and possibly to the effects you are observing.

I am not sure of it, but you may try getting graph plotting area dimensions and setting axis scales to the same values and see if your problem is solved.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 6
(3,787 Views)

Hello Roberto,

it is correct, that it is possible to expand or shrink the bitmap with the PlotBitmap Function. I tried both but it is the same result. Also I tried to make the control much bigger to see if there is something hidden under the margin of the control. But also if I make the control bigger the image is not in the right size. Some lines are still missing.

 

cu

Oliver

0 Kudos
Message 3 of 6
(3,784 Views)

Hello Oliver,

 

I'm assuming that the reason you're not seeing the entire bitmap in the graph is because the max and min of the axes is not large enough to display the entire bitmap.

 

As Roberto pointed out, when you pass a specific width and height  to PlotBitmap, that width and height is interpreted as graph units, and not pixels. Although this is probably not what you want to do, if your graph axes are set to autoscale, then they should adjust to the full size of the bitmap.

 

However, passing (0,0) instead of (width,height) changes things completely. Passing (0,0) means that the bitmap should be displayed in its original dimensions, in pixels, whatever those might be, irrespective of the graph units. By default, the lower-left corner of the bitmap is positioned on the X,Y point that you pass to PlotBitmap, and the rest of the bitmap grows up and to the right (by the way, you can override the lower-left corner default by setting the ATTR_PLOT_ORIGIN plot attribute). The important point to note, however, is that when you pass (0,0) for the bitmap dimensions, the graph does not autoscale to the entire bitmap, since the dimensions of the bitmap are in pixels, and not in graph units. In other words, the top and right edges of the bitmap don't have inherent coordinates. The graph only autoscales to the X,Y origin of the bitmap. If this is what you want to do, you'll have to explicitly set the axis end points to something that will allow the full bitmap to be displayed.

 

Luis

0 Kudos
Message 4 of 6
(3,749 Views)

Hi Luis,

I am not sure if I understand you right, I will try it

 

Thanks

Oliver

0 Kudos
Message 5 of 6
(3,717 Views)

Hi Oliver,

 

If you attach a screenshot of your graph, along with the actual code that you are using to plot, I might be able to address your problem more specifically.

 

Luis

0 Kudos
Message 6 of 6
(3,689 Views)