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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Unhandled exception when filling up bmiColors property in BITMAPINFO

Unhandled exception when filling up bmiColors property in BITMAPINFO

Scheduled Pinned Locked Moved C / C++ / MFC
help
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    redeemer
    wrote on last edited by
    #1

    The unhanlded exception error appears at different times when i run this code. Sometimes when i is 100 and sometimes when it's 500.

    for (i = 0; i < horzres\*vertres; i++)
    {
    	bInfo.bmiColors\[i\].rgbRed = GetRValue(pCol\[i\]);
    	bInfo.bmiColors\[i\].rgbGreen = GetGValue(pCol\[i\]);
    	bInfo.bmiColors\[i\].rgbBlue = GetBValue(pCol\[i\]);
    	bInfo.bmiColors\[i\].rgbReserved = 0;
    }
    

    Thanks very much in advance!

    C C 2 Replies Last reply
    0
    • R redeemer

      The unhanlded exception error appears at different times when i run this code. Sometimes when i is 100 and sometimes when it's 500.

      for (i = 0; i < horzres\*vertres; i++)
      {
      	bInfo.bmiColors\[i\].rgbRed = GetRValue(pCol\[i\]);
      	bInfo.bmiColors\[i\].rgbGreen = GetGValue(pCol\[i\]);
      	bInfo.bmiColors\[i\].rgbBlue = GetBValue(pCol\[i\]);
      	bInfo.bmiColors\[i\].rgbReserved = 0;
      }
      

      Thanks very much in advance!

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      If you're trying to fill a bitmap with data, they are word aligned internally, and you need to skip the padding at the ned of each row. My GDI+ image processing articles show how - the principle is the same in C++/GDI because the internal structure is the same. Christian I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002 Half the reason people switch away from VB is to find out what actually goes on.. and then like me they find out that they weren't quite as good as they thought - they've been nannied. - Alex, 13 June 2002

      1 Reply Last reply
      0
      • R redeemer

        The unhanlded exception error appears at different times when i run this code. Sometimes when i is 100 and sometimes when it's 500.

        for (i = 0; i < horzres\*vertres; i++)
        {
        	bInfo.bmiColors\[i\].rgbRed = GetRValue(pCol\[i\]);
        	bInfo.bmiColors\[i\].rgbGreen = GetGValue(pCol\[i\]);
        	bInfo.bmiColors\[i\].rgbBlue = GetBValue(pCol\[i\]);
        	bInfo.bmiColors\[i\].rgbReserved = 0;
        }
        

        Thanks very much in advance!

        C Offline
        C Offline
        Chris Losinger
        wrote on last edited by
        #3

        bmiColors is the palette, not the image. -c


        Garbage collection, making life better - for weenies!

        Image Processing - just like mom used to make.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

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