src/image.cpp

Go to the documentation of this file.
00001 /*
00002 * Copyright (c) 2006 by Kirill Kolodyazhniy.
00003 * See the file "license.terms" for information on usage and redistribution
00004 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
00005 */
00006 
00007 #include "stdinc.h"
00008 #include "image.h"
00009 #include "exception.h"
00010 namespace MWidgets
00011 {
00012         /*******************************************************************************/
00013         Image::Image()
00014         {
00015                 m_hBitamp=NULL;
00016         };
00017         /*******************************************************************************/
00018         void Image::Load(std::string fileName)
00019         {
00020                 if(!m_hBitamp)
00021                 {
00022                         m_hBitamp=(HBITMAP)LoadImage(NULL,fileName.c_str(),IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
00023                         if(!m_hBitamp)
00024                                 EXCEPT("Image::Load - can't open file %s !",fileName.c_str());
00025                 }
00026                 else
00027                         EXCEPT("Image::Load - image ovveride!");
00028         };
00029         /*******************************************************************************/
00030         void Image::Free()
00031         {
00032                 if(m_hBitamp)
00033                         DeleteObject(m_hBitamp);
00034                 m_hBitamp=NULL;
00035         };
00036         /*******************************************************************************/
00037         Image::~Image()
00038         {
00039                 if(m_hBitamp)
00040                         DeleteObject(m_hBitamp);
00041         };
00042         /*******************************************************************************/
00043         HBITMAP Image::GetHBITMAP()
00044         {
00045                 return m_hBitamp;
00046         };
00047         /*******************************************************************************/
00048 };

Generated on Thu Oct 26 13:47:45 2006 for MWidgets by  doxygen 1.4.7