Click here to Skip to main content
15,924,196 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Drawing on a device independent bitmap Pin
Paul M Watt4-Dec-02 14:44
mentorPaul M Watt4-Dec-02 14:44 
GeneralDisplaying Image From Data Array Pin
Rooster764-Dec-02 4:51
Rooster764-Dec-02 4:51 
GeneralRe: Displaying Image From Data Array Pin
Maximilien4-Dec-02 4:54
Maximilien4-Dec-02 4:54 
GeneralRe: Displaying Image From Data Array Pin
Chris Losinger4-Dec-02 4:58
professionalChris Losinger4-Dec-02 4:58 
you first need to convert that image into a DIB. this is Window's native image type.

1. a DIB is vertically flipped (first pixel is bottom-left)
2. all pixel rows in a DIB must be a multiple of four bytes wide. this may mean you have to add padding bytes to the end of the rows
3. a DIB starts with a BITMAPINFOHEADER struct
4. in an 8-bit DIB, the palette (256 entries in this case) immediately follows the header struct
5. the pixel bytes immediately follow the palette

so, to turn that image of yours in to a DIB:

find out how wide the pixel rows will be (accounting for the row padding), multiple that by the height. add 256 * sizeof(RGBQUAD) for the palette and sizeof(BITMAPINFOHEADER) for the header. allocate that much memory. then, fill in the header, copy the palette, copy the pixel rows (accounting for padding! and the vertical flip), and you're done!

Smile | :)

-c



There's one easy way to prove the effectiveness of 'letting the market decide' when it comes to environmental protection. It's spelt 'S-U-V'.
--Holgate, from Plastic

GeneralRe: Displaying Image From Data Array Pin
Roger Allen4-Dec-02 5:05
Roger Allen4-Dec-02 5:05 
GeneralRe: Displaying Image From Data Array Pin
Chris Losinger4-Dec-02 5:07
professionalChris Losinger4-Dec-02 5:07 
QuestionHow to Get the ChildWnd's CWnd* of Static SplitterWnd Pin
zhdleonid4-Dec-02 4:45
zhdleonid4-Dec-02 4:45 
AnswerRe: How to Get the ChildWnd's CWnd* of Static SplitterWnd Pin
valikac4-Dec-02 9:59
valikac4-Dec-02 9:59 
GeneralRe: How to Get the ChildWnd's CWnd* of Static SplitterWnd Pin
zhdleonid4-Dec-02 15:14
zhdleonid4-Dec-02 15:14 
GeneralGetClientRect disparity Pin
RalfPeter4-Dec-02 3:59
RalfPeter4-Dec-02 3:59 
GeneralRe: GetClientRect disparity Pin
Roger Allen4-Dec-02 4:39
Roger Allen4-Dec-02 4:39 
GeneralRe: GetClientRect disparity Pin
RalfPeter4-Dec-02 6:06
RalfPeter4-Dec-02 6:06 
GeneralTaskbar Pin
Victor Boctor4-Dec-02 2:36
Victor Boctor4-Dec-02 2:36 
GeneralRe: Taskbar Pin
Michael P Butler4-Dec-02 3:56
Michael P Butler4-Dec-02 3:56 
GeneralRe: Taskbar Pin
Ravi Bhavnani4-Dec-02 5:03
professionalRavi Bhavnani4-Dec-02 5:03 
GeneralNeed advice for modal window Pin
Johann Gerell4-Dec-02 2:23
Johann Gerell4-Dec-02 2:23 
GeneralRe: Need advice for modal window Pin
Paul M Watt4-Dec-02 4:20
mentorPaul M Watt4-Dec-02 4:20 
GeneralRe: Need advice for modal window Pin
Alvaro Mendez4-Dec-02 5:29
Alvaro Mendez4-Dec-02 5:29 
GeneralInternationalisation Pin
Patje4-Dec-02 2:12
Patje4-Dec-02 2:12 
GeneralRe: Internationalisation Pin
Maximilien4-Dec-02 2:56
Maximilien4-Dec-02 2:56 
GeneralRe: Internationalisation Pin
Patje4-Dec-02 3:21
Patje4-Dec-02 3:21 
QuestionShowing memory contents into a HTMLView? Pin
Joan M4-Dec-02 1:29
professionalJoan M4-Dec-02 1:29 
AnswerRe: Showing memory contents into a HTMLView? Pin
Chris Losinger4-Dec-02 4:26
professionalChris Losinger4-Dec-02 4:26 
GeneralRe: Showing memory contents into a HTMLView? Pin
J Patel4-Dec-02 8:09
J Patel4-Dec-02 8:09 
GeneralRe: Showing memory contents into a HTMLView? Pin
Ravi Bhavnani4-Dec-02 10:38
professionalRavi Bhavnani4-Dec-02 10:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.