Recent

Author Topic: Panel + Image Issue  (Read 17240 times)

DmedZ

  • New Member
  • *
  • Posts: 41
Re: Panel + Image Issue
« Reply #30 on: November 23, 2015, 04:51:57 pm »
Windows 10

DmedZ

  • New Member
  • *
  • Posts: 41
Re: Panel + Image Issue
« Reply #31 on: November 23, 2015, 04:54:42 pm »
Is that a problem? and will the programs behavior be affected based on what windows version is being used?

rvk

  • Hero Member
  • *****
  • Posts: 6111
Re: Panel + Image Issue
« Reply #32 on: November 23, 2015, 05:12:21 pm »
Is that a problem? and will the programs behavior be affected based on what windows version is being used?
I also have Windows 10. Windows 10 doesn;t have Classic theme anymore so it should have worked.

Alpha blending is supported from Windows 2000 and up.

What happens if you change the 170 in the source to 30?? (see attached image of my computer)

Edit: This might be a problem on Windows <8
Quote
Windows 8:  The WS_EX_LAYERED style is supported for top-level windows and child windows. Previous Windows versions support WS_EX_LAYERED only for top-level windows.
So in that case you might need to draw an alphablend image yourself instead of relying on the function in Windows. I'm also not sure if that will work. I assume you also need Windows 7? How far back do you need to support? Another option might be a form with the form as parent.
« Last Edit: November 23, 2015, 05:28:48 pm by rvk »

DmedZ

  • New Member
  • *
  • Posts: 41
Re: Panel + Image Issue
« Reply #33 on: November 23, 2015, 07:32:57 pm »
Well changing the value was the first thing i did but i changed it to "250" instead of going down but i did try "30" and it didnt work as well. I suspect youre talking about this
 
Quote
Win32Extra.SetLayeredWindowAttributes(Panel1.Handle, 0, 170, LWA_ALPHA)
;

I wanted to try a transparent form but firstly it would make everything on the form transparent secondly i worry about how much resources having multiple forms will take up. i already have 6 separate forms up...unless im wrong about this and it doesnt really do much having multiple forms.

rvk

  • Hero Member
  • *****
  • Posts: 6111
Re: Panel + Image Issue
« Reply #34 on: November 23, 2015, 08:54:18 pm »
This is weird. When I tried at home I also got a black panel. Then I tried it again at home with Lazarus 1.5 (trunk) and it worked. I wonder what's different with trunk and Laz1.4 in regards to SetLayeredWindowAttributes.

Anyway, you're correct in saying that everything on the panel would get blended. That's why I thought a hidden panel could be made underneath the original panel and the original panel itself could be transparent (with solid components). That should do the trick. The hidden panel could be made automatically in code.

First I need to see why the SetLayered doesn't work here.

What was you minimum OS version you would need this on?
If you need it on <Win7 you would need to use a transparent Alpha blended image instead of a panel with SetLayeredWindowAttributes. In that case maybe the bgrabitmap8.7 could be used again.

DmedZ

  • New Member
  • *
  • Posts: 41
Re: Panel + Image Issue
« Reply #35 on: November 24, 2015, 05:32:49 pm »
Im thinking about porting this program to .DMG (OSX). So if i could make something work with BGRAPanels in terms of playing with the panel opacity then that would be awesome.

rvk

  • Hero Member
  • *****
  • Posts: 6111
Re: Panel + Image Issue
« Reply #36 on: November 25, 2015, 12:10:42 pm »
Im thinking about porting this program to .DMG (OSX).
Yes, in that case you can't use the default alphablend functions of Windows.
In that case I think we're back to drawing an alphablended image on the panel.
In attached example I used the CopyRect that GetMem used originally.
(Now it "only" needs to be adjusted that the copied image is blurred.)

(Another option could be to use a second image to be copied over this one with alpha-blending. The image could be small and stretched so you don't have to redraw it. Drawing the backgrounded panelImage should be enough.)
« Last Edit: November 25, 2015, 12:12:49 pm by rvk »

balazsszekely

  • Guest
Re: Panel + Image Issue
« Reply #37 on: November 25, 2015, 04:13:52 pm »
@rvk, @DmedZ
What about this(attachment)?

@DmedZ
What controls are on that panel? TImage, TButton? I believe it can be drawn even faster, I just need to know what is on that panel.

rvk

  • Hero Member
  • *****
  • Posts: 6111
Re: Panel + Image Issue
« Reply #38 on: November 25, 2015, 05:00:24 pm »
DmedZ placed a sample-movie of the intended effect here: http://www.filedropper.com/so-preview
... so i just decided to give you a demonstration of the type of effect im looking for in the link below.
------> http://www.filedropper.com/so-preview <-------

But this begins to look like it. At least this should be a good way to reach the effect.

In the sample-movie there is already a blurred image on the background and the panel just makes that darker. (but I'm sure that effect is also possible with BGRA.)

@DmedZ, maybe you can create an actual example with the items (images and components) which should be on a panel.

balazsszekely

  • Guest
Re: Panel + Image Issue
« Reply #39 on: November 25, 2015, 05:11:29 pm »
Quote
... so i just decided to give you a demonstration of the type of effect im looking for in the link below.
------> http://www.filedropper.com/so-preview <-------
Ok, thanks @rvk, it seems to me those are TImages mostly, then everything can be drawn with BGRABitmaps. @DmedZ you should attach that project, or at least a part of it.

 

TinyPortal © 2005-2018