简体   繁体   中英

Convert single font character into bitmap pixel array in c++

I have a problem converting a character into a bitmap pixel array.

I work with Windows CE 6 and I have written an application in C++ to manage an OLED by serial interface.

To display the image on OLED I use the bitmap format, then if I want to display a text on OLED I have to convert the character to a bitmap array first, but I don't know how take a single character from a Windows CE font and convert it into a bitmap pixel array (bytes) to send it out via the serial interface.

Have you got an idea (standard functions, custom functions etc) how to solve this problem?

CreateDC to create a device context.
CreateCompatibleBitmap to create a bitmap of the right size.
SelectObject to select the bitmap into the DC.
CreateFontIndirect to create font.
SelectObject to select the font into the DC.
DrawText to draw the character on the DC.
SelectObject to select the previously selected bitmap back into the DC.
SelectObject to select the previously selected font back into the DC.
DeleteObject to delete the created font.
DeleteDC to delete the DC.

You now have a bitmap with the letter.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM