| 102 | } |
| 103 | |
| 104 | void ColorTexture::construct( const IECoreImage::ImagePrimitive *image, bool mipMap ) |
| 105 | { |
| 106 | static const char *redNames[] = { "r", "R", "red", nullptr }; |
| 107 | static const char *greenNames[] = { "g", "G", "green", nullptr }; |
| 108 | static const char *blueNames[] = { "b", "B", "blue", nullptr }; |
| 109 | static const char *alphaNames[] = { "a", "A", "alpha", nullptr }; |
| 110 | |
| 111 | const IECore::Data *r = findChannel( image->channels, redNames ); |
| 112 | const IECore::Data *g = findChannel( image->channels, greenNames ); |
| 113 | const IECore::Data *b = findChannel( image->channels, blueNames ); |
| 114 | const IECore::Data *a = findChannel( image->channels, alphaNames ); |
| 115 | |
| 116 | if( !(r && g && b) ) |
| 117 | { |
| 118 | throw IECore::Exception( "Unsupported color format." ); |
| 119 | } |
| 120 | |
| 121 | int width = image->getDataWindow().size().x + 1; |
| 122 | int height = image->getDataWindow().size().y + 1; |
| 123 | construct( width, height, r, g, b, a, mipMap ); |
| 124 | } |
| 125 | |
| 126 | void ColorTexture::construct( unsigned int width, unsigned int height, const IECore::Data *r, |
| 127 | const IECore::Data *g, const IECore::Data *b, const IECore::Data *a, bool mipMap ) |