<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Allegro put_pixel</title>
		<link>http://www.allegro.cc/forums/view/613829</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Wed, 29 Jan 2014 15:25:47 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hello, what I&#39;m looking for is how to change selected pixel alpha in the stored bitmap.</p><p>My draw method draws the terrain as stored bitmap and I&#39;m trying to remove selected pixels on click and then draw the bitmap again.</p><p>I have a method called removePixel(posX, posY) the purpose of this method is to change pixel alpha to 0.</p><p>Any ideas how to edit pixels in stored bitmap ?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Alon3k)</author>
		<pubDate>Wed, 29 Jan 2014 02:27:09 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Are you using allegro 4 or 5?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Wed, 29 Jan 2014 02:28:18 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Allegro 5 </p><p>I found some post stuff but it doesn&#39;t work...</p><p>ALLEGRO_LOCKED_REGION *lr = al_lock_bitmap_region(image, x, y, 1, 1, al_get_bitmap_format(image), ALLEGRO_LOCK_READONLY);</p><p>This should lock the pixel I need to access but...</p><p>unsigned char *ptr = (unsigned char *)lr-&gt;data; &lt;&lt; THIS RETURNS <br />ptr	0xcccccccc &lt;Bad Ptr&gt;	unsigned char *
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Alon3k)</author>
		<pubDate>Wed, 29 Jan 2014 02:29:15 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You can just set it as the target bitmap and draw:
</p><div class="source-code snippet"><div class="inner"><pre><a href="http://www.allegro.cc/manual/al_set_target_bitmap"><span class="a">al_set_target_bitmap</span></a><span class="k2">(</span>bmp<span class="k2">)</span><span class="k2">;</span>
<a href="http://www.allegro.cc/manual/al_put_pixel"><span class="a">al_put_pixel</span></a><span class="k2">(</span>x,y,c<span class="k2">)</span><span class="k2">;</span>
<a href="http://www.allegro.cc/manual/al_set_target_bitmap"><span class="a">al_set_target_bitmap</span></a><span class="k2">(</span><a href="http://www.allegro.cc/manual/al_get_backbuffer"><span class="a">al_get_backbuffer</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>

If you only need to change a single pixel, this is probably faster than locking.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (jmasterx)</author>
		<pubDate>Wed, 29 Jan 2014 06:06:44 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
If I call in main each frame al_set_target_bitmap(al_get_backbuffer(Display));</p><p>Will this slow down my program a lot ? I would need to pass Display as parameter of the method that I&#39;m using since its part of a separate class. If so ill do it if necessary. </p><p>I&#39;m having some weird problem sometimes when I use put pixel nothing shows up when I use draw line and do x , y, x +1 , y +1 for the starting and end point it draws a dot.</p><p>Also I have 2 bitmaps 1 &#39;locked&#39; READONLY for calculations etc. Second for drawing which I am trying to update. Yet when I set &#39;locked&#39; one as target it works as well even if all im calling in the main loop is al_draw_bitmap(image);</p><p>What I&#39;m looking for is the fastest possible way to edit pixels in the bitmap as I&#39;m trying to update a lot of them.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Alon3k)</author>
		<pubDate>Wed, 29 Jan 2014 08:42:57 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>If you have a lot of pixels to update then you want to lock the bitmap, or the smallest region that all the pixels you want to update fits inside, and then use direct memory access or al_put_pixel.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Wed, 29 Jan 2014 10:50:52 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Could you give me example how to use direct memory access ?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Alon3k)</author>
		<pubDate>Wed, 29 Jan 2014 15:25:47 +0000</pubDate>
	</item>
</rss>
