<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>'Coding 2D graphics in C, to be portable' Thread RSS Feed</title>
    <link>http://www.programmersheaven.com/</link>
    <description>Contains the latest posts from the thread 'Coding 2D graphics in C, to be portable' posted on the 'Computer Graphics' forum at Programmer's Heaven.</description>
    <language>en</language>
    <copyright>Copyright 2013 Programmers Heaven</copyright>
    <pubDate>Tue, 18 Jun 2013 23:18:00 -0700</pubDate>
    <lastBuildDate>Tue, 18 Jun 2013 23:18:00 -0700</lastBuildDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <image>
      <url>http://www.programmersheaven.com/images/ph.gif</url>
      <title>Programmers Heaven</title>
      <link>http://www.programmersheaven.com/</link>
      <width>88</width>
      <height>31</height>
    </image>
    <item>
      <title>Coding 2D graphics in C, to be portable</title>
      <link>http://www.programmersheaven.com/mb/graphics/392968/392968/coding-2d-graphics-in-c-to-be-portable/</link>
      <description>Hello all,&lt;br /&gt;
&lt;br /&gt;
     Well, this is my first post in Programmer's Heaven.  &lt;br /&gt;
Recently, I began developing my own programming library, written in C.  When I got to the graphics, I became stumped, because I want the library to be portable, on both OS, and hardware.  Every way I think of creating graphics, a different architecture or software platform is excluded.  For example, if I used the Windows API, only windows, or possibly Wine can run it; if I use assembler, only one architecture can run it, and I REALLY don't want to re-write the assembly routines for multiple architectures (don't think I could do it for many at all =]...).  Any ideas?</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/graphics/392968/392968/coding-2d-graphics-in-c-to-be-portable/</guid>
      <pubDate>Sun, 28 Jun 2009 11:14:55 -0700</pubDate>
      <category>Computer Graphics</category>
    </item>
    <item>
      <title>Re: Coding 2D graphics in C, to be portable</title>
      <link>http://www.programmersheaven.com/mb/graphics/392968/392975/re-coding-2d-graphics-in-c-to-be-portable/#392975</link>
      <description>Hi and welcome!&lt;br /&gt;
&lt;br /&gt;
I'm not exactly sure what you might need, but you're probably looking for something like SDL or OpenGL:&lt;br /&gt;
&lt;a href="http://www.libsdl.org/"&gt;http://www.libsdl.org/&lt;/a&gt;&lt;br /&gt;
&lt;a href="http://en.wikipedia.org/wiki/OpenGL"&gt;http://en.wikipedia.org/wiki/OpenGL&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
I wonder why you would want to make your own library for this. It's great for learning, but not very practical when other libraries already exist that do a great job at it. I also don't think it's sensible to make a library that does everything (at least not all by yourself). That would be reinventing the wheel. Not to discourage or anything, just wondering :)</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/graphics/392968/392975/re-coding-2d-graphics-in-c-to-be-portable/#392975</guid>
      <pubDate>Sun, 28 Jun 2009 16:23:32 -0700</pubDate>
      <category>Computer Graphics</category>
    </item>
    <item>
      <title>Re: Coding 2D graphics in C, to be portable</title>
      <link>http://www.programmersheaven.com/mb/graphics/392968/392976/re-coding-2d-graphics-in-c-to-be-portable/#392976</link>
      <description>Duplicate post deleted.</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/graphics/392968/392976/re-coding-2d-graphics-in-c-to-be-portable/#392976</guid>
      <pubDate>Sun, 28 Jun 2009 16:23:34 -0700</pubDate>
      <category>Computer Graphics</category>
    </item>
    <item>
      <title>Re: Coding 2D graphics in C, to be portable</title>
      <link>http://www.programmersheaven.com/mb/graphics/392968/392989/re-coding-2d-graphics-in-c-to-be-portable/#392989</link>
      <description>No, I totally get it, making a library.  My only intentions were to be educational; I was never planning on distributing it (or possibly finising it  =]).  Anyway, I could never even dream of making a library as good as OpenGL, or others.  =]   Thanks!&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/graphics/392968/392989/re-coding-2d-graphics-in-c-to-be-portable/#392989</guid>
      <pubDate>Mon, 29 Jun 2009 02:50:28 -0700</pubDate>
      <category>Computer Graphics</category>
    </item>
    <item>
      <title>Re: Coding 2D graphics in C, to be portable</title>
      <link>http://www.programmersheaven.com/mb/graphics/392968/394320/re-coding-2d-graphics-in-c-to-be-portable/#394320</link>
      <description>Write all your functions so they take a graphics context as the first argument.&lt;br /&gt;
&lt;br /&gt;
The graphics context should contain the members&lt;br /&gt;
&lt;br /&gt;
int width;&lt;br /&gt;
int height;&lt;br /&gt;
&lt;br /&gt;
long (*getpixel)(int x, int y, void *ptr);&lt;br /&gt;
void (*putpixel)(int x, int y, long color, void *ptr);&lt;br /&gt;
void *ptr;&lt;br /&gt;
&lt;br /&gt;
width and height are self-explantory. getpixel and putpixel anre fuunction pointers which read and write single pixels to the screen. ptr is a general-purpose hook so the functions don't have to rely on global data.&lt;br /&gt;
&lt;br /&gt;
These days you can pretty much guarantee truecolour graphics. However you'll have to add extra members if you wish to support paletted images nicely.&lt;br /&gt;
&lt;br /&gt;
Using this abstraction layer, all your algorithms can work perfectly portably.&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/graphics/392968/394320/re-coding-2d-graphics-in-c-to-be-portable/#394320</guid>
      <pubDate>Tue, 28 Jul 2009 08:40:40 -0700</pubDate>
      <category>Computer Graphics</category>
    </item>
    <item>
      <title>This post has been deleted.</title>
      <link>http://www.programmersheaven.com/mb/graphics/392968/409882/this-post-has-been-deleted/#409882</link>
      <description>This post has been deleted.</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/graphics/392968/409882/this-post-has-been-deleted/#409882</guid>
      <pubDate>Wed, 25 Nov 2009 23:22:52 -0700</pubDate>
      <category>Computer Graphics</category>
    </item>
  </channel>
</rss>