<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="https://syndication.webwiz.net/rss_namespace/">
 <channel>
  <title>Codejock Developer Community : Disabling Vector</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : Toolkit Pro : Disabling Vector]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Fri, 03 Apr 2026 20:57:32 +0000</pubDate>
  <lastBuildDate>Mon, 21 Aug 2023 11:02:57 +0000</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 12.04</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>forum.codejock.com/RSS_post_feed.asp?TID=24211</WebWizForums:feedURL>
  <image>
   <title><![CDATA[Codejock Developer Community]]></title>
   <url>http://forum.codejock.com/forum_images/codejock-logo.gif</url>
   <link>http://forum.codejock.com/</link>
  </image>
  <item>
   <title><![CDATA[Disabling Vector : We have decided to move on with...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=24211&amp;PID=78761&amp;title=disabling-vector#78761</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=3213">rdhd</a><br /><strong>Subject:</strong> 24211<br /><strong>Posted:</strong> 21 August 2023 at 11:02am<br /><br /><div>We have decided to move on with trying to use XAML in Codejock. Instead, we are using SVG via Direct2D which has APIs that lets one render SVG to a bitmap. D2D supports more SVG than CJ supports XAML. The main limitation we have found is referenced styles. So, we just embed the style into each SVG element.</div><div><br></div><div>So far our results are pretty good and there are a lot more tools that create SVG than create Silverlight XAML which is a Microsoft format created long, long ago in an OS far, far away. I think I saw a Microsoft note saying Silverlight XAML is end of life and its time to move on.</div><div><br></div><div>When we load our SVG images, we know what the size of the images we want and we render to a bitmap. We render and then give the image manager the bitmap. This also means that the normal CodeJock code that automatically creates the disabled image works. Also, we use HTML tooltips and the Microsoft low level control that renders HTML supports SVG. We reference our SVG image for a command in the title/caption area of our tooltips.<br></div><div><br></div><div>The D2D functionality does depend on the version of Windows. One has to support NTDDI_WIN10_RS2. So, if you have to support Win10 build 1703, this SVG solution probably isn't an option. We have not flipped a switch yet to compile everything under RS2. We just push and pop a pragma in the one file that uses the D2D SVG APIs we use to render our images. Microsoft will be phasing Win 10 out. I think around this time next year. So, the version, at leas for us, will be a non-issue once we update all our projects.<br></div><div><br></div><div>Also, I presume that Microsoft will continue to enhance their D2D support of SVG as it is an open standard. See, ID2DRendterTarget and ID2D1DeviceRContext5. It was not much code for our display guru to implement SVG using Windows Imaging Component and D2D.<br></div><div><br></div><div><a href="https://learn.microsoft.com/en-us/windows/win32/api/d2d1/nn-d2d1-id2d1rendertarget" target="_blank" rel="nofollow">https://learn.microsoft.com/en-us/windows/win32/api/d2d1/nn-d2d1-id2d1rendertarget</a></div><div><br></div><div><a href="https://learn.microsoft.com/en-us/windows/win32/api/d2d1_3/nn-d2d1_3-id2d1devicec&#111;ntext5" target="_blank" rel="nofollow">https://learn.microsoft.com/en-us/windows/win32/api/d2d1_3/nn-d2d1_3-id2d1devicecontext5</a><br></div>]]>
   </description>
   <pubDate>Mon, 21 Aug 2023 11:02:57 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=24211&amp;PID=78761&amp;title=disabling-vector#78761</guid>
  </item> 
  <item>
   <title><![CDATA[Disabling Vector : Hi dbrookes,As usualy your post...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=24211&amp;PID=78717&amp;title=disabling-vector#78717</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=3213">rdhd</a><br /><strong>Subject:</strong> 24211<br /><strong>Posted:</strong> 07 June 2023 at 8:57am<br /><br />Hi dbrookes,<div><br></div><div>As usualy your post is quite detailed and immensely useful. I tried ShapeConverter yesterday and found that GeometryDrawing and other elements you mentioned that I had not yet encountered and tried were indeed DOA in CodeJock. I have asked our UI team to read your reply as you have added a lot of good tips on how to approach using CodeJock xaml.</div><div><br></div><div>I sure hope CodeJock is actively working on improving xaml support. Too bad they have focused on Silverlight which is quite "old" and, as Microsoft has indicated, passe.</div>]]>
   </description>
   <pubDate>Wed, 07 Jun 2023 08:57:24 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=24211&amp;PID=78717&amp;title=disabling-vector#78717</guid>
  </item> 
  <item>
   <title><![CDATA[Disabling Vector : Hi rdhd.The reason for doing 16px...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=24211&amp;PID=78716&amp;title=disabling-vector#78716</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=9372">dbrookes</a><br /><strong>Subject:</strong> 24211<br /><strong>Posted:</strong> 07 June 2023 at 12:18am<br /><br /><div>Hi rdhd.</div><div><br></div><div>The reason for doing 16px and 32px vector icons is for style mainly. If you have a 1px stroke at 16px, but you rasterize that at 32px, that stroke will come out 2px thick. Our icon style is similar to Office and Axialis 2019 (Axialis' XAML tends to work good in XTP by the way). So we want 1px strokes at 16px and at 32px. And we also have slightly different proportions and padding for small 16px vector icons versus large 32px vector icons. <br></div><div>If it works for you, you can maybe get away with a single size. You may have to use &lt;Viewbox&gt; tags to get the XAML to rasterize at variable sizes. But that can ruin your pixel alignment and make your icons look blurry. That being said so will non-integer DPI scaling. I'd be careful with it. Give this article from Axialis a look:</div><div><a href="https://www.axialis.com/blog/how-to-create-quality-ic&#111;ns-for-your-applicati&#111;n/" target="_blank" rel="nofollow">https://www.axialis.com/blog/how-to-create-quality-icons-for-your-application/</a></div><div><br></div><div>I have had similar issues with XTP XAML as what your having. When we first started to do vector icons InkScape was the first thing we tried. It does spit out stuff that XTP doesn't like. The XAML support in XTP is only a subset of whatever XAML elements Silverlight, WPF and so on have available. So you got to be a bit careful and stick with the basics. The MarkupPad utility is useful for testing this stuff. Here is what I know isn't supported:</div><div><ul><li>MatrixTransform is not supported.</li><li>DrawingBrush, GeometryDrawing and PathGeometry are not supported. (These are commonly used in the VS2019 icon pack .xaml files)</li><li>Canvas Clip is not supported. As a result overlay clipping must be baked directly into the icon geometry.</li><li>Canvas RenderTransform TransformGroup is not supported.</li><li>LinearGradientBrush is supported but lacks support for MappingMode and Transform.</li><li>RadialGradientBrush is not supported.</li></ul></div><div>Additionally I know that the following are interpreted as integers instead of floating point:</div><div><ul><li>Canvas Left or Top offset.</li><li>Stroke Thickness.</li><li>Corner RadiusX or RadiusY values.</li></ul></div><div>But these are rarely too much of an issue, especially if you are pixel aligned.<br></div><div><br></div><div>We are still using the XAML export plugin for Adobe Illustrator and exporting with "XAML for Silverlight". And that works most of the time for us. There are a few weird things with that plugin. Like having to put a transparent rectangle that covers the entire canvas to ensure the output XAML canvas size is the entire canvas (otherwise it clamps down to the content). But it mostly gets the job done. But gradients are not something that tends to work I think. We had one or two icons trying to do it we had to rework to not include a gradient.</div><div><br></div><div>Another idea I was contemplating trying, but never got around to trying, was having a pre-compile step that goes over the icon SVG or XAML vector icon resources and rasterizes them with an external library, like maybe nanosvg for svg or .NET for xaml, to appropriately sized bitmaps. Alternatively this could be done at runtime for the current DPI awareness and then cached. Then you can load those perfectly sized bitmaps right into the XTP image manager and side-step the XTP XAML entirely. But who knows if this is a good idea or not in practice.</div><div><br></div><div>Hope that helps :)<br></div>]]>
   </description>
   <pubDate>Wed, 07 Jun 2023 00:18:05 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=24211&amp;PID=78716&amp;title=disabling-vector#78716</guid>
  </item> 
  <item>
   <title><![CDATA[Disabling Vector : Hi dbrookes,I was reading your...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=24211&amp;PID=78715&amp;title=disabling-vector#78715</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=3213">rdhd</a><br /><strong>Subject:</strong> 24211<br /><strong>Posted:</strong> 06 June 2023 at 11:49am<br /><br />Hi dbrookes,<div><br></div><div>I was reading your post as I am trying to figure out how this xaml stuff works.&nbsp;</div><div><br></div><div>Out UI team wants to create a single vector icon for each ribbon control or backstage button (ignoring disabled for now) that will work for any user DPI setting. So I ask why are you creating two sizes?&nbsp;</div><div><br></div><div>I think our UI team is aiming to create 32x32 (pixel) sizes only. At least when I set the image size I am passing in 32 as the width. They are actually clamoring for SVG as our company has many products that use SVG and apparently their experience with SVG has led them to believe a single vector image should be sufficient. We are the only Windows desktop product in the company that uses CodeJock and they keep asking why we don't support SVG.</div><div><br></div><div>As an aside, so far, the UI team have not provided a single Silverlight xaml image that displays in CJ V 22.0. I can open them in Internet Explorer with no problem. They are currently trying Inkscape's latest version and using the save as Silverlight option. I have managed to get CJ to actually create a test image but only after I deleted the xaml &lt;LinearGradientBrush.GradientStops&gt; and &lt;GradientStopCollection&gt; the UI team is fond of. Either that stuff is not part of Silverlight or CJ just doesn't support those elements. CJ cannot create the runtime classes at which point CJ just gives up. Even after doing that and getting parse to succeed and an image icon to be available, I have stepped thru lots of code and see CJ using GDI+ to draw but nothing shows up.</div><div><br></div><div>I installed inkscape on my box and created the simplest image I could. I set the canvas size to 32x32 and placed an ellipse. After stepping thru the CJ parsing code, I found I had to delete &lt;Canvas.Resources/&gt; because it was empty and CJ didn't just ignore that, it gave up. I have asked the UI team to try an Adobe Illustrator add-in that I saw mentioned on the forums here so they can save their images as Silverlight xaml and hopefully it will work. I would note that I have no real ideal how to use Inkscape so I just hacked a bit to see what I could see.</div><div><br></div><div>My ellipse did finally display though it is quite a bit smaller than I expected. I'm guessing "px" does not stand for "pixel" but getting something to display is a start.</div><div><br></div><div>I can see this attempt to use xaml turning into a debugging nightmare :( Also, when searching around for Silverlight, I saw Microsoft saying it is at "end of life". All documenation I have scanned so far is related to WPF. I was searching for LinearGradientBrush and its MappingMode (CJ choked on the mapping mode too) and GradientStops to see if they are valid entities. I have asked the UI team to see if they can create gradients with no mapping mode and no &lt;GradientStops&gt; element.</div><div><br></div><div>Is this CodeJock compatible xaml creation as difficult to come to grips with as it appears so far? Our UI team has tried a number of times over the last year or two to give me xaml files that work in CJ. The only images I have gotten to work as we expect is xaml icons I have found in CJ itself. Well, and today, my tiny ellipse!</div>]]>
   </description>
   <pubDate>Tue, 06 Jun 2023 11:49:30 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=24211&amp;PID=78715&amp;title=disabling-vector#78715</guid>
  </item> 
  <item>
   <title><![CDATA[Disabling Vector : Yep. Opacity will fade them out...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=24211&amp;PID=78373&amp;title=disabling-vector#78373</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=3213">rdhd</a><br /><strong>Subject:</strong> 24211<br /><strong>Posted:</strong> 24 January 2022 at 11:40am<br /><br /><div>Yep. Opacity will fade them out but the hue remains. Just wondered if that was enough to indicate disabled. Of course some images can be grayscale themselves too.</div><div><br></div><div>If we end up supporting XAML, I'll be tempted to just change the CJ markup code if possible. I usually use the NTSC color to grayscale conversion method so its quite easy and fast. Better than SECAM which we always joked meant "Something essentially contradictory to the American method).<br></div>]]>
   </description>
   <pubDate>Mon, 24 Jan 2022 11:40:09 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=24211&amp;PID=78373&amp;title=disabling-vector#78373</guid>
  </item> 
  <item>
   <title><![CDATA[Disabling Vector : &amp;gt;I don&amp;#039;t supposed you...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=24211&amp;PID=78371&amp;title=disabling-vector#78371</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=669">markr</a><br /><strong>Subject:</strong> 24211<br /><strong>Posted:</strong> 24 January 2022 at 3:31am<br /><br />&gt;&nbsp;I don't supposed you tried setting an opacity to some low value like 0.3.<div><br></div><div>I did, and found the results unsatisfactory. I use a grayscale conversion function very similar to what Daniel shared in this thread, then also adjust the brightness a bit.</div><div><br></div><div>Opacity doesn't alter the colors, so it never actually looks "disabled" to me.</div>]]>
   </description>
   <pubDate>Mon, 24 Jan 2022 03:31:09 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=24211&amp;PID=78371&amp;title=disabling-vector#78371</guid>
  </item> 
  <item>
   <title><![CDATA[Disabling Vector : Hi rdhd.The way I do it is have...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=24211&amp;PID=78370&amp;title=disabling-vector#78370</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=9372">dbrookes</a><br /><strong>Subject:</strong> 24211<br /><strong>Posted:</strong> 23 January 2022 at 10:09pm<br /><br /><div>Hi rdhd.</div><div><br></div><div>The way I do it is have an archive of all of the .xaml files. I used to use .zip but found .tar.gz with libarchive to be much faster for this. I open this archive once on startup and read all of the .xaml out of it into strings. I then use CXTPImageManagerVectorImageHandle CreateMarkupHandle, actually I use my patched CreateDelayedMarkupHandle function I mentioned above. By the way that likely only helps if you have a very large number of icons to load. I'm loading around 1200, but each have small and large, normal and disabled. So its actually around 5000 icons being loaded.<br></div><div><br></div><div>I think using the IStream version of these should work fine if you want to read directly from a file stream. If you want to pre-process the .xaml though to do something like creating disabled variants it may be better to read the file into memory first, do what you want and then pass the string to CreateMarkupHandle. <br></div><div><br></div><div>I mentioned above I think, but I generate disabled icons at pre-compile time with a powershell script. For grayscaling I use the following function.</div><div><table width="99%"><tr><td><pre class="BBcode"></div><div>function Grayscale($brightnessFactor, &#091;ref&#093;$colour) {<br>&nbsp;&nbsp;&nbsp; # Convert input colour to grayscale.<br>&nbsp;&nbsp;&nbsp; $gray = $colour.Value.R * 0.299 + $colour.Value.G * 0.587 + $colour.Value.B * 0.114<br>&nbsp;&nbsp;&nbsp; # Scale by brightness factor.<br>&nbsp;&nbsp;&nbsp; $gray = &#091;System.Math&#093;::Pow(($gray / 255), $brightnessFactor) * 255<br>&nbsp;&nbsp;&nbsp; $gray = &#091;System.Convert&#093;::ToInt32($gray) # Floor<br>&nbsp;&nbsp;&nbsp; $colour.Value = &#091;System.Drawing.Color&#093;::FromArgb($colour.Value.A, $gray, $gray, $gray)<br>}<br></div><div></pre></td></tr></table><br></div><div>Shouldn't be too hard to do the same thing in C++. For light themes I use a brightness factor of 0.5, for dark themes I use a brightness factor of 1.25.<br></div><div><br></div><div>By the way. The names of my icons are actually the id names of the command. e.g. ID_FILE_NEW.xaml. I have a pre-compile awk script that parses CommandsRes.h into a header file that contains the id name strings and id number paired together. That way we can map the file name to the id of the command at runtime.<br></div><div><br></div><div>Regards,</div><div>Daniel.<br></div>]]>
   </description>
   <pubDate>Sun, 23 Jan 2022 22:09:50 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=24211&amp;PID=78370&amp;title=disabling-vector#78370</guid>
  </item> 
  <item>
   <title><![CDATA[Disabling Vector : I have it - CXTPImageManager::OleLoadVectorIcon....]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=24211&amp;PID=78369&amp;title=disabling-vector#78369</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=3213">rdhd</a><br /><strong>Subject:</strong> 24211<br /><strong>Posted:</strong> 21 January 2022 at 1:04pm<br /><br />I have it - CXTPImageManager::OleLoadVectorIcon. The "Ole" threw me when I was searching their files. Looks like this is the highest level call I can make analogous to the API I use to load an image from file and give it to the image manager.<br>]]>
   </description>
   <pubDate>Fri, 21 Jan 2022 13:04:08 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=24211&amp;PID=78369&amp;title=disabling-vector#78369</guid>
  </item> 
  <item>
   <title><![CDATA[Disabling Vector : Hi markr,I was thinking that if...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=24211&amp;PID=78368&amp;title=disabling-vector#78368</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=3213">rdhd</a><br /><strong>Subject:</strong> 24211<br /><strong>Posted:</strong> 21 January 2022 at 9:24am<br /><br /><div>Hi markr,</div><div><br></div><div>I was thinking that if we add support for xaml icons, I would want to load from files or resources. Not because of a performance issue but because it can be more dynamic. Image creation people can just drop a file on disk and cause a load or reload to occur in our app and they can view the results right away. No coding needed, no build or waiting for a build to deploy. I do this for BMP and PNG now and the image creator just has to go to our options dialog and change color theme (I support images on a per color theme basis too). I discover the ID of the resource by using a naming convention that has the ID included in the name. Filenames have the ID and when adding a resource using Visual Studio, one just goes to the properties window and selects the auto-generated ID and types something like (quotes included) "image12345_16". The "16" is irrelevant to my code as I just care what is between "image" and "_". Filenames follow the same pattern - image12345_16.png, image12345_32.png ... <br></div><div><br></div><div>I also auto-scale images using WIC for cases where a user is running at a high DPI like 200% on a 4k monitor. If any scaled image looks bad, our team just creates, say a 64x64 version of an image and drops it on disk (image12345_64.png), or adds it to the resource DLL and forces the reload.<br></div><div><br></div><div>I haven't tried using XTPCreateReadOnlyFileStream yet to see if that's the way to load a XAML icon from disk but it appears that it should work.</div><div><br></div><div>As for dimming, I don't supposed you tried setting an opacity to some low value like 0.3? I've been playing around with that and it shows promise. Images "fade" out quite well - so far. Ok, so I only have one simple image taken from the CommandBarIcons sample so its very simple ...<br></div>]]>
   </description>
   <pubDate>Fri, 21 Jan 2022 09:24:48 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=24211&amp;PID=78368&amp;title=disabling-vector#78368</guid>
  </item> 
  <item>
   <title><![CDATA[Disabling Vector : Hirdhd,I load XAML icons &amp;#034;on...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=24211&amp;PID=78366&amp;title=disabling-vector#78366</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=669">markr</a><br /><strong>Subject:</strong> 24211<br /><strong>Posted:</strong> 20 January 2022 at 6:40pm<br /><br />Hi&nbsp;rdhd,<div><br></div><div>I load XAML icons "on demand" (during containing window construction) from program resources and haven't observed much of a delay at all.</div><div><br></div><div>My approach is to parse the icon XAML and replace all instances of "fill" and "stroke" attributes with dimmed versions of the target colors. For the dimming, I first convert the color to grayscale and then "lighten" it by 50%. The resulting disabled XAML images are then cached in an XTP image manager instance.</div><div><br></div><div>Just wanted to share what's been working well for me in case it helps.</div><div><br></div><div>- Mark</div>]]>
   </description>
   <pubDate>Thu, 20 Jan 2022 18:40:03 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=24211&amp;PID=78366&amp;title=disabling-vector#78366</guid>
  </item> 
 </channel>
</rss>