How to draw a magnifying glass using <graphics.h>

I want to draw a magnifying glass using graphics.h which is used mostly as "Search" icon. But, I am having problems in making the rectangle attached to the two circles (one inscribed on another) . I'eve also included the screenshot (made in powerpoint) on how the output will look like, enen I've made most of the part, except the search icon (magnifying glass). Will you please help me!

The Link for the screenshot is : https://docs.google.com/file/d/0B0soGRNZOS7sak9hSXk2aW9EOFE/edit?usp=sharing
Is <graphics.h> a standard library file?

I'm afraid it's part of a library so you'll need to consult that specific library's documentation. Or is it a windows header? We have a "Windows Programming" section for that.
graphics.h is nothing to do with the Windows API.

Thanks to Google I now know it's probably Borland BGI -- that is, something to do with Borland (Turbo) C++. Is that the compiler you're using??

And that there's even a Windows port, WINBGIM !!

You might find something if you search the web for BGI and bitmap / image. But after a quick look I found this thread which looks like a lot of work if there's a standard function.

How to use Bitmap in Turbo C++
http://forums.devx.com/showthread.php?163081-How-to-use-Bitmap-in-Turbo-C

Andy

How i can get and use the header file <graphics.h> in my C++ program?
http://stackoverflow.com/questions/7860569/how-i-can-get-and-use-the-header-file-graphics-h-in-my-c-program

The WINBGIM Library -- Version 6.0 -- August 9, 2004
Borland BGI Graphics and Mouse
For Windows Applications
http://www.cs.colorado.edu/~main/cs1300-old/cs1300/doc/bgi/bgi.html
Last edited on
The reason you aren't getting a satisfactory answer is twofold:

(1)
The library you are is ancient. No one uses it anymore except for high-schools and universities in India (I think -- don't get mad at me if you are in Pakistan or something), and the poor saps like you get stuck with it. It isn't your fault, but you unfortunately have to deal with it...

(2)
The format of the image data was never described by the folks at Borland. I couldn't reverse-engineer the EGA image format as a kid (though I admit I gave up really easily).

If you are using an EGA video mode, the graphics data is divided into four "planes" of pixel-mapped data, which is stored consecutively. Some buffering may be involved (I don't remember), and the header for image dimensions is more than a simple width+height thing (IIRC). I imagine that all went over your head...

Your best bet might be to write yourself a little pixel editor, draw your image using your editor, then save it with the 'save image to file' function (sorry, I'm not going to dig out my old manual right now -- assuming I still have it -- but I'll probably look for it sometime later).


The only other real option you have is to create a routine that draws the image with some simple primatives -- circles and lines -- and just call the routine to place the image where you want it.

Sorry I can't be of more help right now.
Topic archived. No new replies allowed.