[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Drawing over pictures (bmp, gif, jpeg)

Posted on 1999-01-20
2
Medium Priority
?
1,858 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 300 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

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
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.
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses
Course of the Month19 days, 8 hours left to enroll

873 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