Page 1 of 1

Ayuda Brush Ventana y Parpadeo

PostPosted: Wed Jan 14, 2015 4:55 pm
by jmartial
Hola,

Necesitaría poner una ventana maximizada con una imágen de fondo, hasta ahí bien, creo un brush con la imágen y la asigno.
Pero después de unos segundos necesito cambiar esa imágen de fondo por otra, la cambio asignando otro brush. Pero se nota el PARPADEO.

¿Conocéis alguna forma de cambiar una imágen de fondo de una ventana, por otra sin que se note ningún parpadeo?

Re: Ayuda Brush Ventana y Parpadeo

PostPosted: Wed Jan 14, 2015 5:08 pm
by Antonio Linares
Joaquín,

Puedes mostrar el código para ver como lo haces ?

Re: Ayuda Brush Ventana y Parpadeo

PostPosted: Wed Jan 14, 2015 5:22 pm
by jmartial
Antonio,

El código es muy largo, pero si te sirve, uso esto antes del Activate:

oBrush := TBrush():new( ,,,, ResizeBmp( ::oBmpFondo:hBitmap, ::nAnchoPant,::nAltoPant, .T. ) )
::oBmpFondo:End()
::oWnd:setBrush( oBrush )
oBrush:end()

Luego para cambiar, otra brush definida antes:

::oWnd:setBrush( oBrush2 )

Al cambiar a éste segundo, se nota el parpadeo.

Re: Ayuda Brush Ventana y Parpadeo

PostPosted: Wed Jan 14, 2015 5:38 pm
by Antonio Linares
Joaquin,

Prueba a usar el pintado a doble buffer:

local aInfo := ::oWnd:DispBegin()

::oWnd:SetBrush( oBrush2 )

::oWnd:DispEnd( aInfo )

Re: Ayuda Brush Ventana y Parpadeo

PostPosted: Thu Jan 15, 2015 7:24 am
by nageswaragunupudi
jmartial wrote:Hola,

Necesitaría poner una ventana maximizada con una imágen de fondo, hasta ahí bien, creo un brush con la imágen y la asigno.
Pero después de unos segundos necesito cambiar esa imágen de fondo por otra, la cambio asignando otro brush. Pero se nota el PARPADEO.

¿Conocéis alguna forma de cambiar una imágen de fondo de una ventana, por otra sin que se note ningún parpadeo?


You do not need to do any coding. Define a brush with your image with style STRETCH or RESIZE.
Example:

Code: Select all  Expand view

DEFINE BRUSH oBrush FILE <your image file> STRETCH
DEFINE WINDOW oWnd
oWnd:SetBrush( oBrush )
ACTIVATE WINDOW oWnd
RELEASE BRUSH oBrush
 

Now the whenever the window is resized, the brush automatically gets resized (stretched) to fit the client area of the window. The brush object automatically handles the resizing. Resizing is smooth without any flickers.

For Image file, you can use bmp, jpg, png or any other image format.

You do not have to write any code to keep resizing the brush. We recommend you not to.

Brush object supports two kinds of resizing:
1) STRETCH: The entire image is resized to the width and height of the client area of the window. This can distort the image. Particularly if the image contains a photo the faces may get too widely or narrowly streched.
2) RESIZE: Image will be resized retaining the proportion of width/height of the original image to the extent that the window is fully covered with the image.

Eg: DEFINE BRUSH oBrush FILE "myphoto.jpg" RESIZE

You can also use Brush object for Gradients.

DEFINE BRUSH oBrush GRADIENT aGradient VERTICAL (or) HORIZONTAL.
This brush also gets resized with the window automatically.

These resizable brushes were first introduced in FWH 11.05.

Re: Ayuda Brush Ventana y Parpadeo (Solucionado)

PostPosted: Thu Jan 15, 2015 9:03 am
by jmartial
Muchas Gracias Rao,

DEFINE BRUSH oBrush FILE <your image file> STRETCH

Funcionó perfecto y sin parpadeos!!!!



Thank you, very much.