<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Additive blended lines with Fblend</title>
		<link>http://www.allegro.cc/forums/view/591856</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Thu, 14 Jun 2007 06:44:09 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I need a fast additive blended line function, and I think it would be possible to use some of the fblend&#39;s internal functions to do this.<br />Fblend has 2 primitive blenders functions:</p><div class="source-code snippet"><div class="inner"><pre><span class="k1">void</span> fblend_rect_add <span class="k2">(</span><a href="http://www.allegro.cc/manual/BITMAP" target="_blank"><span class="a">BITMAP</span></a> <span class="k3">*</span>dst, <span class="k1">int</span> x, <span class="k1">int</span> y, <span class="k1">int</span> w, <span class="k1">int</span> h, <span class="k1">int</span> color, <span class="k1">int</span> fact<span class="k2">)</span>  
<span class="k1">void</span> fblend_rect_trans <span class="k2">(</span><a href="http://www.allegro.cc/manual/BITMAP" target="_blank"><span class="a">BITMAP</span></a> <span class="k3">*</span>dst, <span class="k1">int</span> x, <span class="k1">int</span> y, <span class="k1">int</span> w, <span class="k1">int</span> h, <span class="k1">int</span> color, <span class="k1">int</span> fact<span class="k2">)</span>
</pre></div></div><p>

I think it souldn&#39;t be so hard to modify some of its code to get a  fblend_line_add(). However, I am not a Fblend expert, I am using this library since a few months. So is there any experienced Fblend user who can help me with this? <br />Or if this is not possible, does someone know a good way to achieve this?(in software)
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Paul whoknows)</author>
		<pubDate>Tue, 12 Jun 2007 09:26:48 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Fblend has built in pixel functions too I believe. If nothing else, try replacing allegro&#39;s native <tt>line</tt> function&#39;s putpixel calls with fblend&#39;s.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Ceagon Xylas)</author>
		<pubDate>Tue, 12 Jun 2007 10:28:12 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You know, a line really is a rectangle.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Tue, 12 Jun 2007 12:49:15 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Not... really...<br />A rectanle is a bunch of lines? Yes. A line is not a rectangle. Not as far as the code&#39;s concerned anyway...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (James Stanley)</author>
		<pubDate>Tue, 12 Jun 2007 14:48:52 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>That depends on if the lines are axis-aligned or not.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (gnolam)</author>
		<pubDate>Tue, 12 Jun 2007 15:10:27 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
You know, a line really is a rectangle.
</p></div></div><p>

I am not sure about that. With rect() I can draw lines, but only horizontal and vertical ones. Not very useful in my case, that&#39;s why I need a true line_additive() function.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Paul whoknows)</author>
		<pubDate>Tue, 12 Jun 2007 18:13:13 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Maybe openlayer/allegroGL is what you want?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Jonatan Hedborg)</author>
		<pubDate>Tue, 12 Jun 2007 19:48:19 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>My game supports OpenGL and software drivers. I need an additive blender line() function only for the software driver(Allegro + Fblend).
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Paul whoknows)</author>
		<pubDate>Tue, 12 Jun 2007 20:41:25 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Considering that most of the time drawing the line won&#39;t be in the blending routines, I think you can just use Allegro&#39;s do_line() and be done with it.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Bob)</author>
		<pubDate>Tue, 12 Jun 2007 20:43:21 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">I, myself said:</div><div class="quote"><p>
Fblend has built in pixel functions too I believe.
</p></div></div><p>
After looking through the code I found it doesn&#39;t. So never mind that idea.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Ceagon Xylas)</author>
		<pubDate>Tue, 12 Jun 2007 23:05:11 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Considering that most of the time drawing the line won&#39;t be in the blending routines, I think you can just use Allegro&#39;s do_line() and be done with it.
</p></div></div><p>

The line algorithm is not the problem, the problem is that I need a put_pixel_additive/16/32/MMX() function, just like rect_add().</p><p>I thought that Fblend used some kind of &#39;put_pixel_add()&#39; in the function rect_add(), so I wanted to use that to make my line_add() function, but as Ceagon Xylas said, there is no such a function.</p><p>Bob, can you tell me if is there a way to obtain a &#39;put_pixel_add()&#39; function from Fblend? <br />If not, any advise or link or code it would be greatly appreciated.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Paul whoknows)</author>
		<pubDate>Wed, 13 Jun 2007 06:11:23 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You won&#39;t beable to use MMX/SSE properly on lines that aren&#39;t horizontal. The data just isn&#39;t in the same area, so you&#39;d have to do it pixel by pixel. which is what you get from do_line and a custom function that does the reading and writing of bitmap data.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Wed, 13 Jun 2007 06:31:16 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I suppose in theory you could write a breshenham line routine that decomposes to short horizontal or vertical lines, but it&#39;s barely worth it.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Matt Smith)</author>
		<pubDate>Wed, 13 Jun 2007 18:51:51 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
You won&#39;t beable to use MMX/SSE properly on lines that aren&#39;t horizontal.
</p></div></div><p>
Surely it&#39;d still be helpful though? You&#39;re taking two (r, g, b) vectors, multiplying each by a scalar and then adding them together.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Harte)</author>
		<pubDate>Wed, 13 Jun 2007 20:24:58 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Good point, but for simplicity you&#39;d prolly have to assume that the RGB is in the bottom 24 bits, which won&#39;t be 100% reliable.  I suppose 2 versions would be OK, as you are passing a callback to do_line() anyway, so no need to test inside the my_putpixel().</p><p>I&#39;m not doing this.  I&#39;ve had my fill of asm lately <img src="http://www.allegro.cc/forums/smileys/tongue.gif" alt=":P" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Matt Smith)</author>
		<pubDate>Wed, 13 Jun 2007 23:43:55 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Right now I am using this:</p><div class="source-code snippet"><div class="inner"><pre><a href="http://www.allegro.cc/manual/set_add_blender" target="_blank"><span class="a">set_add_blender</span></a><span class="k2">(</span><span class="n">255</span>,<span class="n">255</span>,<span class="n">255</span>, <span class="n">127</span><span class="k2">)</span><span class="k2">;</span>
<a href="http://www.allegro.cc/manual/drawing_mode" target="_blank"><span class="a">drawing_mode</span></a><span class="k2">(</span>DRAW_MODE_TRANS,NULL,NULL,NULL<span class="k2">)</span><span class="k2">;</span>
<span class="c">//draw primitive here (lines, circles, rect, etc.)</span>
<a href="http://www.allegro.cc/manual/drawing_mode" target="_blank"><span class="a">drawing_mode</span></a><span class="k2">(</span>DRAW_MODE_SOLID,NULL,NULL,NULL<span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>

If you know a faster way of doing this, please let me know.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Paul whoknows)</author>
		<pubDate>Thu, 14 Jun 2007 06:44:09 +0000</pubDate>
	</item>
</rss>
