LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Using externally generated pixmap in Canvas

I am evaluating how difficult it would be to use an external library for drawing images in LabWindows. The library comes with binaries

only that were generated in MS Visual Studio, so I assume they can be linked loaded into LabWindows.

Are there likely to be linking issues if the external libraries referenence some Microsoft library not included in LabWindows.

Or does LabWindows have the full complement of Microsoft libraries so anything in Visual Studio will link?

 

There is an API for drawing a image to memory and also drawing an image to a Hardware Device Context.

 

The question is should I be able to use these functions when linked and called from a labwindows gui app to

first draw the pixmap nd then copy the pixmap to a LabWindows Canvas?

 

Canvases don't support alpha channels but the library drawing routing uses an alpha channel. 

 

I am newbie to LabWindows.

 

Here is the Labwindows function that looks like what I should use

 

-------
CanvasDrawBitmap
int CanvasDrawBitmap (int panelHandle, int controlID, int bitmapID, Rect sourceRectangle, Rect destinationRectangle);

 

 

Here are the external API functions

 

-------------
// List of supported color formats for GM_DrawLayerListToMemory
typedef uint32 GM_ColorFormat_t32; enum
    {
    GM_ColorFormat_32Bit_ABGR   = 0,        // 32-bit color (alpha, blue, green, red)
    GM_ColorFormat_32Bit_ARGB   = 1,        // 32-bit color (alpha, red, green, blue)
    GM_ColorFormat_16Bit_565    = 2,        // 16-bit color (5 bits red, 6 bits green, 5 bits blue)
    GM_ColorFormat_NumFormats
    };
Draws one or more layers to the provided device context at the given location. If aWorldBounds is not NULL, at least the specified area will be drawn. The aspect ratio of the screen pixels will be maintained, so slightly more of the world bounds than specified may be drawn. If aWorldBounds is NULL, the entire specified layer or all of the loaded layers will be rendered.
GM_DrawLayerListToMemory
GM_Error_t32 GM_DrawLayerListToMemory
    ( 
    GM_LayerHandle_t32*     aLayerList,     // List of layers to draw or NULL for all
    uint32                  aLayerCount,    // Number of layers in list (0 for all)
    GM_DrawFlags_t32        aDrawFlags,     // Flags controlling how the draw is performed
    const GM_Rectangle_t*   aWorldBounds,   // World bounds to draw or NULL for all
    GM_ColorFormat_t32      aColorFormat,   // Color format used in data buffer
    sint32                  aPixelWidth,    // Width in pixels to draw
    sint32                  aPixelHeight,   // Height in pixels to draw
    void*                   aDataBuf,       // Buffer to hold output color data
    sint32                  aRowWidthBytes  // Width of a single row in the array in bytes
    );
Draws one or more layers to the provided memory buffer at the given location. If aWorldBounds is not NULL, at least the specified area will be drawn. The aspect ratio of the screen pixels will be maintained, so slightly more of the world bounds than specified may be drawn. If aWorldBounds is NULL, the entire specified layer or all of the loaded layers will be rendered.
GM_DrawLayerList
GM_Error_t32 GM_DrawLayerList
    (
    HDC                     aDC,            // Device context to draw to
    GM_LayerHandle_t32*     aLayerList,     // List of layers to draw or NULL for all
    uint32                  aLayerCount,    // Number of layers in list (0 for all)
    GM_DrawFlags_t32        aDrawFlags,     // Flags controlling how the draw is performed
    const GM_Rectangle_t*   aWorldBounds,   // World bounds to draw or NULL for all
    sint32                  aLeftPixel,     // Left pixel coordinate to draw to
    sint32                  aTopPixel,      // Top pixel coordinate to draw to
    sint32                  aPixelWidth,    // Width in pixels to draw
    sint32                  aPixelHeight    // Height in pixels to draw
    );

 

0 Kudos
Message 1 of 2
(3,094 Views)

Samuel,

 

Yes, you can call DLLs or Assemblies written in other languages in CVI. Check out our FAQ: Using Dynamic Link Libraries with LabWindows/CVI. In particular look at the sections on How Can I Call Third-Party DLLs from LabWindows/CVI and How Can I Use the Windows SDK from LabWindows/CVI. If you can get a bitmap from the DLL you are using, then you should be able to draw it to the canvas using the CanvasDrawBitmap. Take a look at the Alphablend example that ships with CVI for an example of how to use a bitmap with an alpha channel on a canvas.

National Instruments
0 Kudos
Message 2 of 2
(3,085 Views)