RH_C_FUNCTION int ON_3dmObjectAttributes_GetSetColor(ON_3dmObjectAttributes* ptr, int which, bool set, int set_value)
{
  const int idxColor = 0;
  const int idxPlotColor = 1;

  int rc = set_value;
  if( ptr )
  {
    if( set )
    {
      unsigned int abgr = ARGB_to_ABGR((unsigned int)set_value);
      if( idxColor == which )
        ptr->m_color = abgr;
      else if( idxPlotColor == which )
        ptr->m_plot_color = abgr;
    }
    else
    {
      ON_Color c;
      if( idxColor == which )
        c = ptr->m_color;
      else if( idxPlotColor == which )
        c = ptr->m_plot_color;
      unsigned int abgr = (unsigned int)c;
      rc = (int)abgr;
    }
  }
  return rc;
}
Example #2
0
RH_C_FUNCTION void ON_Material_SetColor( ON_Material* pMaterial, int which, int argb )
{
  const int idxDiffuse = 0;
  const int idxAmbient = 1;
  const int idxEmission = 2;
  const int idxSpecular = 3;
  const int idxReflection = 4;
  const int idxTransparent = 5;
  int abgr = ARGB_to_ABGR(argb);
  if( pMaterial )
  {
    switch(which)
    {
    case idxDiffuse:
      pMaterial->m_diffuse = abgr;
      break;
    case idxAmbient:
      pMaterial->m_ambient = abgr;
      break;
    case idxEmission:
      pMaterial->m_emission = abgr;
      break;
    case idxSpecular:
      pMaterial->m_specular = abgr;
      break;
    case idxReflection:
      pMaterial->m_reflection = abgr;
      break;
    case idxTransparent:
      pMaterial->m_transparent = abgr;
      break;
    }
  }
}
Example #3
0
RH_C_FUNCTION bool ON_PointCloud_AppendPoint4( ON_PointCloud* pPointCloud, ON_3DPOINT_STRUCT point, int argb, ON_3DVECTOR_STRUCT normal )
{
  bool rc = false;
  if( pPointCloud )
  {
    const ON_3dPoint* _point = (const ON_3dPoint*)(&point);
    pPointCloud->m_P.Append(*_point);
    ON_PointCloud_FixPointCloud(pPointCloud, true, true, false);
    pPointCloud->InvalidateBoundingBox();

    if( pPointCloud->m_N.Count() > 0 )
    {
      const ON_3dVector* _normal = (const ON_3dVector*)(&normal);
      int index = pPointCloud->m_N.Count()-1;
      pPointCloud->m_N[index] = *_normal;
    }
    if( pPointCloud->m_C.Count() > 0 )
    {
      int index = pPointCloud->m_C.Count()-1;
      pPointCloud->m_C[index] = ARGB_to_ABGR(argb);
    }
    rc = true;
  }
  return rc;
}
Example #4
0
RH_C_FUNCTION void ON_TextEntity2_SetMaskColor(ON_TextEntity2* pTextEntity2, int argb)
{
  if( pTextEntity2 )
  {
    ON_Color c = ARGB_to_ABGR(argb);
    pTextEntity2->SetMaskColor(c);
  }
}
Example #5
0
RH_C_FUNCTION void ON_LineCurve_Draw(const ON_LineCurve* pCrv, CRhinoDisplayPipeline* pDisplayPipeline, int argb, int thickness)
{
  if( pCrv && pDisplayPipeline )
  {
    int abgr = ARGB_to_ABGR(argb);
    pDisplayPipeline->DrawLine( pCrv->m_line.from, pCrv->m_line.to, abgr, thickness );
  }
}
RH_C_FUNCTION void ON_TextEntity2_SetMaskColor(ON_TextEntity2* pTextEntity2, int argb)
{
#if defined(RHINO_V5SR) || defined(OPENNURBS_BUILD)// only available in V5
  if( pTextEntity2 )
  {
    ON_Color c = ARGB_to_ABGR(argb);
    pTextEntity2->SetMaskColor(c);
  }
#endif
}
Example #7
0
RH_C_FUNCTION bool ON_PointCloud_SetColor( ON_PointCloud* pPointCloud, int index, int argb)
{
  bool rc = false;
  if( pPointCloud && (index >= 0) && (index < pPointCloud->m_P.Count()) )
  {
    ON_PointCloud_FixPointCloud(pPointCloud, false, true, false);

    unsigned int abgr = ARGB_to_ABGR(argb);
    ON_Color color = abgr;
    pPointCloud->m_C[index] = color;
  }
  return rc;
}
Example #8
0
RH_C_FUNCTION bool ON_PointCloud_InsertPoint2( ON_PointCloud* pPointCloud, int index, ON_3DPOINT_STRUCT point, int argb )
{
  bool rc = false;
  if( pPointCloud && index>=0 )
  {
    const ON_3dPoint* _point = (const ON_3dPoint*)(&point);
    pPointCloud->m_P.Insert(index, *_point);
    ON_PointCloud_FixPointCloud(pPointCloud, false, true, false);
    pPointCloud->InvalidateBoundingBox();
    
    if( pPointCloud->m_C.Count() > index )
      pPointCloud->m_C[index] = ARGB_to_ABGR(argb);

    rc = true;
  }
  return rc;
}
Example #9
0
RH_C_FUNCTION void ON_Light_SetColor(ON_Light* pLight, int which, int argb)
{
  const int idxAmbient = 0;
  const int idxDiffuse = 1;
  const int idxSpecular = 2;
  if( pLight )
  {
    unsigned int abgr = ARGB_to_ABGR(argb);
    switch(which)
    {
    case idxAmbient:
      pLight->SetAmbient(abgr);
      break;
    case idxDiffuse:
      pLight->SetDiffuse(abgr);
      break;
    case idxSpecular:
      pLight->SetSpecular(abgr);
      break;
    }
  }
}