Holes Construction
A hole In EasyObject, a hole is a maximally-sized area of adjacent connected pixels belonging to the layer background that is completely surrounded by an object. is a set of connected pixels that are entirely surrounded by a parent object In a general content, the term object should be understood with the meaning of a class instance. In EasyObject, an object is a maximally-sized area of adjacent connected pixels belonging to the layer foreground. (4 or 8 pixels depending on the connexity mode).
A hole has no child. Objects inside a hole are considered as separate objects.
Objects and holes are both represented by the class ECodedElement, so they are managed in the same way and share the same functions. Use ECodedElement.IsObject or ECodedElement.IsHole to determine the type of the coded element An object or a hole..
Encoding the white layer A binary image constructed by a segmentation process. (3 objects and 3 holes)
Encoding the black layer (4 objects and 3 holes)

- Declare a new ECodedImage2 object.
- Declare an EImageEncoder and, if applicable, select and setup the appropriate segmenter, and choose the appropriate layer(s) to encode.
- Set up an output image.
- Encode the image.
- Declare a helper function to draw the runs. A helper function (see also section Object Construction/Working at the Run Maximally-sized area of adjacent pixels on the same row belonging to the background or to the foreground of a layer. Level) draws the runs in an output image, using, for example, a given color. This function can be shared for objects and holes.
- Draw the objects and their holes in the output image. It is necessary to iterate over the objects of the chosen layer.
- The helper function draws the runs of each object (DrawRuns) using a specific color.
- The holes are iterated over the current object, and their runs are drawn.
- Each hole of an object is drawn with a different color computed in the global function (GetFadedColor) that returns a color. This color depends upon the hole index, for example a gradation of red to green colors.
Raw image (left) Building of objects and all holes (right)