Solved

gradient text

Posted on 2006-11-22
7
553 Views
Last Modified: 2012-05-05
hi experts,

I'm developing custom controls for mobile devices running windows CE 4.2/5.0 (no MFC libs)
having a gradient background is fairly simple, however, i was trying to draw a gradient text on a screen without success.
any ideas?

cheers
0
Comment
Question by:sedgwick
  • 3
  • 2
  • 2
7 Comments
 
LVL 4

Expert Comment

by:bdunz19
ID: 18001311
Well, I have and idea that might satisfy. This comes from video game development, where most character sets used to comprise of one large bitmap of every letter/number/symbol drawn in something like photoshop and then extracted from the bitmap and BitBlt onto the screen. Now, I have very little experience with mobile dev, and do not know what the processing power of simple drawing takes, but i'm willing to bet if you are performing gradient backgrounds then this solution should be a breeze.

So basically, type out the entire character set in one long row and then use some gradient effects over the font and save it with a mask color as the background. Then load the bmp and with a fairly simple algorithm extract the specified character for whatever letter you need to draw.

Just my two cents, hope they help!
Brandon
0
 
LVL 42

Author Comment

by:sedgwick
ID: 18001573
ok, we've decided that since the gradient colors are fixed the best and fastest way is to create the bitmap with the gradient text as a resource.
then using timer, display partial of the bitmap as the time progresses.
my question is how do i implement this in OnTimer()?

0
 
LVL 4

Expert Comment

by:bdunz19
ID: 18002058
Are you saying you want the text to fade in and out sort of? I'm kind of lost about your last comment... please clarify
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 42

Author Comment

by:sedgwick
ID: 18002074
i'm loading the image and each time i draw only portion of it to the device context.
0
 
LVL 39

Accepted Solution

by:
itsmeandnobodyelse earned 250 total points
ID: 18002566
In OnTimer invalidate that part of the screen that you wants to get refreshed, e. g. by InvalidateRect function. Then in OnPaint (or OnDraw) you should draw the invalidated region only e. g. by BitBlt to a compatible device/bitmap.

Regards, Alex
0
 
LVL 42

Author Comment

by:sedgwick
ID: 18002589
itsmeandnobodyelse: 10x for the reply but i need some source code cause i'm pretty 'green' in this area

cheers
0
 
LVL 39

Expert Comment

by:itsmeandnobodyelse
ID: 18003565
>>>> but i need some source code

Did you use MFC or plain WinAPI? Can you post the OnTimer til now? If you have a handler for WM_PAINT please post it also (normally OnPaint or OnDraw) cause there are different ways to do the same thing.


>>>> i'm loading the image and each time i draw only portion of it to the device context.

Did you write already some piece of code for that?


Regards, Alex
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question