BitmapExtensions
Rhino specific extension methods for System.Drawing.Bitmap
Methods
[CLSCompliant(false)]
public static FileReference BitmapAsTextureFileReference(this Bitmap bitmap, uint crc)
Inserts bitmap into Rhino's texture manager and returns a FileReference.
Parameters:
| bitmap (Bitmap) | The bitmap which will be referenced by the FileReference. |
| crc (uint) | The crc of the bitmap. This should be a unique number which changes if the contents of the bitmap changes. NOTE: if a different bitmap is provided using the same crc as a previous bitmap, then the previous bitmap will be overwritten in the texture manager and both previously returned FileReferences will reference the newly provided bitmap. |
public static Bitmap ConvertToNormalMap(this Bitmap bitmap, bool bLossyCompressionSource, out bool bPositiveZComponent)
Use this function to convert a System.Drawing.Bitmap from a bump to a normal texture
Parameters:
| bitmap (Bitmap) | |
| bLossyCompressionSource (bool) | True if the source of the bitmap is an image with lossy compression (e.g. jpg). False otherwise. The check will be less strict if the image can contain errors due to lossy compression. |
| bPositiveZComponent (out bool) | True if the image is a normal map with the z-component mapped to the range 0 .. +1. False if the image is a normal map with the z-component mapped to the range -1 .. +1. |
public static bool IsNormalMap(this Bitmap bitmap, bool bLossyCompressionSource, out bool bPositiveZComponent)
Call this method to see if the DIB appears to be a normal map.
Parameters:
| bitmap (Bitmap) | |
| bLossyCompressionSource (bool) | True if the source of the bitmap is an image with lossy compression (e.g. jpg). False otherwise. The check will be less strict if the image can contain errors due to lossy compression. |
| bPositiveZComponent (out bool) | True if the image is a normal map with the z-component mapped to the range 0 .. +1. False if the image is a normal map with the z-component mapped to the range -1 .. +1. |
Returns: Returns true if the bitmap appears to be a normal map. False otherwise.