Skip to content

Oscar Software Framework Manual Bitmap Module

scs edited this page Jul 13, 2012 · 2 revisions

Table of Contents

Bitmap Module (bmp)

Description

The bitmap module provides functions to read and write uncompressed bitmap (.bmp) images from the file system. Supported are 24 bit BGR as well as greyscale images.

Target Hardware Resource

None.

Dependencies

None.

Usage

Following code segment demonstrates the usage of the bmp module. For the sake of simplicity, error checking as well as framework creation and destruction are neglected.

 memset(&pic, 0, sizeof(struct OSC_PICTURE);
 OscBmpRead(&pic, "example.bmp"); /* (1) */
 
 /************** Modify image ********************/
 DoFFT(pic.data, pic.width, pic.height); /* (2) */
 /************************************************/
 
 pic.width = 752;
 pic.height = 480;
 pic.type = OSC_PICTURE_GREYSCALE;
 OscBmpWrite(&pic, "example_modified.bmp"); /* (3) */
  1. Read in an image from a bitmap file. If the OSC_PICTURE structure is empty, the members will be filled and memory for the image will be allocated automatically. Otherwise, checks will be made if the image with the given file name matches the expected size and type.
  2. Modify and use the image data.
  3. Fill out the OSC_PICTURE structure and write the modified image to a new file name.
Clone this wiki locally