This reference page is linked to from the following overview topics: Resolution / Palettes / Pixel Storage Topics, Dithering and Filtering, Aspect Ratio, Bitmap Gamma Overview, Gamma Preferences, SDK Changes for Automatic Gamma Correction, Accessing Material Properties, Principal Bitmap Classes, Creating Bitmaps, Loading Bitmaps, Saving Bitmaps, Multi-frame Files, Memory Management for Plug-ins that Work with Bitmaps, Implementing Simple Material and Texture Map Plug-ins with Nitrous.
#include <bitmap.h>
Class for image input and output.
BitmapInfo bi;
bi.SetName("file.tga");
BitmapManager::SelectFileOutput( ... &bi ...)
Bitmap* map = BitmapManager::Create(&bi);
map->Fill({0,0,0});
map->OpenOutput(&bi); map->Write(&bi); map->Close(&bi); map->DeleteThis();
BitmapInfo bi;
bi.SetName(_T("E:\Renders\file.tga"));
BitmapManager::SelectFileOutput( ... &bi ...);
bi.SetWidth(x) bi.SetHeight(y) bi.SetFirstFrame(0) bi.SetLastFrame(29) etc...
Bitmap* map = BitmapManager::Create(&bi);
map->OpenOutput(&bi); for (int x = 0; x < 29; x++) { ## Do something to image... map->Write(&bi,x); } map->Close(&bi); map->DeleteThis();
Public Member Functions |
|
BitmapManager * | Manager () |
BMMExport int | Create (BitmapInfo *bi) |
BMMExport BOOL | FixDeviceName (BitmapInfo *bi) |
int | MapReady () |
BMMExport void | AddOutput (BitmapIO *out) |
BMMExport void | RemoveOutput (BitmapIO *out, BOOL deleteOutput=TRUE) |
BMMExport BitmapIO * | FindOutput (BitmapInfo *bi) |
BMMExport PAVIFILE | GetPaviFile (BitmapInfo *bi) |
void * | GetVFBData () |
void | SetVFBData (void *vfb) |
BMMExport void | DeleteThis () |
DWORD | Flags () |
void | SetFlag (DWORD flag) |
void | ToggleFlag (DWORD flag) |
void | ClearFlag (DWORD flag) |
int | Width () |
int | Height () |
float | Aspect () |
float | Gamma () |
int | Paletted () |
int | IsDithered () |
int | PreMultipliedAlpha () |
int | HasAlpha () |
int | IsHighDynamicRange () |
int | MaxRGBLevel () |
int | MaxAlphaLevel () |
void | UseScaleColors (int on) |
int | ScaleColors () |
void | ClampScaleColor (BMM_Color_64 &out, const BMM_Color_fl &in) |
void | ClampScaleColorA (BMM_Color_64 &out, const BMM_Color_fl &in) |
int | Put16Gray (int x, int y, int pixels, WORD *ptr) |
int | Put16Gray (int x, int y, int pixels, float *ptr) |
void * | GetStoragePtr (int *type) |
void * | GetAlphaPtr (int *type) |
int | Get16Gray (int x, int y, int pixels, WORD *ptr) |
int | Get16Gray (int x, int y, int pixels, float *ptr) |
int | GetPixels (int x, int y, int pixels, BMM_Color_64 *ptr) |
int | GetPixels (int x, int y, int pixels, BMM_Color_fl *ptr) |
BMMExport int | PutPixels (int x, int y, int pixels, BMM_Color_64 *ptr) |
BMMExport int | PutPixels (int x, int y, int pixels, BMM_Color_fl *ptr) |
int | GetLinearPixels (int x, int y, int pixels, BMM_Color_64 *ptr) |
int | GetLinearPixels (int x, int y, int pixels, BMM_Color_fl *ptr) |
int | GetIndexPixels (int x, int y, int pixels, BYTE *ptr) |
int | PutIndexPixels (int x, int y, int pixels, BYTE *ptr) |
int | CropImage (int width, int height, BMM_Color_64 fillcolor) |
int | CropImage (int width, int height, BMM_Color_fl fillcolor) |
int | CropImage (int width, int height, int fillindex) |
int | ResizeImage (int width, int height, int newpalette) |
int | CopyImage (Bitmap *from, int operation, BMM_Color_64 fillcolor, BitmapInfo *bi=NULL) |
int | CopyImage (Bitmap *from, int operation, BMM_Color_fl fillcolor, BitmapInfo *bi=NULL) |
int | CopyImage (Bitmap *from, int operation, int fillindex) |
int | GetPalette (int start, int count, BMM_Color_48 *ptr) |
int | SetPalette (int start, int count, BMM_Color_48 *ptr) |
BMMExport void | FilmGrain (float grain, BOOL mask, PBITMAP_FX_CALLBACK callback=NULL, void *param=NULL) |
void * | GetChannel (ULONG channelID, ULONG &chanType) |
GBuffer * | GetGBuffer () |
ULONG | CreateChannels (ULONG channelIDs) |
void | DeleteChannels (ULONG channelIDs) |
ULONG | ChannelsPresent () |
RenderInfo * | GetRenderInfo () |
RenderInfo * | AllocRenderInfo () |
BMMExport BOOL | PrepareGChannels (BitmapInfo *bi) |
BMMExport BOOL | PrepareGChannels (DWORD channels) |
BMMExport int | GetFiltered (float u, float v, float du, float dv, BMM_Color_64 *ptr) |
BMMExport int | GetFiltered (float u, float v, float du, float dv, BMM_Color_fl *ptr) |
BMMExport int | SetDither (UINT ditherType) |
BMMExport int | SetFilter (UINT filterType) |
int | HasFilter () |
BitmapFilter * | Filter () |
BMMExport int | SetStorage (BitmapStorage *storage) |
BitmapStorage * | Storage () |
void | NullStorage () |
BMMExport PBITMAPINFO | ToDib (int depth=24, UWORD *gam=NULL, BOOL dither=FALSE, BOOL displayGamma=FALSE) |
BMMExport BOOL | FromDib (PBITMAPINFO pbmi) |
BMMExport BMMRES | OpenOutput (BitmapInfo *bi) |
Opens the image for output. |
|
BMMExport BMMRES | Write (BitmapInfo *bi, int frame=BMM_SINGLEFRAME) |
Write the image from BitmapStorage to disk. |
|
BMMExport BMMRES | WriteAll (int frame=BMM_SINGLEFRAME) |
BMMExport int | Close (BitmapInfo *bi, int flag=BMM_CLOSE_COMPLETE) |
BMMExport int | CloseAll (int flag=BMM_CLOSE_COMPLETE) |
BMMExport int | Display (const MCHAR *title=NULL, int position=BMM_CN, BOOL autonomous=FALSE, BOOL savebutton=TRUE, CropCallback *crop=NULL, Bitmap *cloneMyVFB=NULL) |
BMMExport int | UnDisplay () |
BMMExport HWND | GetWindow () |
BMMExport void | RefreshWindow (RECT *rect=NULL) |
BMMExport void | SetWindowTitle (const MCHAR *title) |
BMMExport void | SetCroppingValues (float u, float v, float w, float h, BOOL placeImage) |
BMMExport BMMRES | GoTo (BitmapInfo *bi) |
BMMExport int | Fill (int r, int g, int b, int alpha) |
BMMExport int | Fill (const BMM_Color_fl &fillColor) |
BMMExport int | Fill (const BMM_Color_64 &fillColor) |
BMMExport void | SetNotify (BitmapNotify *bmnot=NULL) |
BitmapNotify * | GetNotify () |
BMMExport BOOL | IsAutonomousVFB () |
BMMExport INT_PTR | Execute (int cmd, ULONG_PTR arg1=0, ULONG_PTR arg2=0, ULONG_PTR arg3=0) |
DWORD | GetModifyID () |
void | SetModifyID (DWORD m) |
BMMExport void | IncrModifyID () |
BMMExport void | Print (bool silent=false) |
BMMExport void | ShowProgressLine (int y) |
Static Public Member Functions |
|
static void | ClampColor (BMM_Color_64 &out, const BMM_Color_fl &in) |
static void | ClampColorA (BMM_Color_64 &out, const BMM_Color_fl &in) |
static void | ScaleColor (BMM_Color_64 &out, const BMM_Color_fl &in) |
static void | ScaleColorA (BMM_Color_64 &out, const BMM_Color_fl &in) |
Friends |
|
class | BitmapManagerImp |
LRESULT CALLBACK | InputWndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) |
BitmapManager* Manager | ( | ) | [inline] |
{ return manager; };
BMMExport int Create | ( | BitmapInfo * | bi | ) |
BMMExport BOOL FixDeviceName | ( | BitmapInfo * | bi | ) |
int MapReady | ( | ) | [inline] |
{ if (storage) return storage->MapReady(); return 0; };
BMMExport void AddOutput | ( | BitmapIO * | out | ) |
BMMExport void RemoveOutput | ( | BitmapIO * | out, |
BOOL | deleteOutput =
TRUE |
||
) |
BMMExport BitmapIO* FindOutput | ( | BitmapInfo * | bi | ) |
BMMExport PAVIFILE GetPaviFile | ( | BitmapInfo * | bi | ) |
void* GetVFBData | ( | ) | [inline] |
{ return vfbData; }
void SetVFBData | ( | void * | vfb | ) | [inline] |
{ vfbData = vfb; }
BMMExport void DeleteThis | ( | ) |
DWORD Flags | ( | ) | [inline] |
{ return flags; };
void SetFlag | ( | DWORD | flag | ) | [inline] |
{ flags |= flag; };
void ToggleFlag | ( | DWORD | flag | ) | [inline] |
{ flags ^= flag; };
void ClearFlag | ( | DWORD | flag | ) | [inline] |
{ flags &= (~flag); };
int Width | ( | ) | [inline] |
{ if (storage) return storage->Width(); return 0; };
int Height | ( | ) | [inline] |
{ if (storage) return storage->Height(); return 0; };
float Aspect | ( | ) | [inline] |
{ if (storage) return storage->Aspect(); return (float)0.0; };
float Gamma | ( | ) | [inline] |
{ if (storage) return storage->Gamma(); return (float)0.0; };
int Paletted | ( | ) | [inline] |
{ if (storage) return storage->Paletted(); return 0; };
int IsDithered | ( | ) | [inline] |
{ if (storage) return storage->IsDithered(); return 0; };
int PreMultipliedAlpha | ( | ) | [inline] |
{ if (storage) return storage->PreMultipliedAlpha(); return 0; };
int HasAlpha | ( | ) | [inline] |
{ if (storage) return storage->HasAlpha(); return 0; };
int IsHighDynamicRange | ( | ) | [inline] |
{ if (storage) return storage->IsHighDynamicRange(); return 0; };
int MaxRGBLevel | ( | ) | [inline] |
{ if (storage) return storage->MaxRGBLevel(); return 0; };
int MaxAlphaLevel | ( | ) | [inline] |
{ if (storage) return storage->MaxAlphaLevel(); return 0; };
void UseScaleColors | ( | int | on | ) | [inline] |
{ if (storage) storage->UseScaleColors(on); };
int ScaleColors | ( | ) | [inline] |
{ if (storage) return storage->ScaleColors(); return 0; };
static void ClampColor | ( | BMM_Color_64 & | out, |
const BMM_Color_fl & | in | ||
) | [inline, static] |
{ BitmapStorage::ClampColor(out, in); }
static void ClampColorA | ( | BMM_Color_64 & | out, |
const BMM_Color_fl & | in | ||
) | [inline, static] |
{ BitmapStorage::ClampColorA(out, in); }
static void ScaleColor | ( | BMM_Color_64 & | out, |
const BMM_Color_fl & | in | ||
) | [inline, static] |
{ BitmapStorage::ScaleColor(out, in);}
static void ScaleColorA | ( | BMM_Color_64 & | out, |
const BMM_Color_fl & | in | ||
) | [inline, static] |
{ BitmapStorage::ScaleColorA(out, in);}
void ClampScaleColor | ( | BMM_Color_64 & | out, |
const BMM_Color_fl & | in | ||
) | [inline] |
{ if (storage) storage->ClampScaleColor(out, in); else ClampColor(out, in); }
void ClampScaleColorA | ( | BMM_Color_64 & | out, |
const BMM_Color_fl & | in | ||
) | [inline] |
{ if (storage) storage->ClampScaleColorA(out, in); else ClampColorA(out, in); }
int Put16Gray | ( | int | x, |
int | y, | ||
int | pixels, | ||
WORD * | ptr | ||
) | [inline] |
int Put16Gray | ( | int | x, |
int | y, | ||
int | pixels, | ||
float * | ptr | ||
) | [inline] |
void* GetStoragePtr | ( | int * | type | ) | [inline] |
{ if (storage) return storage->GetStoragePtr(type); return NULL; };
void* GetAlphaPtr | ( | int * | type | ) | [inline] |
{ if (storage) return storage->GetAlphaPtr(type); return NULL; };
int Get16Gray | ( | int | x, |
int | y, | ||
int | pixels, | ||
WORD * | ptr | ||
) | [inline] |
int Get16Gray | ( | int | x, |
int | y, | ||
int | pixels, | ||
float * | ptr | ||
) | [inline] |
int GetPixels | ( | int | x, |
int | y, | ||
int | pixels, | ||
BMM_Color_64 * | ptr | ||
) | [inline] |
int GetPixels | ( | int | x, |
int | y, | ||
int | pixels, | ||
BMM_Color_fl * | ptr | ||
) | [inline] |
BMMExport int PutPixels | ( | int | x, |
int | y, | ||
int | pixels, | ||
BMM_Color_64 * | ptr | ||
) |
BMMExport int PutPixels | ( | int | x, |
int | y, | ||
int | pixels, | ||
BMM_Color_fl * | ptr | ||
) |
int GetLinearPixels | ( | int | x, |
int | y, | ||
int | pixels, | ||
BMM_Color_64 * | ptr | ||
) | [inline] |
{ if (storage) return storage->GetLinearPixels(x,y,pixels,ptr); return 0; };
int GetLinearPixels | ( | int | x, |
int | y, | ||
int | pixels, | ||
BMM_Color_fl * | ptr | ||
) | [inline] |
{ if (storage) return storage->GetLinearPixels(x,y,pixels,ptr); return 0; };
int GetIndexPixels | ( | int | x, |
int | y, | ||
int | pixels, | ||
BYTE * | ptr | ||
) | [inline] |
{ if (storage) return storage->GetIndexPixels(x,y,pixels,ptr); return 0; };
int PutIndexPixels | ( | int | x, |
int | y, | ||
int | pixels, | ||
BYTE * | ptr | ||
) | [inline] |
{ if (storage) return storage->PutIndexPixels(x,y,pixels,ptr); return 0; };
int CropImage | ( | int | width, |
int | height, | ||
BMM_Color_64 | fillcolor | ||
) | [inline] |
{ if (storage) return storage->CropImage(width,height,fillcolor); return 0; };
int CropImage | ( | int | width, |
int | height, | ||
BMM_Color_fl | fillcolor | ||
) | [inline] |
{ if (storage) return storage->CropImage(width,height,fillcolor); return 0; };
int CropImage | ( | int | width, |
int | height, | ||
int | fillindex | ||
) | [inline] |
{ if (storage) return storage->CropImage(width,height,fillindex); return 0; };
int ResizeImage | ( | int | width, |
int | height, | ||
int | newpalette | ||
) | [inline] |
{ if (storage) return storage->ResizeImage(width,height,newpalette);return 0; };
int CopyImage | ( | Bitmap * | from, |
int | operation, | ||
BMM_Color_64 | fillcolor, | ||
BitmapInfo * | bi = NULL |
||
) | [inline] |
{ if (storage) return storage->CopyImage(from,operation,fillcolor,bi); return 0; };
int CopyImage | ( | Bitmap * | from, |
int | operation, | ||
BMM_Color_fl | fillcolor, | ||
BitmapInfo * | bi = NULL |
||
) | [inline] |
{ if (storage) return storage->CopyImage(from,operation,fillcolor,bi); return 0; };
int CopyImage | ( | Bitmap * | from, |
int | operation, | ||
int | fillindex | ||
) | [inline] |
{ if (storage) return storage->CopyImage(from,operation,fillindex); return 0; };
int GetPalette | ( | int | start, |
int | count, | ||
BMM_Color_48 * | ptr | ||
) | [inline] |
{ if (storage) return storage->GetPalette(start,count,ptr); return 0; };
int SetPalette | ( | int | start, |
int | count, | ||
BMM_Color_48 * | ptr | ||
) | [inline] |
{ if (storage) return storage->SetPalette(start,count,ptr); return 0; };
BMMExport void FilmGrain | ( | float | grain, |
BOOL | mask, | ||
PBITMAP_FX_CALLBACK | callback = NULL , |
||
void * | param = NULL |
||
) |
void* GetChannel | ( | ULONG | channelID, |
ULONG & | chanType | ||
) | [inline] |
{ if (storage) return storage->GetChannel(channelID, chanType); return NULL; }
GBuffer* GetGBuffer | ( | ) | [inline] |
{ return storage? storage->GetGBuffer(): NULL; }
ULONG CreateChannels | ( | ULONG | channelIDs | ) | [inline] |
{ if (storage) return storage->CreateChannels(channelIDs); return 0; }
void DeleteChannels | ( | ULONG | channelIDs | ) | [inline] |
{ if (storage) storage->DeleteChannels(channelIDs); }
ULONG ChannelsPresent | ( | ) | [inline] |
{ if (storage) return storage->ChannelsPresent(); return 0; }
RenderInfo* GetRenderInfo | ( | ) | [inline] |
{ if (storage) return storage->GetRenderInfo(); return NULL; }
RenderInfo* AllocRenderInfo | ( | ) | [inline] |
{ if (storage) return storage->AllocRenderInfo(); return NULL; }
BMMExport BOOL PrepareGChannels | ( | BitmapInfo * | bi | ) |
BMMExport BOOL PrepareGChannels | ( | DWORD | channels | ) |
BMMExport int GetFiltered | ( | float | u, |
float | v, | ||
float | du, | ||
float | dv, | ||
BMM_Color_64 * | ptr | ||
) |
BMMExport int GetFiltered | ( | float | u, |
float | v, | ||
float | du, | ||
float | dv, | ||
BMM_Color_fl * | ptr | ||
) |
BMMExport int SetDither | ( | UINT | ditherType | ) |
BMMExport int SetFilter | ( | UINT | filterType | ) |
int HasFilter | ( | ) | [inline] |
{ return (filter) ? 1:0; };
BitmapFilter* Filter | ( | ) | [inline] |
{ return filter; };
BMMExport int SetStorage | ( | BitmapStorage * | storage | ) |
BitmapStorage* Storage | ( | ) | [inline] |
{ return storage; };
void NullStorage | ( | ) | [inline] |
BMMExport PBITMAPINFO ToDib | ( | int | depth = 24 , |
UWORD * | gam = NULL , |
||
BOOL | dither = FALSE , |
||
BOOL | displayGamma =
FALSE |
||
) |
PBITMAPINFO pDib; pDib = bitmap-\>ToDib(); ...
BMMExport BOOL FromDib | ( | PBITMAPINFO | pbmi | ) |
BMMExport BMMRES OpenOutput | ( | BitmapInfo * | bi | ) |
Opens the image for output.
bi | - Contains the name of the image or device to open for output. |
BMMExport BMMRES Write | ( | BitmapInfo * | bi, |
int | frame =
BMM_SINGLEFRAME |
||
) |
Write the image from BitmapStorage to disk.
BitmapInfo* | bi - Contains the name of the file or device to write to. |
DWORD | frame - Specifies the frame number to write. If this is a single image, allow frame to default to single frame. This argument determines if the file will have the frame number appended to it. If you want the file to have a normal name (no frame number attached to it), you must set the frame argument to BMM_SINGLEFRAME (the default). Any other value is considered to be a frame number and it will be appended to the given filename. |
BMMExport BMMRES WriteAll | ( | int | frame =
BMM_SINGLEFRAME |
) |
BMMExport int Close | ( | BitmapInfo * | bi, |
int | flag =
BMM_CLOSE_COMPLETE |
||
) |
BMMExport int CloseAll | ( | int | flag =
BMM_CLOSE_COMPLETE |
) |
BMMExport int Display | ( | const MCHAR * | title = NULL , |
int | position = BMM_CN , |
||
BOOL | autonomous =
FALSE , |
||
BOOL | savebutton = TRUE , |
||
CropCallback * | crop = NULL , |
||
Bitmap * | cloneMyVFB =
NULL |
||
) |
BMMExport int UnDisplay | ( | ) |
BMMExport HWND GetWindow | ( | ) |
BMMExport void RefreshWindow | ( | RECT * | rect = NULL |
) |
BMMExport void SetWindowTitle | ( | const MCHAR * | title | ) |
BMMExport void SetCroppingValues | ( | float | u, |
float | v, | ||
float | w, | ||
float | h, | ||
BOOL | placeImage | ||
) |
BMMExport BMMRES GoTo | ( | BitmapInfo * | bi | ) |
BMMExport int Fill | ( | int | r, |
int | g, | ||
int | b, | ||
int | alpha | ||
) |
BMMExport int Fill | ( | const BMM_Color_fl & | fillColor | ) |
BMMExport int Fill | ( | const BMM_Color_64 & | fillColor | ) |
BMMExport void SetNotify | ( | BitmapNotify * | bmnot = NULL |
) |
BitmapNotify* GetNotify | ( | ) | [inline] |
{ return bmNotify; }
BMMExport BOOL IsAutonomousVFB | ( | ) |
BMMExport INT_PTR Execute | ( | int | cmd, |
ULONG_PTR | arg1 = 0 , |
||
ULONG_PTR | arg2 = 0 , |
||
ULONG_PTR | arg3 = 0 |
||
) |
DWORD GetModifyID | ( | ) | [inline] |
{ return modifyID; }
void SetModifyID | ( | DWORD | m | ) | [inline] |
{ modifyID = m; }
BMMExport void IncrModifyID | ( | ) |
BMMExport void Print | ( | bool | silent = false |
) |
BMMExport void ShowProgressLine | ( | int | y | ) |
friend class BitmapManagerImp
[friend] |
LRESULT CALLBACK InputWndProc | ( | HWND | hWnd, |
UINT | message, | ||
WPARAM | wParam, | ||
LPARAM | lParam | ||
) | [friend] |