CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Oct 2001
    Location
    India
    Posts
    42

    GRAY LEVEL IMAGE AS AN ARRAY

    I have an array of Gray level values.
    i want to display this on document area.
    i know to display it with SetPixel function.
    but i want something, to display it fast.
    can i use the pointer corresponding to the display and for this purpose ????


    ==============
    Bye 4 now
    MAD

  2. #2
    Join Date
    Aug 2001
    Location
    Minnesota, USA
    Posts
    801

    Re: GRAY LEVEL IMAGE AS AN ARRAY

    Could you draw those values into a bitmap in some initialization code or are the values changing a lot? If they are not changing, draw them into a memory DC with a bitmap selected into it, then when you want to draw, just call BitBlt. If you want some code to do this, I can post some.

    Chris Richardson

    http://www.geometriccomputing.com
    http://www.imagesensing.com
    http://www.autoscope.com

  3. #3
    Join Date
    Oct 2001
    Location
    India
    Posts
    42

    Re: GRAY LEVEL IMAGE AS AN ARRAY

    thanx 4 the suggetion,
    how can i transfer the array in to bitmap,
    r u saying about DC ?
    then
    Shoud i use SetPixel() itself for that
    bye 4 now

    ==============
    Bye 4 now
    MAD

  4. #4
    Join Date
    Mar 2001
    Location
    Singapore
    Posts
    57

    Re: GRAY LEVEL IMAGE AS AN ARRAY

    You should look at some of the DIB classes found in the Bitmap section. Using one,
    you can directly access the pixels before drawing to your document. And it is
    so much faster compared to using SetPixel().

    good luck.


  5. #5
    Join Date
    Oct 2001
    Posts
    5

    Re: GRAY LEVEL IMAGE AS AN ARRAY

    Hey man, I want to do the same thing. I'm a beginner to Visual C++, but I know some C/C++.

    I want to read BMP-file, play with it a bit(array is preferable), and the display it. And I want to do it the easy understandable way. Back in the old days(DOS-based compilers) it wasn't that hard to read a BMP-file. I thought it would be lot easier with Visuall C++...



  6. #6
    Join Date
    Aug 2001
    Location
    Minnesota, USA
    Posts
    801

    Re: GRAY LEVEL IMAGE AS AN ARRAY

    You could use SetPixel if you wanted to. Otherwise, you could directly access the pixels without using SetPixel. You just need to use CreateDIBSection. This function will give you an HBITMAP (which can be used for drawing), and it will also give you direct access to the bits.

    Chris Richardson

    http://www.geometriccomputing.com
    http://www.imagesensing.com
    http://www.autoscope.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured