#include "stdafx.h" CResim::CResim(void) { BitmapVeri = NULL; pResimDosyaBaslik = NULL; pResimDosyaBilgiler = NULL; hBitmap = NULL; } CResim::CResim(HBITMAP _hBitmap) { BitmapVeri = new Byte(); pResimDosyaBaslik = NULL; hBitmap =_hBitmap; ResimYukle(); } CResim::CResim(Byte& _BitmapVeri) { BitmapVeri = NULL; pResimDosyaBaslik = NULL; pVeriBasligi = NULL; hBitmap = NULL; } CResim::~CResim(void) { if(BitmapVeri != NULL) this->BitmapVeri->Kaldir(); if(hBitmap != NULL) DeleteObject(hBitmap); delete BitmapVeri; } bool CResim::ResimYukle() { if(GetObject(hBitmap,sizeof(Resim),(PResim)this)) { BitmapVeri->YeniOlustur(sizeof(BitmapVeriBaslik)); pVeriBasligi = (PBitmapVeriBaslik) BitmapVeri; pVeriBasligi->BitAdet = PixelBits; pVeriBasligi->Yuzeyler = YuzeyAdet; pVeriBasligi->ResimBoyutu = } return false; } bool CResim::BitmapAl(Byte& Veri) { // Verinin Basinda BitmapDosyaBasligi Her Zaman BitmapDosyaBasligi var. pResimDosyaBaslik = (BitmapDosyaBasligi*)&Veri; // BitmapDosyaBasligi Altında Ise BitmapDosyaBilgileri yer alıyor. Baslangic+BitmapDosyaBasligi = BitmapDosyaBilgileri pResimDosyaBilgiler = (BitmapBilgiler*) ( &Veri+ (sizeof(BitmapDosyaBasligi)) ) ; // -> CResim Sinifina ait ResimVeri Butun Dosya Verilerini Tutuyor.(Baslik+ DosyaBilgileri + Veri) BitmapVeri = &Veri; // Resim veri baslangic adresini Buffer pointerina aktar. void* Buffer = (char*)Veri + pResimDosyaBaslik->VeriOffset; // Objeyi yarat hBitmap = CreateDIBitmap(GetDC(NULL),(LPBITMAPINFOHEADER)&pResimDosyaBilgiler->Ozellikler,CBM_INIT,Buffer,(LPBITMAPINFO)pResimDosyaBilgiler,DIB_RGB_COLORS); int ret = GetObject(hBitmap,sizeof(Resim),(PResim)this); return ((hBitmap == NULL) ? false : true); } bool CResim::BitmapAl(HBITMAP _hBitmap) { return ResimYukle(); } Byte* CResim::ByteCevir() { return NULL; } CResim::operator HBITMAP() { return hBitmap; } CSimge::CSimge(void) : CResim() { } CSimge::CSimge(Byte& SimgeVeri) : CResim(SimgeVeri) { } CSimge::CSimge(HICON hSimge) { if(!GetIconInfo(hSimge,&SimgeBilgileri)) return; CResim::CResim(SimgeBilgileri.hbmColor); SimgeMask = SimgeBilgileri.hbmMask; } Byte* CSimge::ByteCevir() { return BitmapVeri; } /* */