Skip to content

pylon/PylonBitmapImage.h#

Contains a bitmap image class for displaying images.

Namespaces#

Name
Pylon
Contains definitions of pylon types.

Classes#

Name
class Pylon::CPylonBitmapImage
This class can be used to easily create Windows bitmaps for displaying images.

Source code#

//------------------------------------------------------------------------------
//  Basler pylon SDK
//  Copyright (c) 2010-2022 Basler AG
//  http://www.baslerweb.com
//  Author:  Andreas Gau
//------------------------------------------------------------------------------
#ifndef INCLUDED_PYLONBITMAPIMAGE_H_7767407
#define INCLUDED_PYLONBITMAPIMAGE_H_7767407

#include <pylon/Platform.h>

#ifdef _MSC_VER
#   pragma pack(push, PYLON_PACKING)
#endif /* _MSC_VER */

#include <pylon/stdinclude.h>
#include <pylon/PylonUtility.h>
#include <pylon/PylonImageBase.h>

namespace Pylon
{
    class PYLONUTILITY_API CPylonBitmapImage : public CPylonImageBase
    {
    public:

        CPylonBitmapImage();


        CPylonBitmapImage( const CPylonBitmapImage& source );


        virtual ~CPylonBitmapImage();


        virtual CPylonBitmapImage& operator= ( const CPylonBitmapImage& source );


        static CPylonBitmapImage Create( EPixelType pixelType, uint32_t width, uint32_t height, EImageOrientation orientation = ImageOrientation_BottomUp );


        virtual void CopyImage( const IImage& image );

        virtual void CopyImage(
            const void* pBuffer,
            size_t bufferSizeBytes,
            EPixelType pixelType,
            uint32_t width,
            uint32_t height,
            size_t paddingX,
            EImageOrientation orientation );


        // Implements Pylon::IImage.
        virtual bool IsValid() const;

        // Implements Pylon::IImage.
        virtual EPixelType GetPixelType() const;

        // Implements Pylon::IImage.
        virtual uint32_t GetWidth() const;

        // Implements Pylon::IImage.
        virtual uint32_t GetHeight() const;

        // Implements Pylon::IImage.
        virtual size_t GetPaddingX() const;

        // Implements Pylon::IImage.
        virtual EImageOrientation GetOrientation() const;

        // Implements Pylon::IImage.
        virtual void* GetBuffer();

        // Implements Pylon::IImage.
        virtual const void* GetBuffer() const;

        // Implements Pylon::IImage.
        virtual size_t GetImageSize() const;

        // Implements Pylon::IImage.
        virtual bool IsUnique() const;

        // Implements Pylon::IImage.
        virtual bool GetStride( size_t& strideBytes ) const;

        // Implements Pylon::IReusableImage.
        virtual bool IsSupportedPixelType( EPixelType pixelType ) const;

        // Implements Pylon::IReusableImage, always returns true.
        virtual bool IsAdditionalPaddingSupported() const;


        //Implements Pylon::IReusableImage
        virtual void Reset( EPixelType pixelType, uint32_t width, uint32_t height, EImageOrientation orientation = ImageOrientation_BottomUp );


        // Implements Pylon::IReusableImage.
        // attention: The bitmap handle must not be currently selected into a DC. Otherwise, the bitmap is not freed.
        virtual void Release();


        virtual operator HBITMAP() const;


        virtual HBITMAP Detach();

    private:
        virtual void Reset( EPixelType pixelType, uint32_t width, uint32_t height, size_t paddingX, EImageOrientation orientation );

        // Internal use only.
        class CPylonBitmapImageImpl;
        CPylonBitmapImageImpl* m_pImpl;
    };

}

#ifdef _MSC_VER
#   pragma pack(pop)
#endif /* _MSC_VER */

#endif /* INCLUDED_PYLONBITMAPIMAGE_H_7767407 */

Updated on 5 July 2022 at 15:30:01