Skip to content

pylon/PylonImage.h#

Contains an image class.

Namespaces#

Name
Pylon
Contains definitions of pylon types.

Classes#

Name
class Pylon::CPylonImage
Describes an image.

Source code#

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

#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>
#include <pylon/PylonImageUserBufferEventHandler.h>

namespace Pylon
{
    // Forward references.
    class CGrabResultPtr;

    class PYLONUTILITY_API CPylonImage : public CPylonImageBase
    {
    public:
        typedef void (*DeleteNotifyFunction_t) (void*);

    public:

        CPylonImage();


        CPylonImage( const CPylonImage& source );


        virtual ~CPylonImage();


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


        static CPylonImage Create( EPixelType pixelType, uint32_t width, uint32_t height, size_t paddingX = 0, EImageOrientation orientation = ImageOrientation_TopDown );


        virtual void CopyImage( const IImage& image );


        virtual void CopyImage( const IImage& image, size_t newPaddingX );


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

        virtual void AttachGrabResultBufferWithUserHints(
            const CGrabResultPtr& grabResult,
            EPixelType pixelType,
            uint32_t width,
            uint32_t height,
            size_t paddingX,
            EImageOrientation orientation = ImageOrientation_TopDown );

        virtual void AttachGrabResultBuffer( const CGrabResultPtr& grabResult );


        virtual void AttachUserBuffer(
            void* pBuffer,
            size_t bufferSizeBytes,
            EPixelType pixelType,
            uint32_t width,
            uint32_t height,
            size_t paddingX,
            EImageOrientation orientation = ImageOrientation_TopDown,
            CPylonImageUserBufferEventHandler* pEventHandler = NULL);


        // 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_TopDown );


        // Implements Pylon::IReusableImage, user defined padding is always supported.
        virtual void Reset( EPixelType pixelType, uint32_t width, uint32_t height, size_t paddingX, EImageOrientation orientation = ImageOrientation_TopDown );

        // Implements Pylon::IReusableImage.
        virtual void Release();

        virtual bool IsUserBufferAttached() const;

        virtual bool IsGrabResultBufferAttached() const;

        virtual size_t GetAllocatedBufferSize() const;

        virtual void ChangePixelType( EPixelType pixelType );


        virtual CPylonImage GetPlane( size_t planeIndex ) const;


        virtual CPylonImage GetAoi( uint32_t topLeftX, uint32_t topLeftY, uint32_t width, uint32_t height ) const;

    private:
        // Internal use only.
        class CPylonImageImpl;
        CPylonImageImpl* m_pImpl;
    };

}

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

#endif /* INCLUDED_PYLONIMAGE_H_6241114 */

Updated on 5 July 2022 at 15:30:01