Regions and masks can be accessed using the routines listed below. see the features of regionsfor a more comprehensive overview of region structures, masks, and headers,
This routine creates a region of the given type with the indicated number of rows and columns. The region's header is empty. The region has no mask. The pixels in the region are not cleared. They have undetermined values. The name which is passed in is to tag the structure. The name is copied. The user may make a mask having the same number of rows and columns using shMaskNew and place the address in the mask field of the region structure. Explain errors using sh_error() or sh_fatal().
Given a region, a row, a col, number of rows, number of cols, return a pointer to a region structure which points to the rectangle described by (ROW0, COL0) to (ROW0+NROW-1, COL0+NCOL-1)in the parent. Return a null if the arguments have an error, or if the supporting data structures cannot be allocated. Name the new region by copying in NAME. Explain errors using sh_error() or sh_fatal().
Mask is built up from the enumerated type REGION_FLAGS. The argument may be specified as NO_FLAGS, or the "logical or" of any of COPY_MASK, COPY_HEADER_DEEP, ENLARGE_EXACT, READ_ONLY and READ_WRITE. If READ_ONLY and READ_WRITE both specified, then READ_ONLY is used.
The subregion has a mask only if REGION has a mask and COPY_MASK is specified. In that case, the mask in the subregion in not a copy, but points to the mask in corresponding parts of the parent region.
The subregion has a header which is copied out from the parents' if COPY_HEADER_DEEP is present.
Free the space associated with REGION. It is an error to free a physical region. It is an error to free a region which has sub-regions. If the region has a mask, it is deleted as well. Errors are explained using shError();
Image pixels and mask pixels are not really freed if REGION is a subregion, as they properly belong to a parent.
Fill out a REGINFO structure which describes REGION. Write its address into the location specified by REGINFO. The user should NOT free the pointer to REGINFO. The returned REGINFO structure may be reused by subsequent calls to regInfoGet().
Create a new region based on an existing region. If successful, the address of a new region is returned and the return status parameter is set to DERVISH_SUCCESS. Otherwise a NULL is returned and the return status is set accordingly.
The new region will be of the type specified. REGION_FLAGS should be set to either NO_FLAGS or to the logical OR of any of COPY_MASK and COPY_HEADER_DEEP.
If COPY_MASK is specified and the parent region has a mask, then the new region has copy of the parent's mask, otherwise the region does not have a mask.
If COPY_HEADER_DEEP is specified the header state of the region is copied into the new region.
Note that when successful, a NEW region is created. Any subsequent changes to the new region will NOT be reflected in the parent (or vice-versa).
Create a MASK structure and mask pixels. Return NULL on error. Clear the mask to 0. The error is explained using sh_error();
Given a parent mask, a row, a col, number of rows, number of cols, return a pointer to a mask structure which points to the rectangle described by (ROW0, COL0) to (ROW0+NROW-1, COL0+NCOL-1)in the parent. Return a null if the arguments have an error, or if the supporting data structures cannot be allocated. Name the new region by copying in NAME. Explain errors using sh_error() or sh_fatal().
FLAGS is built up from the enumerated type REGION_FLAGS. The argument may be specified as NO_FLAGS, or READ_ONLY or READ_WRITE.
Delete the mask structure, and its supporting storage. It is an error to delete a mask which has sub-mask. Errors are explained using shError().
Mask pixels are not really freed if REGION is a subregion, as they properly belong to a parent.
This procedure tests whether the mask is writable; 0 is returned if the mask is not to be written into.
This procedure tests whether the pixels in the region are writable; 0 is returned if the pixels are not to be written into.