Hello,
I want to use the Alpha-BMP's for special effects
I use it on dialog-infos
It is a combination of "normal" and Alpha-Bitmaps
Fire
Glow
Shadow
I have to adjust the Alpha-Bitmap, but in the function
ABPaint is nothing to define bottom and right
only top and left.
How can i adjust a Alpha-Bitmap ( stretch ) ?
ABPaint( hDC, 2, 2, oBmp2:hBitmap, 255 )
Regards
Uwe
Special effects with Alpha-Blended Bitmaps
Special effects with Alpha-Blended Bitmaps
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
i work with FW.
If you have any questions about special functions, maybe i can help.
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Why Resizing Alpha-Blended-Bitmaps
The reason for resizing :
It works with different levels.
1. The resource with the dimension
2. A normal BMP from resource resized and filled
with background and text
3. Result from No. 2
aRect := GETCLIENTRECT( oBmp:hWnd )
nGRADIENT := Gradient( hDC, aRect, nVColor, nBColor, .T. )
oBmp:oBrush := TBrush():New( , nGRADIENT )
SetBkMode( oBmp:hDC, 0 )
FillRect( hDC, aRect, oBmp:oBrush:hBrush )
4. A constructed Alphablended BMP
has to be resized and calculated, to fit as background No. 3
Without resizing, a have to create allways a extra Alpha-BMP
with the dimension for No. 3
5. The End-result
Regards
Uwe
It works with different levels.
1. The resource with the dimension
2. A normal BMP from resource resized and filled
with background and text
3. Result from No. 2
aRect := GETCLIENTRECT( oBmp:hWnd )
nGRADIENT := Gradient( hDC, aRect, nVColor, nBColor, .T. )
oBmp:oBrush := TBrush():New( , nGRADIENT )
SetBkMode( oBmp:hDC, 0 )
FillRect( hDC, aRect, oBmp:oBrush:hBrush )
4. A constructed Alphablended BMP
has to be resized and calculated, to fit as background No. 3
Without resizing, a have to create allways a extra Alpha-BMP
with the dimension for No. 3
5. The End-result
Regards
Uwe
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
i work with FW.
If you have any questions about special functions, maybe i can help.
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Alpha-BMP
Antonio, thank you very much
To have Bottom and Right as well,
like the other BMP's, i could design a frame.
Then there are still other things possible.
Just a underline
The needed dimensions from TControl :
The Top- and Left-position of a resource inside of a dialog
Best Regards
Uwe
To have Bottom and Right as well,
like the other BMP's, i could design a frame.
Then there are still other things possible.
Just a underline
Code: Select all
FUNCTION ONPAINT(oDlg1,hDC,oBmp,nVColor, nBColor,nColor,cText, ;
oBFont,nPOSLEFT, nEND, nORIENT,cBRUSH, nPEN )
LOCAL hOldFont, oNewbrush, hBitmap, aRect, oBmp1, nTOP, nLEFT
LOCAL oBmp2, nCENTER
hOldFont := SelectObject( hDC, oBFont:hFont )
nTXTLG := GettextWidth( hDC, cText )
nBMPLONG := oBmp:Super:nWidth()
nBMPHIGHT := oBmp:Super:nHeight()
nFONTHIGHT := e_oBfont1:nInpHeight * -1
IF nPOSLEFT = 0
nLEFT := (nBMPLONG - nTXTLG) / 2
ELSE
nLEFT := nPOSLEFT
ENDIF
nNEWHIGHT := nFONTHIGHT
nTOP := (nBMPHIGHT - nNEWHIGHT) / 2
aRect := GETCLIENTRECT( oBmp:hWnd )
nGRADIENT := Gradient( hDC, aRect, nVColor, nBColor, .T. ) // .T. Horizontal
oBmp:oBrush := TBrush():New( , nGRADIENT )
SetTextColor( hDC,nColor)
SetBkMode( oBmp:hDC, 0 )
FillRect( hDC, aRect, oBmp:oBrush:hBrush )
TextOut( hDC, nTOP, nLEFT, cText )
SelectObject( hDC, hOldFont )
// A simple border
// --------------------
IF nPEN > 0
DRAWBOX( aRect, hDC, nColor, nBMPLONG, nBMPHIGHT, B_PEN )
ENDIF
// Alphablended underline-bmp
// -------------------------------------
DEFINE BITMAP oBmp2 FILENAME "Underline.bmp"
// We have to get the DC from the dialog.
// Then we have to paint the underline-bmp in relation to
// the < dialog-info-BMP-position >
// The position of the BMP-resource comes from
// TControl oBmp:nTop and oBmp:nLeft
// now we can calculate the needed position for the
// underline-BMP
The Top- and Left-position of a resource inside of a dialog
Code: Select all
nBlendTop := oBmp:nTop + nBMPHIGHT + 10
nBlendLeft := oBmp:nLeft - 10
// 10 = Distance between bottom of BMP and Top of Underline-BMP
// and left position of Underline-BMP
// we still have to adjust the length and hight of the underline
// for that we need a Right and Bottom for < ABPaint >
ABPaint( oDlg1:GetDC(), Left, Top, Right, Bottom, oBmp2:hBitmap, 255 )
// 0-255 transparency level
// The new Bottom and Right are needed for adjustment to Dialog-Info
//-------------------------------------------------------------------------------
RETURN NIL
Best Regards
Uwe
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
i work with FW.
If you have any questions about special functions, maybe i can help.