@@ -28,6 +28,7 @@ limitations under the License.
2828#include < msclr/auto_gcroot.h>
2929
3030#using " IntersonArray.dll"
31+ #using " System.Drawing.dll"
3132
3233#pragma managed
3334
@@ -245,7 +246,8 @@ class ContainerImpl
245246 Container::ScanConverterError HardInitScanConverter ( int depth,
246247 int widthScan, int heightScan, int steering, int depthCfm )
247248 {
248-
249+ this ->widthScan = widthScan;
250+ this ->heightScan = heightScan;
249251 return static_cast < Container::ScanConverterError >(
250252 WrappedScanConverter->HardInitScanConverter ( depth, widthScan,
251253 heightScan, steering, depthCfm, WrappedCapture.get (),
@@ -332,12 +334,44 @@ class ContainerImpl
332334 {
333335 this ->hwControls = controls;
334336 }
337+ void Build2D (Container::PixelType * bmode_bytedata, Container::PixelType * image_out) {
338+ ContainerImpl::ArrayType^ bmode_bytedata_array =
339+ gcnew ArrayType ( Container::NBOFLINES, Container::MAX_SAMPLES );
340+
341+ for ( int ii = 0 ; ii < Container::NBOFLINES; ++ii )
342+ {
343+ for ( int jj = 0 ; jj < Container::MAX_SAMPLES; ++jj )
344+ {
345+ bmode_bytedata_array[ii, jj] =
346+ bmode_bytedata[Container::MAX_SAMPLES * ii + jj];
347+ }
348+ }
335349
336- //
350+ System::Drawing::Bitmap^ image =
351+ gcnew System::Drawing::Bitmap (widthScan, heightScan, System::Drawing::Imaging::PixelFormat::Format8bppIndexed);
352+ WrappedImageBuilding->Build2D (image, bmode_bytedata_array, bmode_bytedata_array, WrappedScanConverter.get ());
353+ System::Drawing::Imaging::BitmapData^ bmpData = image->LockBits (System::Drawing::Rectangle (0 , 0 , widthScan, heightScan),
354+ System::Drawing::Imaging::ImageLockMode::ReadOnly,
355+ System::Drawing::Imaging::PixelFormat::Format8bppIndexed);
356+
357+ char * row = reinterpret_cast <char *>(bmpData->Scan0 .ToPointer ());
358+ for ( int ii = 0 ; ii < widthScan; ++ii )
359+ {
360+ for ( int jj = 0 ; jj < heightScan; ++jj )
361+ {
362+ image_out[widthScan * jj + ii] = row[jj];
363+ }
364+ row += bmpData->Stride ;
365+ }
366+
367+ }
368+
369+ //
337370 // Begin Wrapped ImageBuilding
338371 //
339372
340373private:
374+ int widthScan, heightScan;
341375 IntersonArrayCxx::Controls::HWControls * hwControls;
342376 msclr::auto_gcroot< IntersonArray::Imaging::ScanConverter ^ >
343377 WrappedScanConverter;
@@ -557,6 +591,13 @@ ::SetHWControls(IntersonArrayCxx::Controls::HWControls * controls)
557591 Impl->SetHWControls (controls);
558592}
559593
594+ void
595+ Container
596+ ::Build2D (Container::PixelType * bmode_bytedata, Container::PixelType * image_out)
597+ {
598+ Impl->Build2D (bmode_bytedata, image_out);
599+ }
600+
560601} // end namespace Imaging
561602
562603} // end namespace IntersonArrayCxx
0 commit comments