<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: convert integer to color in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/convert-integer-to-color/m-p/5767138#M71207</link>
    <description>&lt;P&gt;It should act the same on any machine. The Endian of a machine refers to where the machine stores the negative symbol on an integer. Some store it at the beginning (-100) and some at the end (100-). This function takes that into account.&lt;/P&gt;</description>
    <pubDate>Wed, 12 Aug 2015 01:47:50 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2015-08-12T01:47:50Z</dc:date>
    <item>
      <title>convert integer to color</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/convert-integer-to-color/m-p/5753435#M71203</link>
      <description>&lt;P&gt;I'm creating a WPF app for Revit and have some confusion about converting integers to colors. The code below works but I had to change the blue and red channels when creating the System.Windows.Media.Color for my window or the color was wrong.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;System.Drawing.Color c = System.Drawing.Color.FromArgb(tnt.get_Parameter(BuiltInParameter.LINE_COLOR).AsInteger());
GraphicColour = System.Windows.Media.Color.FromRgb(c.B, c.G, c.R); //B and R need to be reversed&lt;/PRE&gt;&lt;P&gt;I saw &lt;A href="http://thebuildingcoder.typepad.com/blog/2012/07/obj-model-exporter-with-transparency-support.html" target="_blank"&gt;Jeremy Tammik's post on "The Bullding Coder" blog&lt;/A&gt;&amp;nbsp; and tried to use his IntToColor function but had the same result, the channels had to be flipped.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone know why this is?&lt;/P&gt;</description>
      <pubDate>Sun, 02 Aug 2015 23:55:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/convert-integer-to-color/m-p/5753435#M71203</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-08-02T23:55:42Z</dc:date>
    </item>
    <item>
      <title>Re: convert integer to color</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/convert-integer-to-color/m-p/5763496#M71204</link>
      <description>I don't know why it's so, but I experienced the same issue and just accepted it &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Mon, 10 Aug 2015 06:53:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/convert-integer-to-color/m-p/5763496#M71204</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-08-10T06:53:36Z</dc:date>
    </item>
    <item>
      <title>Re: convert integer to color</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/convert-integer-to-color/m-p/5763698#M71205</link>
      <description>&lt;P&gt;I found this works.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;private Color ConvertInt(int rgb)
{
	byte[] bArray = BitConverter.GetBytes(rgb);
	if(BitConverter.IsLittleEndian)
		return new Color(bArray[0], bArray[1], bArray[2]);
	else
		return new Color(bArray[1], bArray[2], bArray[3]);
}&lt;/PRE&gt;&lt;P&gt;Seems it has to do with the architecture of the machine.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Aug 2015 10:12:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/convert-integer-to-color/m-p/5763698#M71205</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-08-10T10:12:19Z</dc:date>
    </item>
    <item>
      <title>Re: convert integer to color</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/convert-integer-to-color/m-p/5765321#M71206</link>
      <description>&lt;P&gt;"&lt;SPAN&gt;Seems it has to do with the architecture of the machine" ?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does this means this function could behaive differently on each PC ?&lt;/P&gt;</description>
      <pubDate>Tue, 11 Aug 2015 05:49:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/convert-integer-to-color/m-p/5765321#M71206</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-08-11T05:49:37Z</dc:date>
    </item>
    <item>
      <title>Re: convert integer to color</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/convert-integer-to-color/m-p/5767138#M71207</link>
      <description>&lt;P&gt;It should act the same on any machine. The Endian of a machine refers to where the machine stores the negative symbol on an integer. Some store it at the beginning (-100) and some at the end (100-). This function takes that into account.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Aug 2015 01:47:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/convert-integer-to-color/m-p/5767138#M71207</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-08-12T01:47:50Z</dc:date>
    </item>
  </channel>
</rss>

