Regretfully, I am no longer actively developing BeOS software. If anyone is interested in obtaining rights to the source code for any of my BeOS programs, contact me. The BeOS pages on this site are archival in nature.


Skeeter Dropped Image Format

This describes a simple BMessage format which is used to drag and drop images from the preview area of the Skeeter scanning utility. I was surprised that none of the existing image editing applications supported a BBitmap dragged image format, so I made one up which is simple to implement. I'm not really tied or commited to this until a bunch of people have implemented it, so if someone comes up with something better I'd be willing to take a look. The RRaster format looked fine, but I thought this would be better, to take advantage of the encapsulation inherent in an archived BMessage.

The following is included in the header file DraggedImage.h in the Skeeter distribution:

    // Constants for a simple BMessage format for an image being dragged.
    // When you see a dropped DRAGGED_IMAGE_MESSAGE message, you can recover
    // check the color space, width, and height of the message, and if it's
    // to your liking call BBitmap::Instantiate() to recover the BBitmap.

    #define DRAGGED_IMAGE_MESSAGE       'Idrg'
    #define kDraggedImageColorSpace     "color_space"   // B_INT32_TYPE
    #define kDraggedImageWidth          "width"         // B_INT32_TYPE
    #define kDraggedImageHeight         "height"        // B_INT32_TYPE

The method for unpacking the bitmap is trivial. In the MessageReceived() function of your view receiving the drop, you add this code (adding appropriate error checking, of course):

    switch( msg->what ) {
      .
      .
      .
    case DRAGGED_IMAGE_MESSAGE:
        if( msg->WasDropped() ) {
            int32 space, width, height;
            msg->FindInt32( kDraggedImageColorSpace, &space );
            msg->FindInt32( kDraggedImageWidth, &width );
            msg->FindInt32( kDraggedImageHeight, &height);
            // check if they're what you want
            if( check_bitmap_values( space, width, height ) ) {
                BBitmap *bits = BBitmap::Instantiate( msg );
                if( bits )
                    do_stuff_with_bitmap( bits );
            }
        }
        break;
      .
      .
      .
    }

Go to Jim Moy's home page, BeOS page, or BeOS Scanner page