Recent

Author Topic: TBCPanel transparency bug  (Read 4553 times)

MiniQ

  • Newbie
  • Posts: 5
TBCPanel transparency bug
« on: October 08, 2014, 11:25:39 am »
I noticed an error rendering TBCPanel. On the example of the two panels with rounding are nested.
This is a wrong rendering.https://cloud.mail.ru/public/8b8e4869af99%2F2panels_wrong.png
This is the correct rendering.https://cloud.mail.ru/public/5a0d5ed4599b%2F2panels_right.png

The project is attached.https://cloud.mail.ru/public/23517d090764%2FBGRA_bug.zip

circular

  • Hero Member
  • *****
  • Posts: 4220
    • Personal webpage
Re: TBCPanel transparency bug
« Reply #1 on: October 08, 2014, 06:16:51 pm »
The thing is TBCPanel does not handle transparency. So the only you can do is to fill the background with the adequate color.
Conscience is the debugger of the mind

MiniQ

  • Newbie
  • Posts: 5
Re: TBCPanel transparency bug
« Reply #2 on: October 09, 2014, 10:03:16 am »
The thing is TBCPanel does not handle transparency.
What is the reason?
Quote
So the only you can do is to fill the background with the adequate color.
Yes, I have tried to do so, but it does not solve the problem. https://cloud.mail.ru/public/94adf589a101%2F2panels_with_parent_bg.png
« Last Edit: October 09, 2014, 10:05:23 am by MiniQ »

riad02

  • New Member
  • *
  • Posts: 11
Re: TBCPanel transparency bug
« Reply #3 on: October 09, 2014, 10:28:14 am »
SetShape, can work?

MiniQ

  • Newbie
  • Posts: 5
Re: TBCPanel transparency bug
« Reply #4 on: October 09, 2014, 10:44:50 am »
I have examined the implementation TBCLabel and TBCButton, there not used SetShape.

circular

  • Hero Member
  • *****
  • Posts: 4220
    • Personal webpage
Re: TBCPanel transparency bug
« Reply #5 on: October 09, 2014, 11:10:27 am »
Otherwise, what you can do is use TBGRAGraphicControl. It handles transparency, however it is not possible to put subcontrols in it.

Or you can also draw the subpanel yourself in the OnAfterRenderBCPanel of the main panel, and put the subcontrols in the main panel.

Or you can put a TBGRAShape (set Angle property to 45) in the main panel and the other subcontrols on top of it.
« Last Edit: October 09, 2014, 11:16:19 am by circular »
Conscience is the debugger of the mind

MiniQ

  • Newbie
  • Posts: 5
Re: TBCPanel transparency bug
« Reply #6 on: October 09, 2014, 01:57:17 pm »
circular, thanks for the tips, I still made ​​a dirty hack to their tasks in the source TBCPanel. But overall conceptual problem does not solve.

circular

  • Hero Member
  • *****
  • Posts: 4220
    • Personal webpage
Re: TBCPanel transparency bug
« Reply #7 on: October 09, 2014, 03:21:47 pm »
Quote
I still made ​​a dirty hack to their tasks in the source TBCPanel
I do not understand.

Quote
But overall conceptual problem does not solve.
I agree. This depends on the LCL.
Conscience is the debugger of the mind

MiniQ

  • Newbie
  • Posts: 5
Re: TBCPanel transparency bug
« Reply #8 on: October 10, 2014, 03:53:52 am »
Quote
I still made ​​a dirty hack to their tasks in the source TBCPanel
I do not understand.
I had this in mind
Code: [Select]
procedure TCustomBCPanel.Render;
var r: TRect;
begin
  if (csCreating in FControlState) or IsUpdating then
    Exit;

  FBGRA.NeedRender := False;

  FBGRA.SetSize(Width, Height);
////////////////////
  if Parent.ClassNameIs(TControl.ClassName) then
   FBGRA.Fill(Parent.Color)
  else if Parent.ClassNameIs(TBCPanel.ClassName) then
   FBGRA.Fill(TCustomBCPanel(Parent).Background.Color)
  else
   FBGRA.Fill(BGRAPixelTransparent);
/////////////////
  RenderBackground(FBGRA.ClipRect, FBackground, TBGRABitmap(FBGRA), FRounding);
  r := FBGRA.ClipRect;

  case FBorderBCStyle of   
...

circular

  • Hero Member
  • *****
  • Posts: 4220
    • Personal webpage
Re: TBCPanel transparency bug
« Reply #9 on: October 11, 2014, 01:17:57 am »
Well the idea is the good one. This mechanism of course would not be generic, it would need to have a control underneath that can be handled.

You could go even further by puting the image of the control underneath (with the right offset).
Conscience is the debugger of the mind

 

TinyPortal © 2005-2018