#include <V3d_Viewer.hxx>
-
IMPLEMENT_STANDARD_RTTIEXT(AIS_TextLabel,AIS_InteractiveObject)
//=======================================================================
}
//=======================================================================
-//function : SetColor
+//function : SetTransparency
//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));
}
//=======================================================================
myDrawer->TextAspect()->Aspect()->SetColorSubTitle(theColor);
}
-#include <Graphic3d_ArrayOfPoints.hxx>
//=======================================================================
//function : Compute
//purpose :
Standard_EXPORT virtual void SetColor (const Quantity_Color& theColor) Standard_OVERRIDE;
//! 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.
virtual void SetMaterial (const Graphic3d_NameOfMaterial ) Standard_OVERRIDE {}
//! Modifies the color.
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)
//! If the factor is less than 1, the characters will
//! be higher than they are wide.
//! and the color of background for the TODT_DEKALE TextDisplayType.
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.
bool GetTextZoomable() const { return myTextZoomable; }