1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-21 10:13:43 +03:00

0027921: Visualization - add missing Graphic3d_AspectText3d method defining label transparency

This commit is contained in:
kgv 2017-04-18 21:34:28 +03:00 committed by bugmaster
parent d51a0ff64a
commit 85719f0ef9
3 changed files with 25 additions and 6 deletions

View File

@ -30,7 +30,6 @@
#include <V3d_Viewer.hxx> #include <V3d_Viewer.hxx>
IMPLEMENT_STANDARD_RTTIEXT(AIS_TextLabel,AIS_InteractiveObject) IMPLEMENT_STANDARD_RTTIEXT(AIS_TextLabel,AIS_InteractiveObject)
//======================================================================= //=======================================================================
@ -61,12 +60,20 @@ void AIS_TextLabel::SetColor (const Quantity_Color& theColor)
} }
//======================================================================= //=======================================================================
//function : SetColor //function : SetTransparency
//purpose : //purpose :
//======================================================================= //=======================================================================
void AIS_TextLabel::SetColor (const Quantity_NameOfColor theColor) void AIS_TextLabel::SetTransparency (const Standard_Real theValue)
{ {
SetColor (Quantity_Color (theColor)); Quantity_ColorRGBA aTextColor (myDrawer->TextAspect()->Aspect()->Color());
aTextColor.SetAlpha (Standard_ShortReal(1.0 - theValue));
Quantity_ColorRGBA aSubColor (myDrawer->TextAspect()->Aspect()->ColorSubTitle());
aSubColor.SetAlpha (aTextColor.Alpha());
myDrawer->TextAspect()->Aspect()->SetColor (aTextColor);
myDrawer->TextAspect()->Aspect()->SetColorSubTitle (aSubColor);
myDrawer->SetTransparency (Standard_ShortReal(theValue));
} }
//======================================================================= //=======================================================================
@ -233,7 +240,6 @@ void AIS_TextLabel::SetColorSubTitle (const Quantity_Color& theColor)
myDrawer->TextAspect()->Aspect()->SetColorSubTitle(theColor); myDrawer->TextAspect()->Aspect()->SetColorSubTitle(theColor);
} }
#include <Graphic3d_ArrayOfPoints.hxx>
//======================================================================= //=======================================================================
//function : Compute //function : Compute
//purpose : //purpose :

View File

@ -36,7 +36,13 @@ public:
Standard_EXPORT virtual void SetColor (const Quantity_Color& theColor) Standard_OVERRIDE; Standard_EXPORT virtual void SetColor (const Quantity_Color& theColor) Standard_OVERRIDE;
//! Setup color of entire text. //! Setup color of entire text.
Standard_EXPORT virtual void SetColor (const Quantity_NameOfColor theColor) Standard_OVERRIDE; virtual void SetColor (const Quantity_NameOfColor theColor) Standard_OVERRIDE { SetColor (Quantity_Color (theColor)); }
//! Setup transparency within [0, 1] range.
Standard_EXPORT virtual void SetTransparency (const Standard_Real theValue) Standard_OVERRIDE;
//! Removes the transparency setting.
virtual void UnsetTransparency() Standard_OVERRIDE { SetTransparency (0.0); }
//! Material has no effect for text label. //! Material has no effect for text label.
virtual void SetMaterial (const Graphic3d_NameOfMaterial ) Standard_OVERRIDE {} virtual void SetMaterial (const Graphic3d_NameOfMaterial ) Standard_OVERRIDE {}

View File

@ -77,6 +77,9 @@ public:
//! Modifies the color. //! Modifies the color.
void SetColor (const Quantity_Color& theColor) { myColor.SetRGB (theColor); } void SetColor (const Quantity_Color& theColor) { myColor.SetRGB (theColor); }
//! Modifies the color.
void SetColor (const Quantity_ColorRGBA& theColor) { myColor = theColor; }
//! Modifies the expansion factor (height/width ratio) //! Modifies the expansion factor (height/width ratio)
//! If the factor is less than 1, the characters will //! If the factor is less than 1, the characters will
//! be higher than they are wide. //! be higher than they are wide.
@ -144,6 +147,10 @@ public:
//! and the color of background for the TODT_DEKALE TextDisplayType. //! and the color of background for the TODT_DEKALE TextDisplayType.
void SetColorSubTitle (const Quantity_Color& theColor) { myColorSubTitle.SetRGB (theColor); } void SetColorSubTitle (const Quantity_Color& theColor) { myColorSubTitle.SetRGB (theColor); }
//! Modifies the color of the subtitle for the TODT_SUBTITLE TextDisplayType
//! and the color of background for the TODT_DEKALE TextDisplayType.
void SetColorSubTitle (const Quantity_ColorRGBA& theColor) { myColorSubTitle = theColor; }
//! Returns TRUE when the Text Zoomable is on. //! Returns TRUE when the Text Zoomable is on.
bool GetTextZoomable() const { return myTextZoomable; } bool GetTextZoomable() const { return myTextZoomable; }