Function

NSBestDepth

Attempts to return a window depth adequate for the specified parameters.

Declaration

NSWindowDepth NSBestDepth(NSColorSpaceName colorSpace, NSInteger bps, NSInteger bpp, BOOL planar, BOOL *exactMatch);

Discussion

Returns a window depth deep enough for the given number of colors in colorSpace, bits per sample specified by bps, bits per pixel specified by bpp, and whether planar as specified by planar. Upon return, the variable pointed to by exactMatch is YES if the window depth can accommodate all of the values specified by the parameters, NO if it can’t.

Use this function to compute window depths. This function tries to accommodate all the parameters (match or better); if there are multiple matches, it gives the closest, with matching colorSpace first, then bps, then planar, then bpp. bpp is “bits per pixel”; 0 indicates default (same as the number of bits per plane, either bps or bps * NSNumberOfColorComponents); other values may be used as hints to provide backing stores of different configuration; for instance, 8-bit color. The exactMatch parameter is optional and indicates whether all the parameters matched exactly.

See Also

Working with Window Depths

NSAvailableWindowDepths

Returns the available window depth values.

NSBitsPerPixelFromDepth

Returns the bits per pixel for the specified window depth.

NSBitsPerSampleFromDepth

Returns the bits per sample for the specified window depth.

NSColorSpaceFromDepth

Returns the name of the color space corresponding to the passed window depth.

NSNumberOfColorComponents

Returns the number of color components in the specified color space.

NSPlanarFromDepth

Returns whether the specified window depth is planar.