예제 #1
0
void CSkinUnitODL::Update()
{
	if (m_imgSkin!=nullptr)
	{
		delete m_imgSkin;
		m_imgSkin=nullptr;
	}
	Gdiplus::Bitmap *pImg = CreateImageData(m_nGroutX, m_nGroutY, (INT)m_fSkinWidth, (INT)m_fSkinHeight, m_clGrout, m_strSkinPath);
	m_imgSkin = pImg;
}
예제 #2
0
void CSkinUnitODL::SetSkinPath( StCoverInfo stInfo)
{
	//根据当前参数,生成图片
	if (m_imgSkin!=nullptr)
	{
		delete m_imgSkin;
		m_imgSkin=nullptr;
	}
	m_strSkinPath = stInfo.SkinPath;
	m_clGrout =Gdiplus::ARGB(stInfo.GroutColor);
	m_nGroutX = stInfo.XGrout;
	m_nGroutY = stInfo.YGrout;
	m_fSkinWidth = (float)stInfo.SkinWidth;
	m_fSkinHeight = (float) stInfo.SkinHeight;
	Gdiplus::Bitmap *pImg = CreateImageData(m_nGroutX, m_nGroutY, stInfo.SkinWidth, stInfo.SkinHeight, m_clGrout, m_strSkinPath);
	m_imgSkin = pImg;
}
예제 #3
0
int main(int argc, char *argv[]) {
  vtkSmartPointer<vtkImageData> imageData =
    vtkSmartPointer<vtkImageData>::New();
  if (argc < 2) {
    CreateImageData(imageData);
  } else {
    vtkSmartPointer<vtkXMLImageDataReader> reader =
      vtkSmartPointer<vtkXMLImageDataReader>::New();
    reader->SetFileName(argv[1]);
    reader->Update();
    imageData->ShallowCopy(reader->GetOutput());
  }

  vtkSmartPointer<vtkRenderWindow> renWin =
    vtkSmartPointer<vtkRenderWindow>::New();
  vtkSmartPointer<vtkRenderer> ren1 =
    vtkSmartPointer<vtkRenderer>::New();
  ren1->SetBackground(0.1, 0.4, 0.2);

  renWin->AddRenderer(ren1);

  renWin->SetSize(301, 300); // intentional odd and NPOT  width/height

  vtkSmartPointer<vtkRenderWindowInteractor> iren =
    vtkSmartPointer<vtkRenderWindowInteractor>::New();
  iren->SetRenderWindow(renWin);

  renWin->Render(); // make sure we have an OpenGL context.

  vtkSmartPointer<vtkSmartVolumeMapper> volumeMapper =
    vtkSmartPointer<vtkSmartVolumeMapper>::New();
  volumeMapper->SetBlendModeToComposite(); // composite first
#if VTK_MAJOR_VERSION <= 5
  volumeMapper->SetInputConnection(imageData->GetProducerPort());
#else
  volumeMapper->SetInputData(imageData);
#endif
  vtkSmartPointer<vtkVolumeProperty> volumeProperty =
    vtkSmartPointer<vtkVolumeProperty>::New();
  volumeProperty->ShadeOff();
  volumeProperty->SetInterpolationType(VTK_LINEAR_INTERPOLATION);

  vtkSmartPointer<vtkPiecewiseFunction> compositeOpacity =
    vtkSmartPointer<vtkPiecewiseFunction>::New();
  compositeOpacity->AddPoint(0.0, 0.0);
  compositeOpacity->AddPoint(80.0, 1.0);
  compositeOpacity->AddPoint(80.1, 0.0);
  compositeOpacity->AddPoint(255.0, 0.0);
  volumeProperty->SetScalarOpacity(compositeOpacity); // composite first.

  vtkSmartPointer<vtkColorTransferFunction> color =
    vtkSmartPointer<vtkColorTransferFunction>::New();
  color->AddRGBPoint(0.0  , 0.0, 0.0, 1.0);
  color->AddRGBPoint(40.0  , 1.0, 0.0, 0.0);
  color->AddRGBPoint(255.0, 1.0, 1.0, 1.0);
  volumeProperty->SetColor(color);

  vtkSmartPointer<vtkVolume> volume =
    vtkSmartPointer<vtkVolume>::New();
  volume->SetMapper(volumeMapper);
  volume->SetProperty(volumeProperty);
  ren1->AddViewProp(volume);
  ren1->ResetCamera();

  // Render composite. In default mode. For coverage.
  renWin->Render();

  // 3D texture mode. For coverage.
#if !defined(VTK_LEGACY_REMOVE) && !defined(VTK_OPENGL2)
  volumeMapper->SetRequestedRenderModeToRayCastAndTexture();
#endif // VTK_LEGACY_REMOVE
  renWin->Render();

  // Software mode, for coverage. It also makes sure we will get the same
  // regression image on all platforms.
  volumeMapper->SetRequestedRenderModeToRayCast();
  renWin->Render();

  iren->Start();

  return EXIT_SUCCESS;
}