René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback -
 

Bitmap [Ming wrapper class]

The source

Bitmap.h
#ifndef bitmaP_H
#define bitmaP_H

#include <string>

#include "ming.h"

class Bitmap {
  friend class Shape;
  public:
    /* NOTE!!!! Although Bitmap indicates that .bmp's could be used,
                this is not the case. .jpg's work, though */
    Bitmap(std::string const& filename);

    int Width ();
    int Height();

  private:
    SWFBitmap bitmap_;
};

#endif
Bitmap.cpp
#include <iostream>
#include <stdio.h>

#include "Bitmap.h"

Bitmap::Bitmap(std::string const& filename) {
  FILE* f        = fopen(filename.c_str(), "rb");
  SWFInput input = newSWFInput_file(f);
  bitmap_        = newSWFBitmap_fromInput(input);
}

int Bitmap::Width () {
  return SWFBitmap_getWidth(bitmap_);
}

int Bitmap::Height() {
  return SWFBitmap_getHeight(bitmap_);
}

Examples

The following examples demonstrate this class: