MCPcopy Create free account
hub / github.com/ImageEngine/cortex / construct

Method construct

src/IECoreGL/ColorTexture.cpp:104–124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102}
103
104void 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
126void 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 )

Callers

nothing calls this directly

Calls 6

findChannelFunction · 0.85
typeIdMethod · 0.80
typeNameMethod · 0.80
constructFunction · 0.50
strFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected