Solved

displaying pixels

Posted on 2002-07-02
8
208 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
Independent Software Vendors: 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 350 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Expand data scrubbing tool 13 36
iSeries DB2 Query 2 101
maxBlock challenge 30 149
modThree challenge 4 153
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
In this post we will learn different types of Android Layout and some basics of an Android App.
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.
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

738 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