Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

displaying pixels

Posted on 2002-07-02
8
Medium Priority
?
223 Views
Last Modified: 2013-11-20
I am doing a project with a digital imaging chip.  I have a program in C++ that reads in a frame through the serial port and I would like to display these image frames in real-time.

How would I go about doing this in simple MFC?  I just need some sort of a dialog that I can throw some buttons on, then have a canvas/drawarea or something that I can refresh every time I get a new image.

Thanks in advance

0
Comment
Question by:Hep_Cat
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 

Author Comment

by:Hep_Cat
ID: 7125259
Just to clarify, the image to display is only 22 x 22, and it is in a 2D array of grayscale ints (0-255).  I need to make the picture larger, i.e. each pixel in the image should take a block of pixels when displayed on the screen.  I need to know which class will let me do this and a little about how it works.
0
 
LVL 32

Expert Comment

by:jhance
ID: 7125294
A CStatic will display a CBitmap quite simply.
0
 
LVL 12

Expert Comment

by:migel
ID: 7125322
Hi!
You have to use DIB bitmap to show your picture since you know data format you can easy create needed DIB and fill it by needeed pixels
look at MSDN  for article
MSJ "March 1997" Q&A by Paul DiLASCIA
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Hep_Cat
ID: 7125372
migel,

I don't have that article.  Creating a DIB or a CBitmap is not my problem.  What do I display them on and how can I update them in real-time as I get the information from the serial port (30 frames/sec)?  Animation?
0
 

Author Comment

by:Hep_Cat
ID: 7125380
migel,

I don't have that article.  Creating a DIB or a CBitmap is not my problem.  What do I display them on and how can I update them in real-time as I get the information from the serial port (30 frames/sec)?  Animation?
0
 

Author Comment

by:Hep_Cat
ID: 7125412
Sample code would be a great help
0
 
LVL 49

Accepted Solution

by:
DanRollins earned 1400 total points
ID: 7125587
Make a dialog-based app.  
Add a CStatic control to it (it's tool palette icon looks like a cactus)
Right-click and...
  ... set its ID to IDC_MyBitmap
  ... set Type to Bitmap
  click OK
Press Ctrl+W and in the ClassWizard and click the 'Member Variables' tab
Select ICD_MyBitmap
Click [Add Variable]
  name is: m_ctlMyBitmap
  cateogory: is Control
  vriable type: CStatic
=--==-=-=-=-=-
Now you have a canvas and an easy way to update it.

Once you have an HBITMAP, created from the image data, you can simply use:

    m_ctlMyBitmap.SetBitmap( hBmp );

Do this in a loop to get Real Time Animation!
To increase the size, just create twice as large of a bitmap (use StretchBlt or StetchDIBits).  You say you'll have no trouble creating a DIB, so that should be easy for you.

-- Dan
0
 

Author Comment

by:Hep_Cat
ID: 7127836
That's what I needed!  Thanks
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question