Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
H

hike

@hike
About
Posts
2
Topics
2
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • rtWhy the bitmap just don't show?!
    H hike

    I try to create and show a bitmap based on one short array.No error occours during compile,but the bitmap just don't show on the view. My code as follow: void CReadfile1View::DrawDIBSection(HDC hDC , int xDest,int yDest,int w, int h,signed short*image) { BITMAPINFOHEADER *bih=0; // HDC hDC=0; HBITMAP hbm; void *bits; try { // allocate room for BITMAPINFOHEADER and color mask's if(!(bih = (BITMAPINFOHEADER*)malloc(sizeof(BITMAPINFOHEADER)))) throw 0; ZeroMemory(bih,sizeof(BITMAPINFOHEADER)); bih->biSize = sizeof(BITMAPINFOHEADER); bih->biWidth = w; // . bih->biHeight = h; // match array-size bih->biPlanes = 1; bih->biBitCount = 16; bih->biCompression = BI_RGB; // we use 5:5:5 format bih->biSizeImage = bih->biWidth * 2 * bih->biHeight; if(!(hDC = ::GetDC(0))) throw 0; // create the 16-bit DIBSECTION if(!(hbm = ::CreateDIBSection(hDC,(BITMAPINFO*)bih,DIB_RGB_COLORS,&bits,0,0))) // throw 0; // get the array into the DIBSECTION if(::SetDIBits(hDC,hbm,0,h,image,(BITMAPINFO*)bih, DIB_RGB_COLORS) != h) throw 0; } catch(...) { // cout<<"unknown type of exception throw"<<'\n'; } HDC hDCMem=::CreateCompatibleDC(hDC); HGDIOBJ hBmpOld=::SelectObject(hDCMem,hbm); BitBlt(hDC,xDest,yDest,bih->biWidth,bih->biHeight,hDCMem,0,0,SRCCOPY); ::SelectObject(hDCMem, hBmpOld); ::DeleteDC(hDCMem); if(hDC) ::ReleaseDC(0,hDC); if(bih) free(bih); } void CReadfile1View::OnDraw(CDC* pDC) { CReadfile1Doc* pDoc = GetDocument(); ASSERT_VALID(pDoc); DrawDIBSection(*pDC,10,10,WIDTH,HEIGHT,pDoc->Image[0]); } Who can tell me why it don't works and how to improve?! thanx! :eek: :eek: fly against the wind

    C / C++ / MFC

  • I have problem in creating and showing Bitmap of 16 -bit-colordepth!Please help me!
    H hike

    I haven't any formal Bitmap file,but only a short array,then what can I do to create and show a Bitmap with 16 bit color depth?! Please tell me in detail! Thanks!:eek: fly against the wind

    C / C++ / MFC
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups