= FDO RFC 1 - Support Raster Property !BitsUsedPerPixel = This page contains a change request (RFC) for the FDO Open Source project. More FDO RFCs can be found on the [wiki:FDORfcs RFCs] page. == Status == ||RFC Template Version||(1.0)|| ||Submission Date||Mar 13, 2007|| ||Last Modified||Greg Boone[[Timestamp]]|| ||Author||Greg Boone|| ||RFC Status||Draft|| ||Implementation Status||pending|| ||Proposed Milestone||3.3.0.0|| ||Assigned PSC guide(s)||Greg Boone|| ||'''Voting History'''||TBD|| ||+1|||| ||+0|||| ||-0|||| ||-1|||| == Overview == The purpose of this RFC is to allow FDO users to determine the number of bits used per pixel when interfacing with FDO providers that support the FdoIRaster and FdoIRasterDataModel interface. == Motivation == The FDO API !FdoRasterDataModel class currently includes a property to determine the number of bits per pixel returned in an FdoIRaster data stream. The FdoIRaster data stream contains the raw raster image data. /// \brief[[BR]] /// The !FdoRasterDataModel specifies the data type and organization[[BR]] /// of raster data retrieved and stored. Using this class and the image[[BR]] /// extents in width and length, the binary format of the image data returned[[BR]] /// by and accepted by the FdoIStreamReader class can be interpreted.[[BR]] class !FdoRasterDataModel: public FdoIDisposable[[BR]] {[[BR]] public:[[BR]] …[[BR]] …[[BR]] /// \brief[[BR]] /// Get the number of bits per pixel.[[BR]] /// [[BR]] /// \return[[BR]] /// Returns the number of bits for each pixel. For multi-channel[[BR]] /// data the bits per channel will be this value devided by the numer of[[BR]] /// channels. For example, RGB data has three channels, so if this[[BR]] /// method returns twelve, each channel is four bits.[[BR]] /// [[BR]] FDO_API virtual !FdoInt32 !GetBitsPerPixel (); /// \brief[[BR]] /// Set the number of bits per pixel.[[BR]] /// [[BR]] /// \param bpp [[BR]] /// The number of bits per pixel desired.[[BR]] /// Values of 1, 4, 8, 16, 24, 32, 48 and 64 bits per channel may[[BR]] /// be supported. Others values (i.e. indivisible by the number of channels)[[BR]] /// are likely to raise a !FdoException.[[BR]] /// [[BR]] FDO_API virtual void !SetBitsPerPixel (!FdoInt32 bpp); …[[BR]] …[[BR]] };[[BR]] However, returning only the bits per pixel is not sufficient to quickly and efficiently process the raster stream. The user should also be made aware of the bits used per pixel. In certain circumstances, the raster image does not completely use all available bits and pads the extra bits in the raster stream with NULL values. Without knowing the bits used per pixel, the client has to spend processing cycles determining how many bits are used thus affecting the performance of their applications. This issue was identified by IKonus, a corporate user of the FDO API. == Proposed Solution == The FDO !FdoRasterDataModel class will be extended to export the number of bits used per pixel. /// \brief[[BR]] /// The !FdoRasterDataModel specifies the data type and organization[[BR]] /// of raster data retrieved and stored. Using this class and the image[[BR]] /// extents in width and length, the binary format of the image data returned[[BR]] /// by and accepted by the FdoIStreamReader class can be interpreted.[[BR]] class !FdoRasterDataModel: public !FdoIDisposable[[BR]] {[[BR]] public:[[BR]] …[[BR]] …[[BR]] /// \brief[[BR]] /// Get the number of bits per pixel.[[BR]] /// [[BR]] /// \return[[BR]] /// Returns the number of bits for each pixel. For multi-channel[[BR]] /// data the bits per channel will be this value devided by the numer of[[BR]] /// channels. For example, RGB data has three channels, so if this[[BR]] /// method returns twelve, each channel is four bits.[[BR]] /// [[BR]] FDO_API virtual !FdoInt32 !GetBitsPerPixel ();[[BR]] /// \brief[[BR]] /// Set the number of bits per pixel.[[BR]] /// [[BR]] /// \param bpp [[BR]] /// The number of bits per pixel desired.[[BR]] /// Values of 1, 4, 8, 16, 24, 32, 48 and 64 bits per channel may[[BR]] /// be supported. Others values (i.e. indivisible by the number of channels)[[BR]] /// are likely to raise an !FdoException.[[BR]] /// [[BR]] FDO_API virtual void !SetBitsPerPixel (!FdoInt32 bpp);[[BR]] /// \brief[[BR]] /// Get the number of bits used per pixel.[[BR]] /// [[BR]] /// \return[[BR]] /// Returns the number of bits used for each pixel. For multi-channel[[BR]] /// data the bits used per channel will be this value devided by the numer of[[BR]] /// channels. For example, RGB data has three channels, so if this[[BR]] /// method returns twelve, each channel uses four bits.[[BR]] /// [[BR]] FDO_API virtual !FdoInt32 !GetBitsUsedPerPixel ();[[BR]] /// \brief[[BR]] /// Set the number of bits used per pixel.[[BR]] /// [[BR]] /// \param bpp [[BR]] /// The number of bits per used per pixel.[[BR]] /// [[BR]] /// \remarks[[BR]] /// This method is primarily being defined for object construction purposes[[BR]] /// within the provider and would not be called by client applications.[[BR]] FDO_API virtual void !SetBitsUsedPerPixel (!FdoInt32 bpp);[[BR]] …[[BR]] …[[BR]] };[[BR]] '''''The new property will also be added to the FDO Managed API.''''' == Notes == This API change is applicable for all raster formats. Image formats who do not explicitly advertise their bitsUserPerPixel will have this value set to the value of bitsPerPixel. This ECO is being written in order to better support ongoing development using the FDO Raster providers. Existing customers such as AutoCAD Map and !MapGuide have implemented work-arounds to calculate the bitsUsedPerPixel manually. While this calculation affects performance, the cost is slight. == Test Plan == Raster Provider unit tests should be expanded to include usage of the new !GetBitsUsedPerPixel Property == Impact of Not Implementing this ECO == If this ECO is not implemented, clients such as IKonus will have to calculate the number of bits used manually and accept the impact on performance. == Funding/Resources == Autodesk to provide resources / funding.