News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

how can i generate a bitmap image consist of a string?

Started by hila123, June 23, 2005, 07:41:14 AM

Previous topic - Next topic

hila123

hi, i'm new to win32 assembly,

here is my problem

how can i generate a bitmap consist of a string....
for example,
i have a string "i love assembly", how can i generate a bitmap image consist of the string?

Tedd

You create the bitmap in memory, and draw the string onto the bitmap, and then you can save it to a file (or do whatever you want.)

Next question: how do I do that? :bg
No snowflake in an avalanche feels responsible.

donkey

You can create the bitmap and then draw the string directly to it. It will go something like this, I just typed this without testing it so it might need a bit of tweaking...

invoke GetDC, [hWinMain]
mov [hdc], eax

invoke CreateCompatibleBitmap, [hdc], 500, 500
mov [hBmp], eax

invoke CreateCompatibleDC, [hdc]
mov [memDC], eax

invoke ReleaseDC, [hdc]

mov D[rect.top], 0
mov D[rect.bottom], 0
mov D[rect.left], 500
mov D[rect.right], 500

invoke DrawText, [memDC], "Hello",1,offset rect,DT_CENTER + DT_VCENTER

invoke DeleteDC, [memDC]
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable