当前位置: 首页>>代码示例>>C++>>正文


C++ ImageWindow类代码示例

本文整理汇总了C++中ImageWindow的典型用法代码示例。如果您正苦于以下问题:C++ ImageWindow类的具体用法?C++ ImageWindow怎么用?C++ ImageWindow使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ImageWindow类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    ImageWindow w;
    w.show();
    return a.exec();
}
开发者ID:egjimenezg,项目名称:ImageAnalysis,代码行数:7,代码来源:main.cpp

示例2: __SetToActiveImage_Click

void NewImageInterface::__SetToActiveImage_Click( Button& /*sender*/, bool /*checked*/ )
{
   ImageWindow w = ImageWindow::ActiveWindow();

   if ( !w.IsNull() )
   {
      ImageVariant v = w.MainView().Image();
      AbstractImage* img = v.AnyImage();

      if ( img != 0 )
      {
         if ( v.IsFloatSample() )
            switch ( v.BitsPerSample() )
            {
            case 32: instance.sampleFormat = NewImageSampleFormat::F32; break;
            case 64: instance.sampleFormat = NewImageSampleFormat::F64; break;
            }
         else
            switch ( v.BitsPerSample() )
            {
            case  8: instance.sampleFormat = NewImageSampleFormat::I8; break;
            case 16: instance.sampleFormat = NewImageSampleFormat::I16; break;
            case 32: instance.sampleFormat = NewImageSampleFormat::I32; break;
            }

         instance.colorSpace = img->IsColor() ? NewImageColorSpace::RGB : NewImageColorSpace::Gray;
         instance.width = img->Width();
         instance.height = img->Height();
         instance.numberOfChannels = img->NumberOfChannels();

         UpdateControls();
      }
   }
}
开发者ID:morserover,项目名称:PCL,代码行数:34,代码来源:NewImageInterface.cpp

示例3: Console

bool CropInstance::ExecuteOn( View& view )
{
   if ( !view.IsMainView() )
      return false;  // should not happen!

   if ( p_margins == 0.0 )
   {
      Console().WriteLn( "<end><cbr>&lt;* Identity *&gt;" );
      return true;
   }

   AutoViewLock lock( view );

   ImageWindow window = view.Window();
   ImageVariant image = view.Image();

   Crop C( p_margins );
   C.SetMode( static_cast<Crop::crop_mode>( p_mode ) );
   C.SetResolution( p_resolution.x, p_resolution.y );
   C.SetMetricResolution( p_metric );
   C.SetFillValues( p_fillColor );

   // Dimensions of target image
   int w0 = image.Width();
   int h0 = image.Height();

   // Dimensions of transformed image
   int width = w0, height = h0;
   C.GetNewSizes( width, height );

   if ( width < 1 || height < 1 )
      throw Error( "Crop: Invalid operation: Null target image dimensions" );

   // On 32-bit systems, make sure the resulting image requires less than 4 GB.
   if ( sizeof( void* ) == sizeof( uint32 ) )
   {
      uint64 sz = uint64( width )*uint64( height )*image.NumberOfChannels()*image.BytesPerSample();
      if ( sz > uint64( uint32_max-256 ) )
         throw Error( "Crop: Invalid operation: Target image dimensions would exceed four gigabytes" );
   }

   DeleteAstrometryMetadataAndPreviewsAndMask( window );

   Console().EnableAbort();

   StandardStatus status;
   image.SetStatusCallback( &status );

   C >> image;

   if ( p_forceResolution )
   {
      Console().WriteLn( String().Format( "Setting resolution: h:%.3lf, v:%.3lf, u:px/%s",
                                          p_resolution.x, p_resolution.y, p_metric ? "cm" : "inch" ) );
      window.SetResolution( p_resolution.x, p_resolution.y, p_metric );
   }

   return true;
}
开发者ID:AndresPozo,项目名称:PCL,代码行数:59,代码来源:CropInstance.cpp

示例4: mb

void AnnotationInterface::Execute()
{
   // can't execute if annotation is not placed in a valid view
   if (view == 0 || !annotationPlaced)
   {
      MessageBox mb("Can't execute. Use left mouse button to place annotation on the image first.",
         "Not executed",
         StdIcon::Information);
      mb.Execute();
      return;
   }

   // check mask. if enabled, offer user to temporarily disable it
   bool disableMask = false;
   if ( view->Window().IsMaskEnabled() && !view->Window().Mask().IsNull() )
   {
      MessageBox mb("The view has a mask enabled. Mask will probably interfere with the annotation rendering.<br/>"
         "Do you want to temporarily disable the mask?",
         "Mask Enabled",
         StdIcon::Question,
         StdButton::Yes, StdButton::No, StdButton::Cancel, 0, 2);
      MessageBox::std_button result = mb.Execute();
      if (result == StdButton::Cancel) return;
      disableMask = result == StdButton::Yes;
   }

   // Obtain local working references to the target view and window.
   View v = *view;
   ImageWindow w = v.Window();

   // Reset reference to the target view in the dynamic interface. This
   // prevents inconsistent behavior during execution.
   delete view, view = 0;
   ClearBitmaps();

   // Since active dynamic targets cannot be modified, we have to remove our
   // target view from the dynamic targets set before attempting to process.
   v.RemoveFromDynamicTargets();

   // Ensure that our target view is selected as the current view.
   w.BringToFront();
   w.SelectView( v );

   // Disable mask if required
   if ( disableMask )
      w.EnableMask( false );

   // Execute the instance on the target window.
   instance.LaunchOn( w );

   // Re-enable mask if required
   if ( disableMask )
      w.EnableMask( true );

   // keep parameters but reset state
   annotationPlaced = false;
   leaderPlaced = false;
}
开发者ID:aleixpuig,项目名称:PCL,代码行数:58,代码来源:AnnotationInterface.cpp

示例5: UpdateView

void AnnotationInterface::UpdateView()
{
   // update current invalidate rect of the view
   if ( view != 0 && annotationPlaced )
   {
      annotationBmp = Bitmap::Null();
      ImageWindow w = view->Window();
      w.UpdateImageRect( invalidateRect );
   }
}
开发者ID:aleixpuig,项目名称:PCL,代码行数:10,代码来源:AnnotationInterface.cpp

示例6: DynamicMouseMove

void AnnotationInterface::DynamicMouseMove( View& v, const DPoint& p, unsigned buttons, unsigned modifiers )
{
   // mouse move is processed only on active view
   if (view == 0 || v != *view)
      return;

   // get view image window
   ImageWindow w = view->Window();

   // and image coordinates of the mouse position
   int imageX = RoundI(p.x);
   int imageY = RoundI(p.y);

   // set cursor to dragging cursor if mouse is inside one of the grip rectangles
   if (annotationPlaced && textRect.Includes(imageX, imageY))
      w.SetDynamicCursor(move_all_XPM, 10, 10);
   else if (leaderPlaced && instance.annotationShowLeader && leaderRect.Includes(imageX, imageY))
      w.SetDynamicCursor(move_all_XPM, 10, 10);
   else // otherwise, reset cursor
      w.ResetDynamicCursor();

   // if we are currently dragging something
   if ( dragging != DraggingType::None )
   {
      // compute delta
      int deltaX = imageX-lastX;
      int deltaY = imageY-lastY;

      // update text position if needed
      if (dragging == DraggingType::Text || dragging == DraggingType::Both)
      {
         instance.annotationPositionX += deltaX;
         instance.annotationPositionY += deltaY;
      }

      // update leader endpoint position if needed
      if (dragging == DraggingType::Leader || dragging == DraggingType::Both)
      {
         instance.annotationLeaderPositionX += deltaX;
         instance.annotationLeaderPositionY += deltaY;
      }

      // update annotation rectangle
      UpdateAnnotationRect();

      // redraw dynamic view
      UpdateView();

      // remember current point
      lastX = imageX;
      lastY = imageY;
   }
}
开发者ID:aleixpuig,项目名称:PCL,代码行数:53,代码来源:AnnotationInterface.cpp

示例7: initImlib

void KuickShow::slotConfigApplied()
{
    dialog->applyConfig();

    initImlib();
    kdata->save();

    ImageWindow *viewer;
    QValueListIterator<ImageWindow*> it = s_viewers.begin();
    while ( it != s_viewers.end() ) {
        viewer = *it;
        viewer->updateActions();
        ++it;
    }

    fileWidget->reloadConfiguration();
}
开发者ID:serghei,项目名称:kde3-kdegraphics,代码行数:17,代码来源:kuickshow.cpp

示例8: FindPreviews

static void FindPreviews( StringList& items, const ImageWindow& w, const String& previewId )
{
   if ( previewId.HasWildcards() )
   {
      Array<View> P = w.Previews();
      for ( size_type i = 0; i < P.Length(); ++i )
         if ( String( P[i].Id() ).WildMatch( previewId ) )
            AddView( items, P[i] );
   }
   else
   {
      View p = w.PreviewById( IsoString( previewId ) );
      if ( p.IsNull() )
         throw ParseError( "Preview not found", previewId );
      AddView( items, p );
   }
}
开发者ID:SunGong1993,项目名称:PCL,代码行数:17,代码来源:Arguments.cpp

示例9: BApplication

InspectorApp::InspectorApp()
	: BApplication(APP_SIG)
{
	fpActivesWin = NULL;
	fpInfoWin = NULL;
	
	be_locale->GetAppCatalog(&fAppCatalog);
	
	AddToTranslatorsList("/system/add-ons/Translators",
		SYSTEM_TRANSLATOR);
	AddToTranslatorsList("/boot/home/config/add-ons/Translators",
		USER_TRANSLATOR);
	
	// Show application window
	BRect rect(100, 100, 500, 400);
	ImageWindow *pwin = new ImageWindow(rect, IMAGEWINDOW_TITLE);
	pwin->Show();
}
开发者ID:mariuz,项目名称:haiku,代码行数:18,代码来源:InspectorApp.cpp

示例10: DynamicPaint

void AnnotationInterface::DynamicPaint( const View& v, VectorGraphics& g, const DRect& r ) const
{
   // we need valid view and annotation must be placed
   if ( view == 0 || v != *view || !annotationPlaced )
      return;

   // are we painting to rect with annotation?
   if ( !totalRect.Intersects( r ) )
      return;

   // get the image window
   ImageWindow w = view->Window();

   // render annotation to bitmap if needed
   if ( annotationBmp.IsNull() )
   {
      relPosX = 0;
      relPosY = 0;
      annotationBmp = AnnotationRenderer::CreateAnnotationBitmap( instance, relPosX, relPosY, true );
      screenBmp = Bitmap::Null();
   }

   // compute viewport coordinates of annotation text
   int posX = instance.annotationPositionX - relPosX;
   int posY = instance.annotationPositionY - relPosY;
   w.ImageToViewport( posX, posY );

   // compute zoom factor
   int zoomFactor = w.ZoomFactor();
   double z = (zoomFactor < 0) ? -1.0/zoomFactor : double( zoomFactor );

   // draw bitmap, scaled according to zoom factor
   Rect zr( RoundI( annotationBmp.Width()*z ), RoundI( annotationBmp.Height()*z ) );
   if ( screenBmp.IsNull() || zr != screenBmp.Bounds() )
      if ( zoomFactor < 0 )
         screenBmp = annotationBmp.Scaled( z );
      else
         screenBmp = annotationBmp;

   if ( zoomFactor < 0 )
      g.DrawBitmap( posX, posY, screenBmp );
   else
      g.DrawScaledBitmap( zr.MovedTo( posX, posY ), screenBmp );
}
开发者ID:aleixpuig,项目名称:PCL,代码行数:44,代码来源:AnnotationInterface.cpp

示例11: it

// prints the selected files in the filebrowser
void KuickShow::slotPrint()
{
    const KFileItemList *items = fileWidget->selectedItems();
    if ( !items )
        return;

    KFileItemListIterator it( *items );

    // don't show the image, just print
    ImageWindow *iw = new ImageWindow( 0, id, this, "printing image" );
    KFileItem *item;
    while ( (item = it.current()) ) {
        if (FileWidget::isImage( item ) && iw->loadImage( item->url() ))
            iw->printImage();
        ++it;
    }

    iw->close( true );
}
开发者ID:serghei,项目名称:kde3-kdegraphics,代码行数:20,代码来源:kuickshow.cpp

示例12: if

void FilteringService::applyAlgorithm(Filtering* algo)
{
    //StandardImageWindow* siw = dynamic_cast<StandardImageWindow*>(_ws->getCurrentImageWindow());
    if (_siw != NULL)
    {
        const Image_t<double>* image;
        if(_siw->isStandard()) {
            const Image* whole_image = _siw->getDisplayImage();
            const Image* im = whole_image->crop(_siw->selection());
            image = Converter<Image_t<double> >::convert(*im);
            delete im;
        }
        else if(_siw->isDouble()) {
           DoubleImageWindow* diw = dynamic_cast<DoubleImageWindow*>(_siw);
           image = diw->getImage();
        }
        Image_t<double>* dblResImg = (*algo)(image);
        ImageWindow* riw;
        if(_siw->isStandard()) {
            delete image;
        }
        if(_dblResult) {
            DoubleImageWindow* diw = dynamic_cast<DoubleImageWindow*>(_siw);
            if(diw != NULL) {
                riw = new DoubleImageWindow(dblResImg, _siw->getPath(), diw->isNormalized(), diw->isLogScaled());
            }
            else {
                riw = new DoubleImageWindow(dblResImg, _siw->getPath());
            }
        }
        else {
            Image_t<int>* intResImg = Converter<Image_t<int> >::convert(*dblResImg);
            delete dblResImg;
            Image* resImg = Converter<Image>::makeDisplayable(*intResImg);
            delete intResImg;
            riw = new StandardImageWindow(resImg, _siw->getPath());
        }
        riw->setWindowTitle(_siw->windowTitle());
        emit newImageWindowCreated(_ws->getNodeId(_siw), riw);
    }
}
开发者ID:eramox,项目名称:eiimage,代码行数:41,代码来源:FilteringService.cpp

示例13: MainWndProc

LRESULT CALLBACK MainWndProc(
	HWND hwnd,
	UINT uMsg,
	WPARAM wParam,
	LPARAM lParam)
{
	switch (uMsg) 
	{ 
	case WM_CREATE: 
		return 0; 

	case WM_PAINT: 
		{
			LONG_PTR ptr = GetWindowLongPtr( hwnd, GWLP_USERDATA );
			if( ptr )
			{
				ImageWindow* iw = (ImageWindow*)ptr;
				iw->OnPaint();
			}
		}
		
		return 0; 

	case WM_SIZE: 
		// Set the size and position of the window. 
		return 0; 

	case WM_DESTROY: 
		// Clean up window-specific data objects. 
		return 0; 

		// 
		// Process other messages. 
		// 

	default: 
		return DefWindowProc(hwnd, uMsg, wParam, lParam); 
	} 
	//return 0; 
}
开发者ID:CarlKenner,项目名称:LibOVRWrapper,代码行数:40,代码来源:Util_ImageWindow.cpp

示例14: applyFiltering

void FilteringService::applyFiltering()
{
    ImageWindow* siw = dynamic_cast<ImageWindow*>(_ws->getCurrentImageWindow());
    if (siw != NULL)
    {
        _siw = siw;

        _filterChoice = new FilterChoice(_gi);
        _filterChoice->setDoubleResult(siw->isDouble());
//        QMdiArea* area = (QMdiArea*)_gi->centralWidget();
//        area->addSubWindow(_filterChoice);
        QDialog::DialogCode code = static_cast<QDialog::DialogCode>(_filterChoice->exec());

        if(code!=QDialog::Accepted) {
            return;
        }
        _dblResult = _filterChoice->doubleResult();

        Filtering* filtering = _filterChoice->getFiltering();
        this->applyAlgorithm(filtering);

    }
}
开发者ID:eramox,项目名称:eiimage,代码行数:23,代码来源:FilteringService.cpp

示例15: Error

bool AnnotationInterface::ImportProcess( const ProcessImplementation& p )
{
   const AnnotationInstance* i = dynamic_cast<const AnnotationInstance*>( &p );

   if ( i == 0 )
      throw Error( "Not an Annotation instance." );

   if ( view == 0 )
   {
      ImageWindow w = ImageWindow::ActiveWindow();

      if ( w.IsNull() )
      {
         throw Error( "The Annotation interface requires an active image window to import a process instance." );
         return false;
      }

      view = new View( w.MainView() );

      view->AddToDynamicTargets();
   }

   ClearBitmaps();

   instance.Assign( *i );

   annotationPlaced = false;
   leaderPlaced = false;

   if ( view->Window().CurrentView() != *view )
      view->Window().SelectView( *view );

   UpdateControls();

   return true;
}
开发者ID:aleixpuig,项目名称:PCL,代码行数:36,代码来源:AnnotationInterface.cpp


注:本文中的ImageWindow类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。