LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Vertical flip of CANVAS from DIB image.

Hi,

I have a PCMCIA video capture card which captures to device independent
bitmap.

I then use the functions NewBitMap() and CanvasDrawBitmap() to put this
image into my canvas control.

The problem is that the image is flipped vertically.

The image manipulation part of the project doesn't warrant IMAQ Vision
(I only need to add a couple of marks and measure the distance between
them). Is there a way to flip the image using the standard CVI libraries
only?
--
Regards,

John Cameron.
0 Kudos
Message 1 of 3
(3,289 Views)
As you haven't had an answer yet, I suspect the answer is 'no'.

However, you can use GetBitmapData() to get the bitmap information, rearrange it yourself, then use SetBitmapData() to put the rearranged data back into the bitmap. The documentation on GetBitmapData() indicates how the data is arranged, so it shouldn't be too hard!

--
Martin.
--
Martin
Certified CVI Developer
0 Kudos
Message 2 of 3
(3,289 Views)
In message <506500000005000000664F0100-1073519706000@exchange.ni.com>,
msaxon writes
>As you haven't had an answer yet, I suspect the answer is 'no'.
>
>However, you can use GetBitmapData() to get the bitmap information,
>rearrange it yourself, then use SetBitmapData() to put the rearranged
>data back into the bitmap. The documentation on GetBitmapData()
>indicates how the data is arranged, so it shouldn't be too
>hard!
>
>--
>Martin.

In the end I just made multiple calls to the drawing function as shown
below; the canvas is already the same size as the image.

int CanvasDrawEntireBitmapVflip(int panelHandle, int controlID, int
nBitmapID)
{
/* Variables. */
int height, width, r1, r2;

GetCtrlAttribute (panelHandle, con
trolID, ATTR_HEIGHT, &height);
GetCtrlAttribute (panelHandle, controlID, ATTR_WIDTH,&width);

CanvasStartBatchDraw (panelHandle, controlID);

r2 = height -1;
for(r1=0;r1 CanvasDrawBitmap (panelHandle, controlID,
nBitmapID,MakeRect (r2, 0, 1, width), MakeRect (r1, 0, 1, width));

}


CanvasEndBatchDraw (panelHandle, controlID);

return 0;
}
--
Regards,

John
0 Kudos
Message 3 of 3
(3,289 Views)