POV-Ray : Newsgroups : povray.off-topic : Low-level fun : Re: Low-level fun Server Time
29 Sep 2024 03:18:10 EDT (-0400)
  Re: Low-level fun  
From: Invisible
Date: 21 Sep 2009 08:50:46
Message: <4ab776a6$1@news.povray.org>
>> So now I'm wondering if Windows provides any easy way to load and save 
>> bitmapped images. GDI appears to allow you to load and save in Windows 
>> Bitmap format - arguably amoung the worst file formats *ever*. But 
>> what about something more sane?
> 
> Are you using .NET or VB6?

Nope. I'm using Haskell, everybody's favourit programming language.

Of course, you *can* quite easily load and save PNG or JPEG from 
Haskell. If you have GTK+ installed. No problem on Linux, but kinda 
unusual for Windoze. Oh, it *works* just fine. But it means anybody who 
wants to run your program needs GTK+ installed. Actually, not even 
installed, just the DLLs really. But there's about 20MB of them!

There's also a binding to something called "GD" which is supposed to do 
something similar.

I suppose the ultimate answer would be to write a native Haskell PNG 
codec. Then it will run everywhere Haskell does.



Looks like figuring out this COM stuff might also conceivably work... I 
guess we'll see, assuming anybody ever gets back to me about how to make 
the library compile.



Aside: The Haskell GTK+ binding has full support for both bitmapped 
graphics and vector graphics. Vector drawing uses Cairo, and is really 
delightfully easy to use. It can render to the screen, to memory, or to 
a file in one of several formats (PNG / JPEG / SVG / PDF / PS).

The bitmapped graphics... involves manipulating the low-level bitmap 
manually, all by yourself. This is *not* my idea of a fun time. Also, it 
took about a week of wading through the API to figure out how to work it.

In other words, vector graphics is very easy, bitmapped graphics is 
quite hard. So I wrote a library to make it easy. Now you can easily 
load and save bitmaps, and read or write pixels in them. One of my 
better achievements. But, as I say, you have to have GTK+ for it to work...


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.