@@ -246,7 +246,8 @@ class ContainerImpl
246246 Container::ScanConverterError HardInitScanConverter ( int depth,
247247 int widthScan, int heightScan, int steering, int depthCfm )
248248 {
249-
249+ this ->widthScan = widthScan;
250+ this ->heightScan = heightScan;
250251 return static_cast < Container::ScanConverterError >(
251252 WrappedScanConverter->HardInitScanConverter ( depth, widthScan,
252253 heightScan, steering, depthCfm, WrappedCapture.get (),
@@ -337,8 +338,6 @@ class ContainerImpl
337338 ContainerImpl::ArrayType^ bmode_bytedata_array =
338339 gcnew ArrayType ( Container::NBOFLINES, Container::MAX_SAMPLES );
339340
340- int IMAGE_SIZE = 512 ; // This should be a parameter, however I am working on setting Image Scaling first
341-
342341 for ( int ii = 0 ; ii < Container::NBOFLINES; ++ii )
343342 {
344343 for ( int jj = 0 ; jj < Container::MAX_SAMPLES; ++jj )
@@ -349,18 +348,18 @@ class ContainerImpl
349348 }
350349
351350 System::Drawing::Bitmap^ image =
352- gcnew System::Drawing::Bitmap (IMAGE_SIZE, IMAGE_SIZE , System::Drawing::Imaging::PixelFormat::Format8bppIndexed);
351+ gcnew System::Drawing::Bitmap (widthScan, heightScan , System::Drawing::Imaging::PixelFormat::Format8bppIndexed);
353352 WrappedImageBuilding->Build2D (image, bmode_bytedata_array, bmode_bytedata_array, WrappedScanConverter.get ());
354- System::Drawing::Imaging::BitmapData^ bmpData = image->LockBits (System::Drawing::Rectangle (0 , 0 , IMAGE_SIZE, IMAGE_SIZE ),
353+ System::Drawing::Imaging::BitmapData^ bmpData = image->LockBits (System::Drawing::Rectangle (0 , 0 , widthScan, heightScan ),
355354 System::Drawing::Imaging::ImageLockMode::ReadOnly,
356355 System::Drawing::Imaging::PixelFormat::Format8bppIndexed);
357356
358- char * row = ( char *) reinterpret_cast <char *>(bmpData->Scan0 .ToPointer ());
359- for ( int ii = 0 ; ii < IMAGE_SIZE ; ++ii )
357+ char * row = reinterpret_cast <char *>(bmpData->Scan0 .ToPointer ());
358+ for ( int ii = 0 ; ii < widthScan ; ++ii )
360359 {
361- for ( int jj = 0 ; jj < IMAGE_SIZE ; ++jj )
360+ for ( int jj = 0 ; jj < heightScan ; ++jj )
362361 {
363- image_out[IMAGE_SIZE * ii + jj ] = row[jj];
362+ image_out[widthScan * jj + ii ] = row[jj];
364363 }
365364 row += bmpData->Stride ;
366365 }
@@ -372,6 +371,7 @@ class ContainerImpl
372371 //
373372
374373private:
374+ int widthScan, heightScan;
375375 IntersonArrayCxx::Controls::HWControls * hwControls;
376376 msclr::auto_gcroot< IntersonArray::Imaging::ScanConverter ^ >
377377 WrappedScanConverter;
0 commit comments