<?xml version="1.0" encoding="UTF-8"?>
	<rss version="2.0"
		xmlns:content="http://purl.org/rss/1.0/modules/content/"
		xmlns:wfw="http://wellformedweb.org/CommentAPI/"
		xmlns:dc="http://purl.org/dc/elements/1.1/"
		xmlns:atom="http://www.w3.org/2005/Atom"

			>

	<channel>
		<title>Cycling 74  &#187;  Topic: Way to truly non anti-antialiased lines using jgraphics</title>
		<atom:link href="http://cycling74.com/forums/topic/way-to-truly-non-anti-antialiased-lines-using-jgraphics/feed" rel="self" type="application/rss+xml" />
		<link>http://cycling74.com/forums/topic/way-to-truly-non-anti-antialiased-lines-using-jgraphics/feed</link>
		<description></description>
		<pubDate>Tue, 18 Jun 2013 17:15:09 +0000</pubDate>
		<generator>http://bbpress.org/?v=2.2.4</generator>
		<language></language>

		
														
					
				<item>
					<guid>http://cycling74.com/forums/topic/way-to-truly-non-anti-antialiased-lines-using-jgraphics/#post-58515</guid>
					<title><![CDATA[Way to truly non anti-antialiased lines using jgraphics]]></title>
					<link>http://cycling74.com/forums/topic/way-to-truly-non-anti-antialiased-lines-using-jgraphics/#post-58515</link>
					<pubDate>Wed, 17 Aug 2011 11:39:24 +0000</pubDate>
					<dc:creator>AlexHarker</dc:creator>

					<description>
						<![CDATA[
						<p>I&#8217;m trying to do some work with jgraphics and opengl and I&#8217;m having trouble matching results in the two.</p>
<p>One question that has arisen is:</p>
<p>Can I get truly non anti-aliased lines with jgraphics?</p>
<p>I am calling jgraphics_line_draw_fast, which claims to not be anti-aliased, but is clearly not. I&#8217;m drawing a grid, and I think a sharp edge might be preferable. Any way to do this?</p>
<p>Thanks</p>
<p>Alex</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/way-to-truly-non-anti-antialiased-lines-using-jgraphics/#post-210273</guid>
					<title><![CDATA[Re: Way to truly non anti-antialiased lines using jgraphics]]></title>
					<link>http://cycling74.com/forums/topic/way-to-truly-non-anti-antialiased-lines-using-jgraphics/#post-210273</link>
					<pubDate>Wed, 17 Aug 2011 15:01:39 +0000</pubDate>
					<dc:creator>danieleghisi</dc:creator>

					<description>
						<![CDATA[
						<p>I am painting non-antialiased vertical lines simply via jgraphics_move_to and jgraphics_line_to, with linewidth = 1., provided that the x value is half-integer. For instance, if my x is, say, 144.96, I simply round it to the 144.5.</p>
<p>I&#8217;m doing the same for horizontal lines (rounding y value to the nearest half-integer value), and it works as well, so you should be able to paint a grid just by using half-integer pixel positions.</p>
<p>Daniele</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/way-to-truly-non-anti-antialiased-lines-using-jgraphics/#post-210274</guid>
					<title><![CDATA[Re: Way to truly non anti-antialiased lines using jgraphics]]></title>
					<link>http://cycling74.com/forums/topic/way-to-truly-non-anti-antialiased-lines-using-jgraphics/#post-210274</link>
					<pubDate>Wed, 17 Aug 2011 18:21:04 +0000</pubDate>
					<dc:creator>Luigi Castelli</dc:creator>

					<description>
						<![CDATA[
						<p>Yes, I run into the same problem a while ago.</p>
<p><code>jgraphics_line_draw_fast()</code> promises to be anti-aliased already, but it&#8217;s not so.<br />
Probably a bug in the function or in the comments documenting the function&#8230;</p>
<p>The strategy I usually adopt is something like:</p>
<pre><code>for (i = 0; i < num_lines; ++i) {
    double pos = floor(height / num_lines) + 0.5;
    jgraphics_line_draw_fast(context, 0.0, pos, rect.width, pos, 1.0);
}</code></code></pre><p>However, my concern is that it would be more efficient if <code>jgraphics_line_draw_fast()</code> was already anti-aliased, since there would be no need to make the values rounded to half integer and the function itself would run faster...</p>
<p>I remember running some comparison tests to see if it was faster to draw lines with:</p>
<pre><code>jgraphics_line_draw_fast();</code></pre><p>versus</p>
<pre><code>jgraphics_move_to();
jgraphics_line_to();
jgraphics_stroke();</code></pre><p>I found there was no significant difference between the two and as a matter of fact I believe that <code>jgraphics_line_draw_fast()</code> calls the <code>jgraphics_move_to(); jgraphics_line_to(); jgraphics_stroke();</code> combo under the hood.</p>
<p>But of course I have no access to the source code so I am just speculating...</p>
<p>Hope this helps.</p>
<p>- Luigi</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/way-to-truly-non-anti-antialiased-lines-using-jgraphics/#post-210275</guid>
					<title><![CDATA[Re: Way to truly non anti-antialiased lines using jgraphics]]></title>
					<link>http://cycling74.com/forums/topic/way-to-truly-non-anti-antialiased-lines-using-jgraphics/#post-210275</link>
					<pubDate>Thu, 18 Aug 2011 09:01:29 +0000</pubDate>
					<dc:creator>AlexHarker</dc:creator>

					<description>
						<![CDATA[
						<p>Thanks guys. I may look into that, but it does not seem very elegant. </p>
<p>I assume that the result looking anti-aliased is simply a consequence of the anti-aliasing method, and I would be slightly concerned about this behaviour potentially changing&#8230;. however, if this is the only way I may have to adopt it to deal with the issues I am currently having.</p>
<p>FWIW the speed is not a great concern in the jgraphics method as in general it is slow &#8211; hence the inclusion of an alternative onpengl method, but the issue now is that I cannot exactly replicate line behaviour in certain alpha situations with anti-aliasing on in both environments. Drawing non-antialised for some of the task may relieve this issue for me&#8230;.</p>
<p>Thanks</p>
<p>A</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/way-to-truly-non-anti-antialiased-lines-using-jgraphics/#post-210276</guid>
					<title><![CDATA[Re: Way to truly non anti-antialiased lines using jgraphics]]></title>
					<link>http://cycling74.com/forums/topic/way-to-truly-non-anti-antialiased-lines-using-jgraphics/#post-210276</link>
					<pubDate>Thu, 18 Aug 2011 09:03:54 +0000</pubDate>
					<dc:creator>AlexHarker</dc:creator>

					<description>
						<![CDATA[
						<p>Also &#8211; would either of you happen to know (or be able to quickly check) what happens:</p>
<p>A &#8211; when you zoom in? </p>
<p>B &#8211; when the object is not placed at an integer position?</p>
<p>I assume this method you describe may well breakdown in these cases.</p>
<p>A.</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/way-to-truly-non-anti-antialiased-lines-using-jgraphics/#post-210277</guid>
					<title><![CDATA[Re: Way to truly non anti-antialiased lines using jgraphics]]></title>
					<link>http://cycling74.com/forums/topic/way-to-truly-non-anti-antialiased-lines-using-jgraphics/#post-210277</link>
					<pubDate>Thu, 18 Aug 2011 19:21:43 +0000</pubDate>
					<dc:creator>danieleghisi</dc:creator>

					<description>
						<![CDATA[
						<p>Hi AlexHarker,</p>
<p>my method (which is exactly Luigi&#8217;s method) does not work when you zoom in, but it works if the object is not placed at an integer position. That&#8217;s quite surprising to me as well, though, and I don&#8217;t have a real explanation of why it works.</p>
<p>And yes: a truly non-antialiased line function would be welcome :)</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/way-to-truly-non-anti-antialiased-lines-using-jgraphics/#post-210278</guid>
					<title><![CDATA[Re: Way to truly non anti-antialiased lines using jgraphics]]></title>
					<link>http://cycling74.com/forums/topic/way-to-truly-non-anti-antialiased-lines-using-jgraphics/#post-210278</link>
					<pubDate>Thu, 18 Aug 2011 22:18:12 +0000</pubDate>
					<dc:creator>Luigi Castelli</dc:creator>

					<description>
						<![CDATA[
						<p>Hi guys,</p>
<p>A &#8211; When you zoom in, Max does a matrix transform of the patcher window to scale it and show it at the desired zoom size. So even if you use a truly non-antialiased method to draw your object, the grid lines will be antialiased by the matrix transform anyway. All line points will be multiplied by a certain factor and they will no longer fall on half-pixel values. As a 3rd party programmer you really don&#8217;t have any control over this. If you check the standard distribution object that implement some kind of grid line drawing (scope~, plane~, filtergraph~, etc&#8230;) you will notice the are all antialiased when the zoom level is not 100%.</p>
<p>B &#8211; The above code will not break when the object is placed at non-integer position, because pixels will always fall on .5 values (it&#8217;s kind of a brute-force approach)</p>
<p>But I am curious of what Alex is trying to do exactly&#8230;<br />
Are you trying to use OpenGL to draw lines faster than the JGraphics API would allow?</p>
<p>- Luigi</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/way-to-truly-non-anti-antialiased-lines-using-jgraphics/#post-210279</guid>
					<title><![CDATA[Re: Way to truly non anti-antialiased lines using jgraphics]]></title>
					<link>http://cycling74.com/forums/topic/way-to-truly-non-anti-antialiased-lines-using-jgraphics/#post-210279</link>
					<pubDate>Thu, 18 Aug 2011 22:26:48 +0000</pubDate>
					<dc:creator>AlexHarker</dc:creator>

					<description>
						<![CDATA[
						<p>Hi Luigi,</p>
<p>I&#8217;m not sure about the first point &#8211; my experience is a little different from that &#8211; at high zoom you can actually draw much finer lines &#8211; it seems just that jgraphics handles the scaling of &#8220;points&#8221; before drawing to the screen, rather than scaling a rasterised image &#8211; after all it is supposed to be a vector graphic &#8211; not a scaled bitmap &#8211; maybe I&#8217;m wrong on this though.</p>
<p>And yes, I&#8217;m using opengl to draw faster than jgraphics using a FBO and then grabbing the pixels and drawing the result with jgraphics. The issue I&#8217;m starting from is to do with alpha and line blending behaviour in opengl that seems incorrect. In the case of the grid I am drawing one solution in opengl is not to anti-alias &#8211; then everything is fine. That doesn&#8217;t work for some other lines I need to do, so it&#8217;s not a total solution to my problem, which ideally would result in two draw routines (jgraphics/opengl) that look identical (or close) under all conditions.</p>
<p>A.</p>
						]]>
					</description>

					
					
				</item>

					
		
	</channel>
	</rss>

