ImageBaseInterface Class Reference

#include <gfx_image.h>

Inheritance diagram for ImageBaseInterface:

Detailed Description

Base class of all image classes. E.g. ImageLayerInterface, ImageTextureInterface inherits all this functions. This base class is able to handle layers in hierarchical order.

Public Member Functions

MAXON_METHOD Result< void > InitBase (Int width, Int height, const PixelFormat &pixelFormat, IMAGEPROPERTIES::ITYPE type)
 
MAXON_METHOD Result< void > AddChildren (IMAGEHIERARCHY hierarchy, const ImageBaseRef &newChildren, const ImageBaseRef &insertBefore)
 
MAXON_METHOD Int GetWidth () const
 
MAXON_METHOD Int GetHeight () const
 
MAXON_METHOD Int GetChannelCount () const
 
MAXON_METHOD PixelFormat GetPixelFormat () const
 
MAXON_METHOD Result< GetPixelHandlerStructGetPixelHandler (const PixelFormat &dstFormat, const ChannelOffsets &channelOffsets, const ColorProfile &dstColorProfile, GETPIXELHANDLERFLAGS flags, const LayerSetInterface *layerSet) const
 
MAXON_METHOD Result< SetPixelHandlerStructSetPixelHandler (const PixelFormat &srcFormat, const ChannelOffsets &channelOffsets, const ColorProfile &srcColorProfile, SETPIXELHANDLERFLAGS flags)
 
MAXON_METHOD Result< void > GetComponent (Int component, const ImagePos &pos, Pix *data, Int inc, GETPIXELFLAGS flags) const
 
MAXON_METHOD Result< void > SetComponent (Int component, const ImagePos &pos, const Pix *data, Int inc, SETPIXELFLAGS flags)
 
MAXON_METHOD Result< ImageBaseRef > CreateSubImagePart (const DrawRectInt &rect) const
 
MAXON_METHOD Result< ImageBaseRef > TransformColors (const ColorProfile &srcProfile, const ColorProfile &dstProfile, TRANSFORM_COLORS_FLAGS flags)
 
 MAXON_OBSERVABLE (void, ObservableRegionChanged,(const ObserverObjectRef &owner, const UpdateRegion &region), ObservableCombinerRunAllComponent)
 

Private Member Functions

 MAXON_INTERFACE (ImageBaseInterface, MAXON_REFERENCE_NORMAL, "net.maxon.image.interface.imagebase", MAXON_IMPLEMENTATION_MODULE("net.maxon.image"))
 
- Private Member Functions inherited from HierarchyObjectInterface< ImageHierarchy >
MAXON_METHOD Result< void > InsertBefore (const typename HIERARCHY::template Sibling< Interface >::type &nextSibling)
 
MAXON_METHOD Result< void > InsertAfter (const typename HIERARCHY::template Sibling< Interface >::type &prevSibling)
 
MAXON_METHOD Result< void > InsertAsFirstChildOf (const typename HIERARCHY::template Parent< Interface >::type &parent, const ConstDataPtr &branchId=ConstDataPtr())
 
MAXON_METHOD Result< void > InsertAsLastChildOf (const typename HIERARCHY::template Parent< Interface >::type &parent, const ConstDataPtr &branchId=ConstDataPtr())
 
MAXON_METHOD Result< void > InsertAsChildAt (const typename HIERARCHY::template Parent< Interface >::type &parent, Int position, const ConstDataPtr &branchId=ConstDataPtr())
 
MAXON_METHOD Result< void > InsertChildAsFirst (const typename HIERARCHY::template Child< Interface >::type &child, const ConstDataPtr &branchId=ConstDataPtr())
 
MAXON_METHOD Result< void > InsertChildAsLast (const typename HIERARCHY::template Child< Interface >::type &child, const ConstDataPtr &branchId=ConstDataPtr())
 
MAXON_METHOD Result< void > InsertChildAt (const typename HIERARCHY::template Child< Interface >::type &child, Int position, const ConstDataPtr &branchId=ConstDataPtr())
 
MAXON_METHOD Result< void > InsertChildrenAsFirst (const Block< const typename HIERARCHY::template Child< Interface >::type > &children, const ConstDataPtr &branchId=ConstDataPtr())
 
MAXON_METHOD Result< void > InsertChildrenAsLast (const Block< const typename HIERARCHY::template Child< Interface >::type > &children, const ConstDataPtr &branchId=ConstDataPtr())
 
MAXON_METHOD Result< void > InsertChildrenAt (const Block< const typename HIERARCHY::template Child< Interface >::type > &children, Int position, const ConstDataPtr &branchId=ConstDataPtr())
 
MAXON_METHOD Result< void > Replace (const typename HIERARCHY::template Sibling< Interface >::type &newObject)
 
MAXON_METHOD HierarchyObjectRef Remove ()
 
MAXON_METHOD HIERARCHY::template Child< Interface >::type RemoveChildren (const ConstDataPtr &branchId=ConstDataPtr())
 
MAXON_METHOD void RemoveAllChildren ()
 
MAXON_METHOD HIERARCHY::template Child< Interface >::type GetFirstChild (const ConstDataPtr &branchId=ConstDataPtr()) const
 
MAXON_METHOD HIERARCHY::template Child< Interface >::type GetLastChild (const ConstDataPtr &branchId=ConstDataPtr()) const
 
MAXON_METHOD HIERARCHY::template Child< Interface >::type GetChildAt (Int position, const ConstDataPtr &branchId=ConstDataPtr()) const
 
MAXON_METHOD Result< BaseArray< typename HIERARCHY::template Child< Interface >::type > > GetChildren (const ConstDataPtr &branchId=ConstDataPtr()) const
 
MAXON_METHOD Result< BaseArray< ConstDataPtr > > GetBranches () const
 
MAXON_METHOD ConstDataPtr GetBranchId () const
 
MAXON_METHOD void SetLocking (const Bool locking)
 
MAXON_METHOD Bool IsLocked () const
 
MAXON_METHOD HIERARCHY::template Parent< Interface >::type GetParent () const
 
MAXON_METHOD std::add_pointer< HierarchyObjectInterface >::type GetParentPtr () const
 
MAXON_METHOD HIERARCHY::template Sibling< Interface >::type GetNext () const
 
MAXON_METHOD HIERARCHY::template Sibling< Interface >::type GetPrev () const
 
MAXON_METHOD HIERARCHY::template Sibling< Interface >::type GetFirst () const
 
MAXON_METHOD HIERARCHY::template Sibling< Interface >::type GetLast () const
 
MAXON_METHOD void ParentChanged (Bool removed)
 
MAXON_METHOD std::add_pointer< HierarchyObjectInterface >::type FindNextLeaf (const HierarchyObjectInterface *stopAtParent) const
 
 MAXON_OBSERVABLE (Result< void >, ObservableHierarchyInsert,(const HierarchyObjectRef<> &sender, const HierarchyObjectRef<> &object, const ConstDataPtr &branchId), ObservableCombinerRunAllComponent)
 
 MAXON_OBSERVABLE (Result< void >, ObservableHierarchyRemove,(const HierarchyObjectRef<> &sender, const HierarchyObjectRef<> &object, const ConstDataPtr &branchId), ObservableCombinerRunAllComponent)
 
MAXON_METHOD void FlushBranches ()
 

Member Function Documentation

◆ MAXON_INTERFACE()

MAXON_INTERFACE ( ImageBaseInterface  ,
MAXON_REFERENCE_NORMAL  ,
"net.maxon.image.interface.imagebase"  ,
MAXON_IMPLEMENTATION_MODULE("net.maxon.image")   
)
private

◆ InitBase()

MAXON_METHOD Result<void> InitBase ( Int  width,
Int  height,
const PixelFormat &  pixelFormat,
IMAGEPROPERTIES::ITYPE  type 
)

Initializes the bitmap with a given size/height. The bitmap content is cleared with 0 bytes.

Parameters
[in]widthImage width.
[in]heightImage height.
[in]pixelFormatImage PixelFormat.
[in]typeImage type set into IMAGEPROPERTIES::TYPE. You can query this with image.Get(IMAGEPROPERTIES::TYPE).
Returns
OK on success.

◆ AddChildren()

MAXON_METHOD Result<void> AddChildren ( IMAGEHIERARCHY  hierarchy,
const ImageBaseRef &  newChildren,
const ImageBaseRef &  insertBefore 
)
Parameters
[in]hierarchyDefines the hierarchy to which the children belongs to.
[in]newChildrenNew children to add under this object.
[in]insertBeforeInsert the children before this object. nullptr will append the object at the end.
Returns
OK on success.

◆ GetWidth()

MAXON_METHOD Int GetWidth ( ) const

Returns the width of the bitmap.

◆ GetHeight()

MAXON_METHOD Int GetHeight ( ) const

Returns the height of the bitmap.

◆ GetChannelCount()

MAXON_METHOD Int GetChannelCount ( ) const

Returns the channel count of the bitmap.

◆ GetPixelFormat()

MAXON_METHOD PixelFormat GetPixelFormat ( ) const

Returns the pixel format connected to this bitmap.

◆ GetPixelHandler()

MAXON_METHOD Result<GetPixelHandlerStruct> GetPixelHandler ( const PixelFormat &  dstFormat,
const ChannelOffsets channelOffsets,
const ColorProfile dstColorProfile,
GETPIXELHANDLERFLAGS  flags,
const LayerSetInterface layerSet 
) const

To access pixel data a GetPixelHandlerStruct is needed. This optimizes the access to the pixel data see GetPixelHandlerStruct.

Parameters
[in]dstFormatDestination pixel format that should be read with this pixel handler.
[in]channelOffsetsDestination channel offsets in bits.
[in]dstColorProfileOptional parameter which is only necessary if the color spaces of the given pixel formats doesn't match. In that case the conversion will be performed using the correct color conversion.
[in]flagsFlags for the GetPixel operation.
[in]layerSetOptional LayerSet or nullptr.
Returns
A valid GetPixelHandlerStruct struct if successful.

◆ SetPixelHandler()

MAXON_METHOD Result<SetPixelHandlerStruct> SetPixelHandler ( const PixelFormat &  srcFormat,
const ChannelOffsets channelOffsets,
const ColorProfile srcColorProfile,
SETPIXELHANDLERFLAGS  flags 
)

To access pixel data a SetPixelHandlerStruct is needed. This optimizes the access to the pixel data see SetPixelHandlerStruct.

Parameters
[in]srcFormatSource pixel format that should be written with this pixel handler.
[in]channelOffsetsSource channel offsets in bits.
[in]srcColorProfileOptional parameter which is only necessary if the color spaces of the given pixel formats doesn't match. In that case the conversion will be performed using the correct color conversion.
[in]flagsFlags for the SetPixel operation.
Returns
A valid SetPixelHandlerStruct struct if successful.

◆ GetComponent()

MAXON_METHOD Result<void> GetComponent ( Int  component,
const ImagePos pos,
Pix data,
Int  inc,
GETPIXELFLAGS  flags 
) const

Access single components of the image.

Parameters
[in]componentIndex of the component.
[in]posImagePos of the data to read.
[in]dataDestination buffer.
[in]incDistance between 2 pixels in the destination buffer.
[in]flagsFlags to control the read operation.
Returns
OK on success.

◆ SetComponent()

MAXON_METHOD Result<void> SetComponent ( Int  component,
const ImagePos pos,
const Pix data,
Int  inc,
SETPIXELFLAGS  flags 
)

Access single components of the image.

Parameters
[in]componentIndex of the component.
[in]posImagePos of the data to write.
[in]dataSource buffer.
[in]incDistance between 2 pixels in the source buffer.
[in]flagsFlags to control the write operation.
Returns
OK on success.

◆ CreateSubImagePart()

MAXON_METHOD Result<ImageBaseRef> CreateSubImagePart ( const DrawRectInt rect) const

Create a new ImageBaseRef as a sub image of the given image with the given rectangle. The image will not be copied! It generates only a reference to the original image with the rectangle set to the portion of the image.

Parameters
[in]rectPart of the image.
Returns
New Image as part of the given image.

◆ TransformColors()

MAXON_METHOD Result<ImageBaseRef> TransformColors ( const ColorProfile srcProfile,
const ColorProfile dstProfile,
TRANSFORM_COLORS_FLAGS  flags 
)

Transforms the colors of an image. It either creates a new image or

Parameters
[in]srcProfileSource profile. If this is empty, the image profile will be used.
[in]dstProfileDestination profile. Must not be empty.
[in]flagsFlags.
Returns
Original image or new image with transfomed colors.

◆ MAXON_OBSERVABLE()

MAXON_OBSERVABLE ( void  ,
ObservableRegionChanged  ,
(const ObserverObjectRef &owner, const UpdateRegion &region)  ,
ObservableCombinerRunAllComponent   
)

Observable: This observable is fired as soon as anybody modifies the pixel data of this object.