1
0
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:
kgv
2014-09-29 22:22:18 +03:00
committed by bugmaster
parent 9c0b61f308
commit 8316c618a4
3 changed files with 125 additions and 18 deletions

View File

@@ -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

View File

@@ -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