DrawText/DrawImage

  • Thread starter Thread starter Brian H
  • Start date Start date
B

Brian H

I have a graphical application to which I'm drawing directly to the screen
using DrawText, along with various ellipses/rectangles. Nothing
spectacular. What I'm trying to do is be able to draw some simple icons,
such as a music note, to the screen as well.

I don't think I can rely on a font having this character (which would be the
easiest solution); I thought about making a simple embedded image and set
the color key, but I'd like to dynamically set the foreground color of the
image. Is it possible to replace a color in a simple image? Any
suggestions?

Thanks,
Brian
 
Hi Brian,

There is no easy way to do this that I can think of. GDI on the netcf does
not support this directly. The next best method (besides a color swap blt
flag) would be to use a palette and have all of the pixels that you want to
change colors for use the same palette index. Then you would only need to
change the one palette color to your target color. Unfortanetly, you cannot
access the palette in 1.0 either.

GapiDraw can handle this if you want to buy a very powerful native solution.
There is a GAPI based way of doing it at following sample (see the font
section where you could map an ascii value to your character or use the
palette swapping method):

http://msdn.microsoft.com/library/en-us/dnnetcomp/html/WrapGAPI3.asp

Of course, you could always create your own custom font and use it solely
for funky characters.

Geoff
 
I'm very seriously considering using my own custom font for this. Is it
possible to use a font from the application directory (or even better as an
embedded resource!), or would I need to install it to the device's
/windows/fonts folder?

I'm guessing it needs to be in the windows/fonts folder. If this is the
case, is it acceptable to hard code that path in the .inf file when building
the cab?

Thanks for your help!

Brian
 
I had a quick look at GapiDraw ... I may download it and play with it -- my
application is Freeware (I'm using FMOD as well) so it looks like they are
liberal with allowing its use for freeware applications)...
 
Hi Brian,

That is a good question and I don't have any docs or even VS in front of me
right now. I am hoping someone else can jump in here with more experience
using fonts than I have.

Geoff
 
Back
Top