Gradient
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- Maurilio Viana
- Posts: 252
- Joined: Tue Oct 25, 2005 2:48 pm
- Location: Garça/Garza/Heron City - Brazil
- Contact:
Maurilio, para teres uma idéia, faça uma pequena alteração nos exemplos do link acima:
Code: Select all
...
for i = 255 TO 0 STEP -1
DEFINE BRUSH oBrush COLOR RGB( 0, i, 0 ) //<--- aqui
FILLRECT( hDC, aRect, oBrush:hBrush )
RELEASE BRUSH oBrush
aRect[ 1 ] += nStep
aRect[ 3 ] += nStep
next
...
toya
Ahora en la version 6.6
Consultoria e Desenvolvimento - NF-e/NFC-e
http://www.toyanet.com.br
https://www.facebook.com/profile.php?id=100009195956044
toyasis@gmail.com
FWH 10.8+PellesC+xHarbour.org 1.2.1
Ahora en la version 6.6
Consultoria e Desenvolvimento - NF-e/NFC-e
http://www.toyanet.com.br
https://www.facebook.com/profile.php?id=100009195956044
toyasis@gmail.com
FWH 10.8+PellesC+xHarbour.org 1.2.1
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Antonio,
It would be nice to have gradient capability added to the TWindow class. You could add a couple of parameters to the setColor() method to handle the extra needed color and the vertical/horzontal parameter. Then all the subclasses would inherit the gradient capability.
But, I expect you have already thought of that.
Regards,
James
It would be nice to have gradient capability added to the TWindow class. You could add a couple of parameters to the setColor() method to handle the extra needed color and the vertical/horzontal parameter. Then all the subclasses would inherit the gradient capability.
But, I expect you have already thought of that.
Regards,
James
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
James,
Gradient() should not be used intensively because it is a very slow function that creates lots of brushes (pushing the GDI to its limits) and takes too long to do its work.
The right way is to copy a bitmap (stretching it) instead of using gradients. We have used this technique in FWH 7.12 to paint the message bar and now it works much more faster.
Keep in mind that copying a bitmap you can use any drawing design, so the final result is much richer in details
Gradient() should not be used intensively because it is a very slow function that creates lots of brushes (pushing the GDI to its limits) and takes too long to do its work.
The right way is to copy a bitmap (stretching it) instead of using gradients. We have used this technique in FWH 7.12 to paint the message bar and now it works much more faster.
Keep in mind that copying a bitmap you can use any drawing design, so the final result is much richer in details
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Antonio,
>Gradient() should not be used intensively because it is a very slow function that creates lots of brushes (pushing the GDI to its limits) and takes too long to do its work.
Good point. Are you using a C function for this. I have tried gradients with a few test programs and it didn't seem too slow, but these were very small programs like with one dialog.
>The right way is to copy a bitmap (stretching it) instead of using gradients. We have used this technique in FWH 7.12 to paint the message bar and now it works much more faster.
So where is the bitmap stored? Is it embedded in the FW code somehow?
I have used bitmaps to do this also, but my bitmaps are stored in the RC file and I did not know we could stretch them to fit so it was very tedious making a bitmap of the proper size. Can you show us how to stretch a bitmap to fit a dialog or window?
>Keep in mind that copying a bitmap you can use any drawing design, so the final result is much richer in details.
I like that idea.
James
>Gradient() should not be used intensively because it is a very slow function that creates lots of brushes (pushing the GDI to its limits) and takes too long to do its work.
Good point. Are you using a C function for this. I have tried gradients with a few test programs and it didn't seem too slow, but these were very small programs like with one dialog.
>The right way is to copy a bitmap (stretching it) instead of using gradients. We have used this technique in FWH 7.12 to paint the message bar and now it works much more faster.
So where is the bitmap stored? Is it embedded in the FW code somehow?
I have used bitmaps to do this also, but my bitmaps are stored in the RC file and I did not know we could stretch them to fit so it was very tedious making a bitmap of the proper size. Can you show us how to stretch a bitmap to fit a dialog or window?
>Keep in mind that copying a bitmap you can use any drawing design, so the final result is much richer in details.
I like that idea.
James
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
James,
> Are you using a C function for this.
Yes, and even using C code, it is slow. Thats why we should try to avoid it and use StretchBlt().
> So where is the bitmap stored? Is it embedded in the FW code somehow?
Yes, it is embedded in a C module. Its quite simple: You open the bitmap with the Borland resources workshop, edit it as text, and then copy the bytes to a C array. From that C array, the bitmap is dinamically created in memory.
> I did not know we could stretch them to fit
Thats what StretchBlt() is for.
> Can you show us how to stretch a bitmap to fit a dialog or window?
In just few days FWH 7.12 will be published and the source code for stretching a bitmap will be available, and a working sample: the Class TMsgBar.
> Are you using a C function for this.
Yes, and even using C code, it is slow. Thats why we should try to avoid it and use StretchBlt().
> So where is the bitmap stored? Is it embedded in the FW code somehow?
Yes, it is embedded in a C module. Its quite simple: You open the bitmap with the Borland resources workshop, edit it as text, and then copy the bytes to a C array. From that C array, the bitmap is dinamically created in memory.
> I did not know we could stretch them to fit
Thats what StretchBlt() is for.
> Can you show us how to stretch a bitmap to fit a dialog or window?
In just few days FWH 7.12 will be published and the source code for stretching a bitmap will be available, and a working sample: the Class TMsgBar.
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
-
- Posts: 824
- Joined: Thu Oct 13, 2005 7:39 am
- Location: Germany
Dear friends,
I wrote a little tool that manages the conversion from a bitmap into a C array . So you can embed the bitmap in your C file very easily.
May be it´s useful.
You can download it here:
BmpInfo.zip (1.66 MB)
I wrote a little tool that manages the conversion from a bitmap into a C array . So you can embed the bitmap in your C file very easily.
May be it´s useful.
You can download it here:
BmpInfo.zip (1.66 MB)
kind regards
Stefan
Stefan