[Hdrflow-svn] SF.net SVN: hdrflow: [294] trunk/lib/openlibraries/src/openimagelib/il/ utility.cpp
Status: Pre-Alpha
Brought to you by:
glslang
|
From: <gl...@us...> - 2007-09-02 15:39:07
|
Revision: 294
http://hdrflow.svn.sourceforge.net/hdrflow/?rev=294&view=rev
Author: glslang
Date: 2007-09-02 08:23:18 -0700 (Sun, 02 Sep 2007)
Log Message:
-----------
+ conversion from r32g32b32f to r32g32b32a32f (needs generalisation)
Modified Paths:
--------------
trunk/lib/openlibraries/src/openimagelib/il/utility.cpp
Modified: trunk/lib/openlibraries/src/openimagelib/il/utility.cpp
===================================================================
--- trunk/lib/openlibraries/src/openimagelib/il/utility.cpp 2007-09-01 21:50:34 UTC (rev 293)
+++ trunk/lib/openlibraries/src/openimagelib/il/utility.cpp 2007-09-02 15:23:18 UTC (rev 294)
@@ -1640,6 +1640,43 @@
return dst_img;
}
+static image_type_ptr r32g32b32f_to_r32g32b32a32f( image_type_ptr src_img, const std::wstring &format )
+{
+ size_type width = src_img->width( );
+ size_type height = src_img->height( );
+
+ image_type_ptr dst_img = allocate( src_img, format );
+ if( dst_img != 0 )
+ {
+ const float* src = ( const float* ) src_img->data( );
+ size_type src_pitch = src_img->pitch( );
+ float* dst = ( float* ) dst_img->data( );
+ size_type dst_pitch = dst_img->pitch( );
+
+ const float* sptr = src;
+ float* dptr = dst;
+
+ size_type orig_width = width;
+
+ while( height-- )
+ {
+ while( width-- )
+ {
+ *dst++ = *src++;
+ *dst++ = *src++;
+ *dst++ = *src++;
+ *dst++ = 1.0f;
+ }
+
+ dst = dptr += dst_pitch;
+ src = sptr += src_pitch;
+ width = orig_width;
+ }
+ }
+
+ return dst_img;
+}
+
inline bool is_rgb_packed( const std::wstring &pf )
{
return pf == L"a8b8g8r8" || pf == L"a8r8g8b8" || pf == L"b8g8r8" || pf == L"b8g8r8a8" || pf == L"r8g8b8" || pf == L"r8g8b8a8";
@@ -1917,6 +1954,8 @@
return r32g32b32f_to_b8g8r8a8( src, L"b8g8r8a8" );
else if( dst_pf == L"rgbe" )
return r32g32b32f_to_rgbe( src, L"rgbe" );
+ else if( dst_pf == L"r32g32b32a32f" )
+ return r32g32b32f_to_r32g32b32a32f( src, L"r32g32b32a32f" );
}
else if( src_pf == L"rgbe" )
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|