Author Topic: how to get ACI color from RGB?  (Read 3592 times)

0 Members and 1 Guest are viewing this topic.

jmaeding

  • Bull Frog
  • Posts: 304
  • I'm just here for the Shelties.
how to get ACI color from RGB?
« on: February 26, 2007, 01:54:38 PM »
I found a few posts close to what I want, but I am wondering if there is a built-in .net acad api function to do this.
I looked at the colorconverter class but did not see how that helped.
any ideas?  thanks
James Maeding

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: how to get ACI color from RGB?
« Reply #1 on: February 26, 2007, 03:28:00 PM »
System.Drawing.Color.FromArgb(ri,gi,bi);

I was going to add it into my color Lab http://www.theswamp.org/index.php?topic=14977.msg181469#msg181469
... but I got sidetracked. < and because of lack of response >
« Last Edit: February 26, 2007, 03:51:24 PM by Kerry Brown »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

jmaeding

  • Bull Frog
  • Posts: 304
  • I'm just here for the Shelties.
Re: how to get ACI color from RGB?
« Reply #2 on: February 26, 2007, 03:49:37 PM »
wow, I had no idea anything outside of acad had a similar thing to the acad palette.
I guess the 256 color acad system was modeled after something common a long time ago, before windows for sure.
James Maeding

jmaeding

  • Bull Frog
  • Posts: 304
  • I'm just here for the Shelties.
Re: how to get ACI color from RGB?
« Reply #3 on: February 26, 2007, 04:17:33 PM »
hmm, I am not clear on how to get that back to an ACI index.  I looked at the objects involved, and the methods to do this do not stand out, any further tips?  thanks so far :)
James Maeding

jmaeding

  • Bull Frog
  • Posts: 304
  • I'm just here for the Shelties.
Re: how to get ACI color from RGB?
« Reply #4 on: February 26, 2007, 04:20:05 PM »
oh, totally missed the lookupaci method of entitycolor class, that should do it...
James Maeding

jmaeding

  • Bull Frog
  • Posts: 304
  • I'm just here for the Shelties.
Re: how to get ACI color from RGB?
« Reply #5 on: February 26, 2007, 06:47:20 PM »
so code is (so far):
Public Function SelectAcColor(ByVal inColor As AcCo.Color) As AcCo.Color
        Dim retColor As AcCo.Color = Nothing
        If inColor.ColorMethod <> ColorMethod.ByAci Then
            Dim ACI As Integer = AcCo.EntityColor.LookUpAci(inColor.Red, inColor.Green, inColor.Blue)
            inColor = AcCo.Color.FromColorIndex(ColorMethod.ByAci, ACI)
        End If
        Dim CD As New AcWi.ColorDialog
        CD.Color = inColor 'Set Color
        CD.SetDialogTabs(AcWi.ColorDialog.ColorTabs.ACITab)
        If CD.ShowDialog = DialogResult.OK Then            'If user clicked OK then
            retColor = CD.Color
        End If
        Return retColor
    End Function
James Maeding