aswang
1.0
|
00001 /* 00002 Copyright 2003 Joseph Alvis 00003 00004 This file is part of Aswang. 00005 00006 Aswang is free software: you can redistribute it and/or modify 00007 it under the terms of the GNU Lesser General Public License as published by 00008 the Free Software Foundation, either version 3 of the License, or 00009 (at your option) any later version. 00010 00011 Aswang is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU Lesser General Public License for more details. 00015 00016 You should have received a copy of the GNU Lesser General Public License 00017 along with Aswang. If not, see <http://www.gnu.org/licenses/>. 00018 */ 00019 00020 #include "Bitmap.h" 00021 00022 using namespace aswang; 00023 00024 void Bitmap::Delete() { 00025 if(hbmap != NULL) 00026 DeleteObject(hbmap); 00027 } 00028 00029 Bitmap &Bitmap::operator = (HBITMAP h) { 00030 Delete(); 00031 hbmap = h; 00032 return *this; 00033 } 00034 00035 BITMAP Bitmap::GetObjectInfo() { 00036 BITMAP bmap; 00037 memset(&bmap,0,sizeof(bmap)); 00038 if(hbmap!=NULL) 00039 GetObject(hbmap,sizeof(bmap),&bmap); 00040 return bmap; 00041 } 00042 00043 long Bitmap::GetWidth() { 00044 BITMAP bmap = GetObjectInfo(); 00045 return bmap.bmWidth; 00046 } 00047 00048 long Bitmap::GetHeight() { 00049 BITMAP bmap = GetObjectInfo(); 00050 return bmap.bmHeight; 00051 } 00052 00053 long Bitmap::GetWidthBytes() { 00054 BITMAP bmap = GetObjectInfo(); 00055 return bmap.bmWidthBytes; 00056 } 00057 00058 short Bitmap::GetPlanes() { 00059 BITMAP bmap = GetObjectInfo(); 00060 return bmap.bmPlanes; 00061 } 00062 00063 short Bitmap::GetBitsPerPixel() { 00064 BITMAP bmap = GetObjectInfo(); 00065 return bmap.bmBitsPixel; 00066 } 00067 00070 char *Bitmap::GetBits() { 00071 BITMAP bmap = GetObjectInfo(); 00072 return (char *)bmap.bmBits; 00073 }