Solved

Drawing over pictures (bmp, gif, jpeg)

Posted on 1999-01-20
2
1,760 Views
Last Modified: 2013-11-20
I'm trying to write an application to display a picture (gif,bmp,jpeg) and then have the ability to draw rectangular shapes over the top of this picture.  Is there an easy way of displaying the picture and drawing the shapes over the top without the picture being rubbed out?  Any help would be appreciated. Thanks in advance.

~Ian
0
Comment
Question by:iankosh
2 Comments
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 100 total points
ID: 1328053
One idea is to use the layering method. That is you keep track of these objects that can be pictures or shapes in list. This list would then be the order in which to draw the items. For example, if you draw from the first item to the last item in the list and you wanted a shape to be on top of a picture, then make sure that the picture is located earlier in the list than the shape.

Of course, this means that you will need to support transparencies, but that isn't too hard for gifs, but bmp and jpg do not support transparency.
0
 
LVL 2

Expert Comment

by:MelissaC
ID: 1328054
I suppose you don't have to save the changes to the picture? I build an app once that displayed a bitmap and had to draw different lines on the bitmap each time a button was clicked.
Just put the bitmap in a picture control, get the device context of it, and use CPen or whatever you like to paint over it.
To stop the image from flickering, use a MemDC.
Good luck
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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 demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

757 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now