Solved

Drawing over pictures (bmp, gif, jpeg)

Posted on 1999-01-20
2
1,814 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
[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
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone 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

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…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.

730 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