MCPcopy Create free account
hub / github.com/NatronGitHub/openfx-misc / pixToVector

Function pixToVector

VectorToColor/VectorToColor.cpp:141–181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

139
140template <class PIX, int nComponents>
141static void
142pixToVector(const PIX *p,
143 float v[2],
144 InputChannelEnum xChannel,
145 InputChannelEnum yChannel)
146{
147 assert(nComponents == 3 || nComponents == 4);
148 if (!p) {
149 v[0] = v[1] = 0.f;
150
151 return;
152 }
153 switch (xChannel) {
154 case eInputChannelR:
155 v[0] = p[0];
156 break;
157 case eInputChannelG:
158 v[0] = p[1];
159 break;
160 case eInputChannelB:
161 v[0] = p[2];
162 break;
163 case eInputChannelA:
164 v[0] = (nComponents == 4) ? p[3] : 0.f;
165 break;
166 }
167 switch (yChannel) {
168 case eInputChannelR:
169 v[1] = p[0];
170 break;
171 case eInputChannelG:
172 v[1] = p[1];
173 break;
174 case eInputChannelB:
175 v[1] = p[2];
176 break;
177 case eInputChannelA:
178 v[1] = (nComponents == 4) ? p[3] : 0.f;
179 break;
180 }
181}
182
183template <class PIX, int nComponents, int maxValue>
184class VectorToColorProcessor

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected