xbrowse gradiente con bitmap

xbrowse gradiente con bitmap

Postby fgondi » Tue Apr 13, 2010 12:24 pm

Al incluir que la fila selecciona del browse se muestre con el fondo en gradiente los bitmap del mismo se muestran con un fondo negro:

Image

Si en el mismo browse quito el gradiente y lo dejo con un color solido de fondo para la fila selecciona, funciona correctamente.

Con el gradiente y obrw:lTransparent := .T. tambien funciona bien pero no muestra el color indicado en bclrstd.
Code: Select all  Expand view
oBrw:bClrStd          := { || if( ::oRs<>NIL .and. ::oRs:AbsolutePosition % 2 == 0, { CLR_BLACK, CLR_BRWFONDO1 }, { CLR_BLACK, CLR_BRWFONDO2} ) }
Un saludo
Fernando González Diez
ALSIS Sistemas Informáticos
User avatar
fgondi
 
Posts: 694
Joined: Fri Oct 07, 2005 6:58 am
Location: Palencia, España

Re: xbrowse gradiente con bitmap

Postby nageswaragunupudi » Tue Apr 13, 2010 2:12 pm

Alpha bitmaps are painted correctly over gradient rows, but not normal bitmaps.

You may try this fix to xbrowse.prg:
Locate the following code in xbrowse.prg in method PaintData.
Code: Select all  Expand view
     else
         if SetAlpha() .and. aBitmap[ BITMAP_ALPHA ]
            ABPaint( hDC, nBmpCol, nBmpRow,aBitmap[ BITMAP_HANDLE ], ::nAlphaLevel() )
         else
            if ::oBrw:lTransparent // transparent bitmaps with brush
 

Please change the last line as:
Code: Select all  Expand view
           if ::oBrw:lTransparent .or. ValType( aColors[ 2 ] ) == 'A'
 

With this change non-alpha bitmaps are also painted correctly on gradient rows.
Regards

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

Re: xbrowse gradiente con bitmap

Postby fgondi » Tue Apr 13, 2010 2:52 pm

Muchas gracias por la respuesta.

Ya no muestra el borde negro pero lo muestra con el color de fondo del browse

Image

De todas formas trataré de trabajar con imagenes alpha.
Un saludo
Fernando González Diez
ALSIS Sistemas Informáticos
User avatar
fgondi
 
Posts: 694
Joined: Fri Oct 07, 2005 6:58 am
Location: Palencia, España

Re: xbrowse gradiente con bitmap

Postby nageswaragunupudi » Tue Apr 13, 2010 4:15 pm

If you want to solve this issue also, please do one more correction to xbrowse.prg method PaintData
Locate this line:
Code: Select all  Expand view
     // Paint bitmaps
      DEFAULT aBitmap[ BITMAP_ZEROCLR ] := GetZeroZeroClr( hDC, aBitmap[ BITMAP_HANDLE ] )
 

Please remove "DEFAULT".
Revised code is:
Code: Select all  Expand view
     // Paint bitmaps
      aBitmap[ BITMAP_ZEROCLR ] := GetZeroZeroClr( hDC, aBitmap[ BITMAP_HANDLE ] )
 

Now for testing, I am posting here a modified xbrowgrd.prg from samples folder:
Code: Select all  Expand view
#include 'fivewin.ch'
#include 'xbrowse.ch'

function Main()

   local oDlg, oBrw, oFont
   local aRowGrad, aSelGrad, aStdGrad

   local n := RGB( 157, 248, 255 )

   XbrNumFormat( 'E', .t. )

   aRowGrad := { { .5, RGB(  0,251,220), RGB(221,255,251) }, ;
                 { .5, RGB(221,255,251), RGB(  0,251,220) } }

   aSelGrad := { { .5, RGB(255,224,126), RGB(255,255,193) }, ;
                 { .5, RGB(255,255,193), RGB(255,224,126) } }

   USE CUSTOMER ALIAS CUST

   DEFINE FONT oFont NAME 'Tahoma' SIZE 0,-14
   DEFINE DIALOG oDlg SIZE 640,440 PIXEL ;
      FONT oFont TITLE 'XBrowse Gradient Rows FWH 9.12'

   @ 10,10 XBROWSE oBrw OF oDlg ;
      SIZE -10,-10 PIXEL ;
      COLUMNS 'FIRST', 'HIREDATE', 'MARRIED', 'SALARY' ;
      ALIAS 'CUST' LINES NOBORDER

   oBrw:Married:SetCheck()  // Default FWH Bitmap is Alpha

   WITH OBJECT oBrw:First
      :AddBitmap( '\fwh\bitmaps\open2.bmp' ) // non-alpha bitmap
      :bBmpData   := { || 1 }
   END

   WITH OBJECT oBrw:HireDate
      :AddBitmap( '\fwh\bitmaps\Alphabmp\task.bmp' )  // alpha
      :bBmpData   := { || 1 }
   END

   WITH OBJECT oBrw
      :nStretchCol   := 1
      :nMarqueeStyle := 4
      :bClrSelFocus  := { || { CLR_BLACK, aSelGrad } }
      :bClrRowFocus  := { || { CLR_BLACK, aRowGrad } }
   END

   oBrw:CreateFromCode()

   ACTIVATE DIALOG oDlg CENTERED
   CLOSE CUST
   RELEASE FONT oFont

return nil
 

Before corrections:
Image

Column 1 is normal bitmap and columns 2 and 3 are Alpha bitmaps.

After making the two corrections to xbrowse.prg

Image
The TWO corrections should solve the issue. Please check with your bitmaps and I hope you will get acceptable result.

In any case we get a better appearance with Alpha Bitmaps.
Regards

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

Re: xbrowse gradiente con bitmap

Postby fgondi » Tue Apr 13, 2010 6:58 pm

Muchas gracias por toda la ayuda

He cambiado las imagenes a Alpha y mejora mucho la visión de las mismas.

Lo que he notado es que la imagen parece que muestra un pequeño borde
Image

La columna la defino:
Code: Select all  Expand view
oCol:SetCheck( { IMG1_CHECKON, IMG1_CHECKOFF } )
Un saludo
Fernando González Diez
ALSIS Sistemas Informáticos
User avatar
fgondi
 
Posts: 694
Joined: Fri Oct 07, 2005 6:58 am
Location: Palencia, España

Re: xbrowse gradiente con bitmap

Postby fgondi » Tue Apr 27, 2010 2:56 pm

Perdón por la tardanza en contestar.

Aplicando los cambios que mencionas, las imagenes de 24 bits se muestran perfectamente

Muchas gracias por tu ayuda.
Un saludo
Fernando González Diez
ALSIS Sistemas Informáticos
User avatar
fgondi
 
Posts: 694
Joined: Fri Oct 07, 2005 6:58 am
Location: Palencia, España


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 4 guests