| 330 | }; |
| 331 | |
| 332 | PackedImageDesc::PackedImageDesc(void * data, |
| 333 | long width, long height, |
| 334 | long numChannels) |
| 335 | : ImageDesc() |
| 336 | , m_impl(new PackedImageDesc::Impl) |
| 337 | { |
| 338 | getImpl()->m_data = data; |
| 339 | getImpl()->m_width = width; |
| 340 | getImpl()->m_height = height; |
| 341 | getImpl()->m_numChannels = numChannels; |
| 342 | getImpl()->m_bitDepth = BIT_DEPTH_F32; |
| 343 | |
| 344 | if(numChannels==4) |
| 345 | { |
| 346 | getImpl()->m_chanOrder = CHANNEL_ORDERING_RGBA; |
| 347 | } |
| 348 | else if(numChannels==3) |
| 349 | { |
| 350 | getImpl()->m_chanOrder = CHANNEL_ORDERING_RGB; |
| 351 | } |
| 352 | else |
| 353 | { |
| 354 | throw Exception("PackedImageDesc Error: Invalid number of channels."); |
| 355 | } |
| 356 | |
| 357 | constexpr unsigned oneChannelInBytes = sizeof(BitDepthInfo<BIT_DEPTH_F32>::Type); |
| 358 | |
| 359 | getImpl()->m_chanStrideBytes = oneChannelInBytes; |
| 360 | getImpl()->m_xStrideBytes = getImpl()->m_chanStrideBytes * getImpl()->m_numChannels; |
| 361 | getImpl()->m_yStrideBytes = getImpl()->m_xStrideBytes* width; |
| 362 | |
| 363 | getImpl()->initValues(); |
| 364 | |
| 365 | getImpl()->m_isRGBAPacked = getImpl()->isRGBAPacked(); |
| 366 | getImpl()->m_isFloat = getImpl()->isFloat(); |
| 367 | |
| 368 | getImpl()->validate(); |
| 369 | } |
| 370 | |
| 371 | PackedImageDesc::PackedImageDesc(void * data, |
| 372 | long width, long height, |