RbImage Routines


The RbImage Routines implement the image conversion necessary to turn all incoming images into the B&W PNG files that the ReB requires. It is also possible to compile the rbmake library without any image-processing support, in which case no images may be included in books created by the library.

If you are unsure if image support is present in the library, call the function rbLibHasImageSupport(). It will return "false" if no image support is available.

If you want to be able to manipulate the images after they have been parsed into an internal memory format, you can call RbImage_init() with a pointer to a RbImageFunc callback function. The callback will receive a pointer to the RbImage structure, and a pointer to the image's URL (in case you want to process some names in a different manner). If you don't want to do anything to the images as they are processed, you can call RbImage_init() with "NULL".

The RbImage_turnMBufIntoPngMBuf() function takes image data from the indicated MBuf object, turns it into a B&W PNG image, and replaces the data in the supplied MBuf object with the result. This function also calls the user-supplied callback function, if it is defined. Normally you'd just let this function get called automatically by the RbFetch and RbMake procedures.

The RbImage_toGray() routine transforms an RbImage object into grayscale format. It is safe to call this even if the image is already grayscale or B&W. The only time you might need to call this is if you're manipulating an image in your callback routine.

The RbImage_toMono() routine transforms an RbImage object into monochrome format. You can safely call this routine with any type of image object. The only time you might need to call this is if you're manipulating an image in your callback routine.

The RbImage_resize() routine makes an RbImage object smaller or larger. The width and height are a bounding box in which the image is fit. This function is used internally when you specify a cover image (since the cover image is sized to fit the full screen). If you have specified a callback routine, the cover image that is passed to you will have already been resized, as needed.

The RbImage_enhanceGray() routine does an edge-enhancement to the indicated RbImage object. If the image is not already grayscale, it will be transformed into grayscale using RbImage_toGray().

The RbImage_rotate() routine turns an image 90 degrees clockwise. This is sometimes useful to make an image fit better on the ReB's screen. This routine is not used internally, but you can call it from your callback routine as you see fit.