Thanks Callum, I've had a look over the code - it's probably a little bit more involved than what I would want to do initially, but is certainly on the right path :) One thing I did notice, for some reason the resulting images files from the screen capture program seem to get the alpha channel wrong, at least for anything that is not an image. I dumped some pages such as slashdot.org and the only thing visible was the advertising image.. After replacing every occurance of byte 0x00 with 0xFF, the page is visible (but obviously the colours are a mess). I don't know if that is an issue with Paint.NET or the pixel format Gecko utilises. Anyway, it certainly proves the most important thing - I definitely CAN use gecko to render text (or an entire web page) without requiring a visible window (or, presumably Windows / X at all).
On Nov 22, 10:18 am, Peter Weilbacher <[EMAIL PROTECTED]> wrote: > On 20.11.2007 15:19, [EMAIL PROTECTED] wrote: > > > This may be a little bit naive - I've only just started looking at > > Gecko today - but I cannot see an obvious way to retrieve a page > > rendered in Gecko into a device-independent memory buffer, e.g. as a > > bitmap. To cut a long story short, I'm interested in using Gecko to > > render some HTML, without actually displaying the HTML in a browser > > window (or any window for that matter!) but instead saving the > > rendered information away to some sort of image. > > I'm really no expert on this, but as nobody else told you this, I will: > Gecko 1.9 will use cairo for rendering and cairo supports several > different surface types (including PDF and PNG as output) you could > in principle render directly to one of those surfaces. > > I know that at least on Linux and Windows the PDF surface can be used > to print to file. If you search for "gfxPDF" on > http://mxr.mozilla.org/seamonkey/ > this might give you a hints. I don't see why this shouldn't be possible > with a PNG surface. Of course then you have to create a build that > actually compiles in the the code to create a PNG surface. > > > Assuming this is possible (lets be honest, it's probably not exactly > > what Gecko was designed for), is this something that is likely to be > > do-able in a reasonably cross-platform sense? Or am I likely to be > > dealing with HDCs on Windows and some form of GTK object, or lower > > level primitive under Linux? > > As those surfaces are all platform independent in cairo anything that > you invent should work for all platforms. > > Peter. Peter, I have been looking at Gecko 1.9 and functionality such as DumpToPNG in the Seamonkey source - also very promising. I think I've come to the conclusion that Gecko is perfect, if a little bit of over- kill for what I need to do, but will require some serious effort to utilise (due to an apparent lack of "overview" documentation, and the fact that I'm trying to do something with it that deviates reasonably far from, say, what a web-browser does with it). Thanks again, James _______________________________________________ dev-tech-layout mailing list [email protected] https://lists.mozilla.org/listinfo/dev-tech-layout

