Say Transparent...problems - ( Gradient Partial )

Say Transparent...problems - ( Gradient Partial )

Postby Ale SB » Mon Apr 22, 2013 2:59 pm

In recent versions, there are problems of Transparency, using the Function GradientFill(...).

There is another type of solution?

We would like to continue using Gradient partial screen!!!

Image

Image

Code: Select all  Expand view

#include "fivewin.ch"

********************************************************************************
function Test_Gradient_Partial()
********************************************************************************  
  local aGrad1 := { { 0.50, nRGB( 219, 230, 244 ), nRGB( 207, 221, 239 ) }, ;
                    { 0.50, nRGB( 201, 217, 237 ), nRGB( 231, 242, 255 ) } }
  local aGrad2 := { { 1, nRGB( 100, 200, 100 ), nRGB( 255, 230, 200 ) } }
  local oDlg, oFontA12B
 
  DEFINE FONT oFontA12B NAME "Arial" SIZE 0,-12 BOLD ITALIC
  DEFINE DIALOG oDlg TITLE "Test Gradient Partial"
                oDlg:oFont        := oFontA12B
                oDlg:lTransparent := .T.                    
                oDlg:nTop         := 0
                oDlg:nLeft        := 0
                oDlg:nBottom      := 286
                oDlg:nRight       := 307
                     oDlg:nStyle       := nOR( DS_MODALFRAME, DS_SYSMODAL, WS_POPUP, WS_CAPTION, WS_SYSMENU )                    
                     oDlg:SetColor( , nRGB( 255, 255, 25 ) )
     
    @ 08, 04 SAY oSay PROMPT "GRADIENT PARTIAL TOP - GradientFill(...)" OF oDlg SIZE 145, 10 PIXEL  TRANSPARENT update
    @ 70, 04 SAY oSay VAR FWVERSION OF oDlg SIZE 145, 10 PIXEL  TRANSPARENT update
    @ 82, 04 SAY oSay PROMPT "oDlg:SetColor( , nRGB( 255, 255, 25 ) )" OF oDlg SIZE 145, 10 PIXEL  TRANSPARENT update
     @ 130, 04 SAY oSay PROMPT "GRADIENT PARTIAL BOTTOM - GradientFill(...)" OF oDlg SIZE 145, 10 PIXEL  TRANSPARENT update
   
  ACTIVATE DIALOG oDlg CENTERED ;
           ON Paint ( GradientFill( oDlg:hDC, 0, 0, oDlg:nHeight/5, oDlg:nWidth, aGrad1 ),;
                         GradientFill( oDlg:hDC, oDlg:nBottom-40, 0, oDlg:nHeight, oDlg:nWidth, aGrad2 ) )
 
return nil
 


Regards, Ale SB
aleseribeli@hotmail.com

FwH, Hb Svn, ADS 8.1, ADS 10, Pelles C, FwPPC, MsVc 2008, MsVc 2010
"Conhecimento, você não subtrai quando divide; mas soma e multiplica."
**---Mário Persona---**
User avatar
Ale SB
 
Posts: 248
Joined: Wed Jan 11, 2006 11:30 am
Location: Campo Grande-MS / Brasil

Re: Say Transparent...problems - ( Gradient Partial )

Postby ukoenig » Wed Apr 24, 2013 6:01 pm

TRANSPARENT Controls on Multiple Gradient
I will create a little tool, adding some Sliders to test/define color/gradient-positions
as well there will be 4 Color-selectors and Text color-selection ( VISUAL DESIGN )

It looks better, using the same connection-color :

Image

Your color-selection :

Image

2 Gradients and 1 Color :

Image

Best Regards
Uwe :lol:
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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Say Transparent...problems - ( Gradient Partial )

Postby Ale SB » Thu Apr 25, 2013 12:49 pm

Ukoenig;
is a good idea!
Can you show me your code Gradient?

I'm doing some testing with FixSays (...), ultilizando in class tdialog ...

FixSays (:: hWnd, GetStockObject (NULL_BRUSH)) works, but if I take a refresh at Say he loses transparency.

But thanks for the tip.

Regards, Ale SB
aleseribeli@hotmail.com

FwH, Hb Svn, ADS 8.1, ADS 10, Pelles C, FwPPC, MsVc 2008, MsVc 2010
"Conhecimento, você não subtrai quando divide; mas soma e multiplica."
**---Mário Persona---**
User avatar
Ale SB
 
Posts: 248
Joined: Wed Jan 11, 2006 11:30 am
Location: Campo Grande-MS / Brasil

Re: Say Transparent...problems - ( Gradient Partial )

Postby ukoenig » Thu Apr 25, 2013 2:57 pm

Ale SB,

that shows the basic

Code: Select all  Expand view

STATIC aGrad1, nTop1, nBottom1,aGrad2, nTop2, nBottom2
STATIC aGrad3, nTop3, nBottom3

FUNCTION MAIN()
LOCAL oWnd, aRect[4]

c_path := cFilePath(GetModuleFileName( GetInstance() ) )
c_path1 := c_path + "IMAGES\"

nColor2a := 14853684
nColor2b := 16312263
nMove2  := 0.50
lDirect2    := .T.
aGrad1  := { { 0.3, nColor2a, nColor2b }, { nMove2, nColor2b, nColor2a } }
aGrad2  := { { 0.3, nColor2a, 255 }, { nMove2, 255, nColor2a } }
//aGrad1 := { { 0.50, nRGB( 219, 230, 244 ), nRGB( 207, 221, 239 ) }, ;
//                    { 0.50, nRGB( 201, 217, 237 ), nRGB( 231, 242, 255 ) } }
//aGrad2 := { { 1, nRGB( 100, 200, 100 ), nRGB( 255, 230, 200 ) } }
aGrad3  := { { 0.1, 16744448, 16744448 }, { 0.1, 16744448, 16744448 } }

oFont1 := TFont():New("
Arial", ,-30,.F.,.T. , , , ,.T. )
oFont2 := TFont():New("
Arial", ,-24,.F.,.T. , , , ,.T. )

aRect[3] := GetSysmetrics( 1 ) - 25 // Screen-Height
aRect[4] := GetSysmetrics( 0 ) // Screen-Width

DEFINE WINDOW oWnd STYLE nOr( WS_POPUP, WS_VISIBLE )

ACTIVATE WINDOW oWnd ;
ON CLICK oWnd:End() ;
ON INIT ( oWnd:Move( 0, 0, aRect[4], aRect[3], .f. ) , ; // Top, left, width, height
                 W_BACKGRD( oWnd, "
Backgrd.png", .F. ), SHOW_DLG( oWnd ) )

oFont1:End()
oFont2:End()

RETURN NIL

// ------------

FUNCTION SHOW_DLG( oWnd )
LOCAL oDlg, oBtn30, nRadio3 := 1, lCheck3 := .T.
LOCAL oSay3, oRadio3, oCheck3, oBrush5
LOCAL oSlide, oSlide1, oSlide2, oSlide3
LOCAL nVar1 := 150, nVar2 := 100, nVar3 := 150

DEFINE DIALOG oDlg FROM 50, 50 TO 500, 800  PIXEL ;
TITLE "
Dialog GRADIENT"  

@ 15, 15 SAY oSay3 PROMPT "
Transparent Say" OF oDlg SIZE 150, 20 FONT oFont1 PIXEL
oSay3:SetColor( 255, )
oSay3:lTransparent := .T.

@ 50, 15 RADIO oRadio3 VAR nRadio3 OF oDlg PIXEL ;
ITEMS "
Option &1", "Option &2" _3D SIZE 70, 20 COLOR 0 ; // 16443068 ;
HELPID 100, 101 ;
ON CHANGE MsgBeep()
oRadio3:SetFont( oFont1 )
AEval( oRadio3:aItems, { | oRad | oRad:lTransparent := .T. } )

@ 130, 15 CHECKBOX oCheck3 VAR lCheck3  COLOR 8454143 PIXEL ;
PROMPT "
&ClickMe" OF oDlg SIZE 80, 15 ;
ON CHANGE oCheck3:SetText( "
New Text" )
oCheck3:lTransparent := .T.
oCheck3:SetFont( oFont1 )

@ 190, 220 BTNBMP oBtn30 OF oDlg ;
SIZE 150 , 25  PROMPT "
EXIT Gradient-test" 2007 ;
FONT oFont2 ;
LEFT ;
NOBORDER ;
FILENAME c_Path + "
\Images\Close.bmp" ;
ACTION  oDlg:End()

oBtn30:SetColor( 128, )
oBtn30:cTooltip :=  { "
EXIT" + CRLF + ;
     "
Gradient-test","GRADIENT", CLR_BLACK, 14089979 }

ACTIVATE DIALOG oDlg  ;
ON INIT GRADBRUSH(oDlg, aGrad1, 0, 200, ; // Top, Bottom
               aGrad2, 200, 350, ; // Top, Bottom
               aGrad3, 350, 500)  // Top, Bottom

RETURN NIL

//--------------------------------------------

STATIC FUNCTION GRADBRUSH(oDlg, aGrad1, nTop1, nBottom1, ;
     aGrad2, nTop2, nBottom2, ;
     aGrad3, nTop3, nBottom3)
LOCAL hDC, oBrush, oImage

hDC = CreateCompatibleDC( oDlg:GetDC() )
hBmp = CreateCompatibleBitMap( oDlg:hDC, oDlg:nWidth, oDlg:nHeight )
hBmpOld = SelectObject( hDC, hBmp )

// 1. Gradient
GradientFill( hDC, nTop1, 0, nBottom1, oDlg:nWidth, aGrad1 )
// 2. Gradient
GradientFill( hDC, nTop2, 0, nBottom2, oDlg:nWidth, aGrad2 )
// Cokor
GradientFill( hDC, nTop3, 0, nBottom3, oDlg:nWidth, aGrad3 ) // Gradient created as COLOR

DeleteObject( oDlg:oBrush:hBrush )
oDlg:oBrush:hBitmap = hBmp
oDlg:oBrush:hBrush = CreatePatternBrush( hBmp )
SelectObject( hDC, hBmpOld )

oDlg:ReleaseDC()

RETURN( NIL )

// --------  WINDOW - Background ---------------

FUNCTION W_BACKGRD( oWnd, cImage, lAdjust )
LOCAL oBrush, oBrush1, hDC, oImage, aRect, lAlpha

IF FILE( c_path1 + cImage )
     DEFINE IMAGE oImage FILE c_path1 + cImage
     nIWidth := oImage:nWidth
     nIHeight := oImage:nHeight
     // Border = 15 added !!!
     aRect := GETCLIENTRECT( oWnd:hWnd )
     oBrush := TBrush():new( ,,,, ResizeBmp( oImage:hBitmap,  aRect[4], aRect[3], .T. ) )
     oWnd:SetBrush( oBrush )
     oBrush:End()
     oImage:End()

     // stop windows-resize !!!
     oWnd:aMinMaxInfo = {   oWnd:nWidth, oWnd:nHeight ,;    // xMaxSize,      yMaxSize
     oWnd:nTop,  oWnd:nWidth ,;         // xMaxPosition,  yMaxPosition
     oWnd:nWidth, oWnd:nHeight  ,;  // xMinTrackSize, yMinTrackSize
     oWnd:nWidth, oWnd:nHeight  }   // xMaxTrackSize, yMaxTrackSize
ELSE
     IF !EMPTY(cImage)
          MsgAlert( "
File : " + cImage + CRLF + ;
                "
does not exist" + CRLF + ;
                "
to show Image !", "ATTENTION" )
     ENDIF
ENDIF

RETURN( NIL )
 


Best Regards
Uwe :lol:
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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Say Transparent...problems - ( Gradient Partial )

Postby Ale SB » Thu Apr 25, 2013 9:39 pm

Ukoenig;

helped us a lot,

thank you !

Regards, Ale SB
aleseribeli@hotmail.com

FwH, Hb Svn, ADS 8.1, ADS 10, Pelles C, FwPPC, MsVc 2008, MsVc 2010
"Conhecimento, você não subtrai quando divide; mas soma e multiplica."
**---Mário Persona---**
User avatar
Ale SB
 
Posts: 248
Joined: Wed Jan 11, 2006 11:30 am
Location: Campo Grande-MS / Brasil

Re: Say Transparent...problems - ( Gradient Partial )

Postby nageswaragunupudi » Fri Apr 26, 2013 4:41 pm

Can we not simplify this program using the latest features like GRADIENT clause?
Also we can derive one combined aGrad array from multiple Grad arrays.
Code: Select all  Expand view
function TestGradPartial()

   local oDlg, oFont, oBrush
   local aGrad

   aGrad := { { 0.10, RGB( 219, 230, 244 ), RGB( 207, 221, 239 ) }, ;
              { 0.10, RGB( 201, 217, 237 ), RGB( 231, 242, 255 ) }, ;
              { 0.51, RGB( 255, 255,  25 ), RGB( 255, 255,  25 ) }, ;
              { 0.29, RGB( 100, 200, 100 ), RGB( 255, 230, 200 ) }  }

   DEFINE FONT oFont NAME "Arial" SIZE 0,-12 BOLD ITALIC
   DEFINE DIALOG oDlg TITLE "Test Gradient Partial" ;
      FROM 0,0 TO 307,286 PIXEL ;
      COLOR CLR_BLACK, RGB( 255, 255, 25 ) ;
      FONT oFont GRADIENT aGrad TRANSPARENT

   @  08, 04 SAY "GRADIENT PARTIAL TOP - GradientFill(...)" OF oDlg SIZE 145, 10 PIXEL
   @  70, 04 SAY FWVERSION OF oDlg SIZE 145, 10 PIXEL
   @  82, 04 SAY "oDlg:SetColor( , nRGB( 255, 255, 25 ) )" OF oDlg SIZE 145, 10 PIXEL
   @ 130, 04 SAY "GRADIENT PARTIAL BOTTOM - GradientFill(...)" OF oDlg SIZE 145, 10 PIXEL

   ACTIVATE DIALOG oDlg
   RELEASE FONT  oFont

return nil


Screenshot:
Image
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Say Transparent...problems - ( Gradient Partial )

Postby ukoenig » Fri Apr 26, 2013 5:40 pm

Mr. Rao,
it works, but with some restrictions :
a style-combination ( horizontal / vertical ) is not possible
also to define the position of the colors inside a gradient ( 0 - 1 ).

Image

Best Regards
Uwe :lol:
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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Say Transparent...problems - ( Gradient Partial )

Postby ukoenig » Sun Apr 28, 2013 10:10 am

The first results of the painter.
It saves much work, because You can create a Dialog in DESIGN-MODE.

Image

Create the needed Gradients and define the Textcolors

Image

Define Dialog-size and Gradient-sections
for the section-define, Splitters are used

Image

Display the Design-result with selected Sections, Gradient and Dialog-size:
You can MOVE the Controls, to test the Textcolors with the Gradients.
The selected Control-positions together with the other defines are saved to a DBF.

Image

Best Regards
Uwe :lol:
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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Say Transparent...problems - ( Gradient Partial )

Postby ukoenig » Sun May 12, 2013 12:20 pm

Hello,

With the new Release it will be possible,
to split in DESIGN-mode a dialog in 3 sections with any brush-combination :

Resize in DESIGN-mode

Image

Select any combination of sections

Image

Best Regards
Uwe :lol:
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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot], jmartial and 116 guests