Archive for the 'C' Category

08/30 fPic Beta

I have released a beta of fPic – on the RB-NUG and [unofficial] RB/FR lists and on RB Garage. Some feedback already from the French side of the programmosphere – despite the language barrier, as the docs are in English. We’ll see. I am to hand over an article – like three months late – that will tie in nicely, as it is the second part of Pictures and Dynamic Libraries: a poor man’s plugin, which introduces the basics of fPics. The second part will delve deeper in the mechanics of linking C code and RB code in an OOP fashion – hopefully.

From the docs:

fPic is a two-part project aiming at providing a replacement Picture class for command-line applications [which notoriously lack any graphic capabilities]. I say two-part because it is split into a dynamic library [manip.dylib] and an RB class, fPic. The dylib handles the heavy-lifting, while the fPic class provides a [more or less] seamless way for RB programmers to manipulate images in CLI applications. I hope to be able, in the end, to produce a library that will have zero dependencies, or at least zero exotic ones (like things usually installed via Fink), but for the moment, some things are necessary, as doing without them would either cripple fPic, or make it too hard to build from the get-go.

And of course, this is a Mac OS X only library. I am planning to make a Linux version, some day, when the Mac version is stabilized. The Linux version, however, would have fewer functionalities, as I can’t use the Accelerate [FreeRotate, ContrastStretch and Equalize] and CoreGraphics [PDF files] frameworks there.

I have provided a few sample programmes, which show some of the things that can be done:

* fPicTester
fPicTester showcases some of the capabilities of fPic. It requires the images included in the distribution folder. The resulting image, Result,jpg, is opened in Preview.

* jpeger
jpeger is a small utility that takes a file image, a destination folder or filename, and some options, and converts the source image to a JPEG image. On success, if only one page was converted [in the case of PDF files, you may request one or more pages], the converted JPEG is opened in Preview.

* OnDemandPDF
This is a combination of a command-line app and some PHP. Put this folder inside ~/Sites/ so that it is accessible from your localhost [you’ll need Apache and PHP up and running of course]. Put some PDFs inside the docs subfolder, and access it from your favourite browser:

http://localhost/~yourNick/OnDemandPDF/
Click on one of the links, to view a document, and read it “online”.

This is a very early beta version, although I do use it myself in a couple of projects, so far without major problems. There are issues yet to be solved, see the docs included in the distribution, and feedback would be appreciated.

You can get the current beta here

06/22 Playing with sqlite3

I am playing with SQLite3, which is now the default db engine in RB 2005, thanks to the good work of SQLabs. Of course, sqlite hasn’t been retrofitted to RB 5.5, so I am trying to see what it would take to make a poor man’s sqlite solution for RB 5.5. The problem is integrating C structures into RB, which is not always easy. I am obliged to cheat a little, but I managed to do a SELECT command on an existing sqlite database and display the results correctly. So far so good… :-)

06/06 Histoto le héros

Basic histogram

Arguably of little worth for the moment, but still: fp.Histogram(values(),colours()) gets you that. Under 0.4 second, too. The rest you can hack, I s’pose, mmm’kay?

06/06 Collateral damage

To my knowledge, Apple has never warned Mac developers against assuming their code will be running on a big-endian architecture; switching to the little-endian x86 would be extremely irritating for any developer with a code base that makes assumptions about byte order. Sure, most Mac software probably doesn’t need to deal with byte order directly; but for those apps that do, there will be significant drudgery involved.
Daring Fireball

/me looks at fPic code…

Oops… Damn you Mr Gruber. I didn’t need to realize *that* on a Sunday! :-)

05/30 Partial PNG support!

I have partial PNG support in fPic (since I am writing the code from scratch, I still consider this as a success :-) ). 8-bit PNGs with a colour palette seem to be the easiest to process. At least, without interlacing. *That* is going to be interesting… Adam7 me arse, right…