i want to use a bitmap file from my computer in c++.
i just dont know the code.
can anyone help????

Recommended Answers

what do you want to do with the image?

Jump to Post

All 2 Replies

what do you want to do with the image?

Maybe you are trying to do graphics ??? .. then i suggest allegro C/C++ graphics lib as it is both a beginners lib and efficient .
Once installed, Do something like ...

BITMAP *bmp = loadbmp("name_of_bmp_img", 0 );
BITMAP *buffer = creat_bitmap(SCREEN_W, SCREEN_H);
clear_to_color(screen, makecol(255,255,255));
draw_sprite(buffer, bmp, bmp->w, bmp->h);
draw_sprite(screen, buffer, 0, 0 );      // double buffering

P:S ... this is just a code sample ... it should display your bitmap image on the screen..
Purpose of that code is just to show you how easy ( pretty much ) it is with the allegro library ... compared to other sophisticated and much more complex libraries like OPENGL ... Another library you should consider is the SDL lib ....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.