mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-03 14:10:33 +03:00
0025289: Draw Harness, ViewerTest - support RGB color definition as input for vsetcolor and vaspects commands
This commit is contained in:
@@ -279,6 +279,15 @@ is
|
||||
-- Standard_OutOfRange if AName in not known
|
||||
-- in the Quantity_NameOfColor enumeration.
|
||||
|
||||
ColorFromName ( myclass;
|
||||
theName : CString from Standard;
|
||||
theColor : out NameOfColor from Quantity )
|
||||
returns Boolean from Standard;
|
||||
---Purpose: Finds color from predefined names.
|
||||
-- For example, the name of the color which
|
||||
-- corresponds to "BLACK" is Quantity_NOC_BLACK.
|
||||
-- Returns false if name is unknown.
|
||||
|
||||
HlsRgb ( myclass;
|
||||
H, L, S : Parameter from Quantity;
|
||||
R , G , B : out Parameter from Quantity ) ;
|
||||
@@ -339,7 +348,7 @@ is
|
||||
---Purpose: Internal test
|
||||
---Category: Private methods
|
||||
|
||||
--
|
||||
--
|
||||
|
||||
fields
|
||||
|
||||
|
@@ -37,6 +37,7 @@
|
||||
#include <Quantity_Color.ixx>
|
||||
#include <Quantity_Color_1.hxx>
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
// for Test method (suite et fin)
|
||||
#include <string.h>
|
||||
@@ -59,6 +60,28 @@ void call_rgbhls(float r, float g, float b, float& h, float& l, float& s);
|
||||
|
||||
//-Methods, in order
|
||||
|
||||
Standard_Boolean Quantity_Color::ColorFromName (const Standard_CString theName,
|
||||
Quantity_NameOfColor& theColor)
|
||||
{
|
||||
TCollection_AsciiString aName (theName);
|
||||
aName.UpperCase();
|
||||
if (aName.Search("QUANTITY_NOC_") == 1)
|
||||
{
|
||||
aName = aName.SubString (14, aName.Length());
|
||||
}
|
||||
|
||||
for (Standard_Integer anIter = Quantity_NOC_BLACK; anIter <= Quantity_NOC_WHITE; ++anIter)
|
||||
{
|
||||
Standard_CString aColorName = Quantity_Color::StringName (Quantity_NameOfColor (anIter));
|
||||
if (aName == aColorName)
|
||||
{
|
||||
theColor = (Quantity_NameOfColor )anIter;
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
Quantity_Color::Quantity_Color () {
|
||||
|
||||
Quantity_Color::ValuesOf
|
||||
|
Reference in New Issue
Block a user