<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: fgimage code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Sun, 18 May 2008 00:21:17 GMT</pubDate>
    <description>DZone Snippets: fgimage code</description>
    <item>
      <title>Showing message on status bar</title>
      <link>http://snippets.dzone.com/posts/show/1642</link>
      <description>There's an empty space below app.title that we can&lt;br /&gt;use as a status bar. So, I modify this &lt;a href=http://bigbold.com/snippets/posts/show/839&gt;recipe&lt;/a&gt; and &lt;br /&gt;make it into a module. (need fgimage.pyd from &lt;a href=http://pymbian.sourceforge.net/misc/fgimage-v0.20051022.zip&gt;here&lt;/a&gt;)&lt;br /&gt;&lt;code&gt;&lt;br /&gt;# status.py&lt;br /&gt;from graphics import *&lt;br /&gt;import fgimage&lt;br /&gt;__all__ = ["status_on", "status_off"]&lt;br /&gt;&lt;br /&gt;bar = Image.new((119,13))&lt;br /&gt;bgcolor = screenshot().getpixel((0,0))[0]&lt;br /&gt;fg = fgimage.FGImage()&lt;br /&gt;&lt;br /&gt;def status_on(message=None):&lt;br /&gt;    if message is not None:&lt;br /&gt;        bar.clear(bgcolor)&lt;br /&gt;        bar.text((0,11), unicode(message), 0xffffff)&lt;br /&gt;    fg.set(57,30, bar._bitmapapi())&lt;br /&gt;&lt;br /&gt;def status_off():&lt;br /&gt;    fg.unset()&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;You can use it easily this way&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&gt;&gt;&gt; from status import *&lt;br /&gt;&gt;&gt;&gt; status_on('Hello world')  # show it&lt;br /&gt;&gt;&gt;&gt; status_off()              # hide it&lt;br /&gt;&gt;&gt;&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;See a &lt;a href=http://www.frappr.com/pys60/photo/1501182&gt;screenshot&lt;/a&gt;.</description>
      <pubDate>Mon, 06 Mar 2006 20:58:42 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1642</guid>
      <author>korakot (Korakot Chaovavanich)</author>
    </item>
    <item>
      <title>Using foreground image</title>
      <link>http://snippets.dzone.com/posts/show/839</link>
      <description>You can draw directly to the phone screen.&lt;br /&gt;It is useful for a notification from a background program.&lt;br /&gt;You need to install fgimage.pyd from &lt;a href=http://pymbian.sourceforge.net/misc/fgimage-v0.20051022.zip&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;import fgimage, e32&lt;br /&gt;&lt;br /&gt;img = Image.new((100, 16))  # create a notification text&lt;br /&gt;img.text((0, 14), u'Hello world', 0)&lt;br /&gt;&lt;br /&gt;fg = fgimage.FGImage()&lt;br /&gt;x, y = 0, 40           # position to draw&lt;br /&gt;fg.set(x, y, img._bitmapapi())  # send it&lt;br /&gt;&lt;br /&gt;e32.ao_sleep(1)&lt;br /&gt;fg.unset()                # then clear it&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;See (a bit) more discussion &lt;a href=http://discussion.forum.nokia.com/forum/showthread.php?t=68866&gt;here&lt;/a&gt;.</description>
      <pubDate>Mon, 31 Oct 2005 00:26:37 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/839</guid>
      <author>korakot (Korakot Chaovavanich)</author>
    </item>
  </channel>
</rss>
