From: rraphael Date: Thu, 10 Dec 2020 16:34:20 +0000 (+0100) Subject: import image: add documentation and improve image rendering X-Git-Tag: V9_7_0a1~13^2~19 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=07d047f7486b88771a1f82d022e937c36dfe43ba;p=modules%2Fshaper.git import image: add documentation and improve image rendering --- diff --git a/src/ExchangePlugin/doc/images/imageImported.png b/src/ExchangePlugin/doc/images/imageImported.png new file mode 100644 index 000000000..a32892e08 Binary files /dev/null and b/src/ExchangePlugin/doc/images/imageImported.png differ diff --git a/src/ExchangePlugin/doc/importFeature.rst b/src/ExchangePlugin/doc/importFeature.rst index 64251ddb2..c939ae31d 100644 --- a/src/ExchangePlugin/doc/importFeature.rst +++ b/src/ExchangePlugin/doc/importFeature.rst @@ -57,7 +57,7 @@ The import will be performed within the active part. If no part is active, the p Import from CAD formats ----------------------- -It is possible to import files in the following CAD-neutral formats: BREP, STEP, IGES, XAO. +It is possible to import files in the following CAD-neutral formats: BREP, STEP, IGES, XAO, STL. To import a file into active part select in the Main Menu *File -> Import -> From CAD format...* item. The following property panel will be opened: @@ -103,6 +103,20 @@ The Result of the operation depends on the imported file content. Import of BREP file. +Import pictures +----------------------- + +It is possible to import pictures in the following image formats: GIF, TIFF, PNG, JPG, JPEG, BMP, PPM, JPE. +To import a file into active part select in the Main Menu *File -> Import -> Picture...* item. + +Result +"""""" + +.. figure:: images/imageImported.png + :align: center + + Import of PNG image file. + **See Also** a sample TUI Script of :ref:`tui_import_file` operation. diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index 64b63156b..d867bf881 100644 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -1455,25 +1455,27 @@ void PartSet_Module::customizePresentation(const ObjectPtr& theObject, Handle(AIS_InteractiveObject) anAIS = thePrs->impl(); if (!anAIS.IsNull()) { - std::vector aColor = {167, 167, 167 }; - thePrs->setColor(aColor[0], aColor[1], aColor[2]); - Quantity_Color myShadingColor(NCollection_Vec3(aColor[0]/255., aColor[1]/255., aColor[2]/255.)); - + /// set color to white and change material aspect, + /// in order to keep a natural apect of the image. + thePrs->setColor(255, 255, 255); + Quantity_Color myShadingColor(NCollection_Vec3(1., 1., 1.)); Handle(AIS_Shape) anAISShape = Handle(AIS_Shape)::DownCast(anAIS); if (!anAISShape.IsNull()) { - auto myDrawer = new Prs3d_ShadingAspect(); - if (!anAISShape->Attributes()->HasOwnShadingAspect()) - { - anAISShape->Attributes()->SetShadingAspect (myDrawer); - } + auto myDrawer = anAISShape->Attributes(); - myDrawer->SetColor(myShadingColor); + myDrawer->ShadingAspect()->SetColor(myShadingColor); + myDrawer->ShadingAspect()->Aspect()->SetDistinguishOn(); + Graphic3d_MaterialAspect aMatAspect(Graphic3d_NOM_PLASTIC); + aMatAspect.SetTransparency(0.0); + myDrawer->ShadingAspect()->Aspect()->SetFrontMaterial(aMatAspect); + myDrawer->ShadingAspect()->Aspect()->SetBackMaterial(aMatAspect); Handle(Image_PixMap) aPixmap; QPixmap px(aResult->getTextureFile().c_str()); + if (!px.isNull() ) - aPixmap = OCCViewer_Utilities::imageToPixmap( px.toImage() ); + aPixmap = OCCViewer_Utilities::imageToPixmap( px.toImage()); anAISShape->Attributes()->ShadingAspect()->Aspect()->SetTextureMap (new Graphic3d_Texture2Dmanual(aPixmap));