Recent

Author Topic: BGRA Controls  (Read 222260 times)

lainz

  • Hero Member
  • *****
  • Posts: 4460
    • https://lainz.github.io/
Re: BGRA-Controls
« Reply #210 on: October 24, 2016, 03:50:50 pm »
Sorry I don't have a Mac to test it. BTW you can make a small demo to show the problem.

Josh

  • Hero Member
  • *****
  • Posts: 1271
Re: BGRA-Controls
« Reply #211 on: October 25, 2016, 12:51:53 am »
Hi

Done some further testing; the problem surfaces when you change the font that a bgra control is using.
I have uploaded a zipped version; if you change the displayed fonts to something else; then in the code of the button click change the font to another one that is on your system, you will see that in carbon and windows all behaves as it should, but when compiled for cocoa, when you change font the bgra controls no longer display text. However the standard Tlabel is adjusting and scaling.

Please excuse the rough dirty code...

Josh
box of video showing the issue as well
https://app.box.com/s/0pn5pt2wpao3qbh9b8m87c7ve54qyw20

Hope it helps
The best way to get accurate information on the forum is to post something wrong and wait for corrections.

lainz

  • Hero Member
  • *****
  • Posts: 4460
    • https://lainz.github.io/
Re: BGRA-Controls
« Reply #212 on: October 25, 2016, 01:07:47 am »
Hi, that happens only with BCButton and BCLabel or with other controls that contains text like BCImageButton, BCMaterialDesignButton?

Edit: BCImageButton changing text at runtime is not working, try with BCMaterialDesignButton.
« Last Edit: October 25, 2016, 01:17:50 am by lainz »

Josh

  • Hero Member
  • *****
  • Posts: 1271
Re: BGRA-Controls
« Reply #213 on: October 25, 2016, 01:16:49 am »
I will have to check,
I mainly use these controls; I will try with others and report back
The best way to get accurate information on the forum is to post something wrong and wait for corrections.

lainz

  • Hero Member
  • *****
  • Posts: 4460
    • https://lainz.github.io/
Re: BGRA-Controls
« Reply #214 on: October 25, 2016, 01:18:55 am »
I will have to check,
I mainly use these controls; I will try with others and report back

BCImageButton changing text at runtime is not working, try with BCMaterialDesignButton.

Ok yes the thing is that if is not working with MaterialDesignButton I don't know how to fix it. But if is only in BCLabel and BCButton maybe we can try something since these are using a different way to draw things.

Josh

  • Hero Member
  • *****
  • Posts: 1271
Re: BGRA-Controls
« Reply #215 on: October 25, 2016, 01:49:01 am »
Hi

cocoa
When I add a Materialsdesignbutton, then the previous bcbutton and bclabel that scaled before now loose their text when scaled ( even before I change the font).

carbon
adding materialdesignbutton everything is scaling corectly; even after a font change.

Removing the added control and the unit for materialdesign, then under cocoa it is back to behaving as in the video.

So materialdesign makes everything worse in cocoa ( ok for carbon).

Hope that helps.

ps Took a while to find the parameters to adjust in materialsdesign; any reason for params like textsize; textfont etc.
Would not the 'standard' grouping in a font section be better?  Font.name,font.height etc.
Purely an observation.
« Last Edit: October 25, 2016, 01:52:50 am by josh »
The best way to get accurate information on the forum is to post something wrong and wait for corrections.

lainz

  • Hero Member
  • *****
  • Posts: 4460
    • https://lainz.github.io/
Re: BGRA-Controls
« Reply #216 on: October 25, 2016, 01:58:18 am »
Ok basically I can't fix it if it doesn't helps, sorry.

Yes I've used that because I didn't know how to invalidate the control when normal Font property changes, so I've coded that. The ones in BCButton and BCLabel are grouped but aren't the standard Font property too. That's because we need to invalidate under certain conditions to avoid redrawing the bitmaps to save speed, and draw them in some conditions too, so we avoid the standard things. But seems that not using the standard Font does that drawing doesn't works in cocoa as you noticed. But can be also a bug in BGRABitmap and not in bgracontrols, because as you maybe know we don't use the default drawing that comes with lazarus but we use bgrabitmap.

Maybe creating a new control that only uses bgrabitmap for the background and using the default canvas fot the text, and the default Font property will work. But is just an idea, I can't ensure that will work..

circular

  • Hero Member
  • *****
  • Posts: 4195
    • Personal webpage
Re: BGRA-Controls
« Reply #217 on: October 25, 2016, 11:54:52 am »
A similar problem was raise by Josh about cocoa, it is related to bitmap formats, and this affects text rendering:
http://forum.lazarus-ide.org/index.php/topic,34229.msg223695.html
Conscience is the debugger of the mind

Josh

  • Hero Member
  • *****
  • Posts: 1271
Re: BGRA-Controls
« Reply #218 on: October 25, 2016, 01:33:21 pm »
Hi Circular,
This is slghtly different, I can scale a control in cocoa and all is fine; the problem is when I assign the font in code to the controls; the fonts then totally vanish.
WHen I add a materialdesign button to form then the controls do not resize at all; removing the materialdesign then I am back to the the scaling woring until I change the font.

Not sure if you have watch the vid I uploaded it shows the issue pretty well, as this has non bgra controlls, ie tabel, timage. that scale correctly when  the font s changed.

I have not used BGRABITMAP directly; so if you have a sample application I can try that does roughly what the test vid does; I will gladly try this to narrow down where the issue lies.
The best way to get accurate information on the forum is to post something wrong and wait for corrections.

circular

  • Hero Member
  • *****
  • Posts: 4195
    • Personal webpage
Re: BGRA-Controls
« Reply #219 on: October 25, 2016, 01:38:34 pm »
Oh I see what you're saying. That's a bit mysterious. What would help indeed I suppose would be to narrow it to a simpler example.

For example if you create a TBGRABitmap, set the font name and draw on it, would you get the same error?

See:
http://wiki.freepascal.org/BGRABitmap_tutorial_12
« Last Edit: October 25, 2016, 01:43:40 pm by circular »
Conscience is the debugger of the mind

Josh

  • Hero Member
  • *****
  • Posts: 1271
Re: BGRA-Controls
« Reply #220 on: October 25, 2016, 11:40:57 pm »
Hi

I done some mods to the test4lcl so that when i dbl click the form it changes the font.

This works fine in carbon, but cocoa no text is displayed. ( graphics are displayed );

I added

Code: [Select]
procedure TForm1.FormDblClick(Sender: TObject);
begin
  if fnt='Eurostile' then FNT:='Gill SANS MT'
  else  if fnt='Gill SANS MT' then FNT:='Century Gothic'
  else if fnt='Century Gothic' then FNT:='Eurostile'
end;           

and also added into draw routine
Code: [Select]
procedure DrawEllipseHello(bmp: TBGRABitmap);
var br: TBGRACustomBitmap;
begin
  bmp.FontName:=fnt;   

and declared gobal var fnt:string='Eurostile';

Hope that helps; I can do a vid if you like; but its just a blank screen with gradiated form.
« Last Edit: October 25, 2016, 11:42:46 pm by josh »
The best way to get accurate information on the forum is to post something wrong and wait for corrections.

circular

  • Hero Member
  • *****
  • Posts: 4195
    • Personal webpage
Re: BGRA-Controls
« Reply #221 on: October 26, 2016, 04:51:33 pm »
So does it mean that with Arial font it works and with other fonts it doesn't work?
Conscience is the debugger of the mind

Josh

  • Hero Member
  • *****
  • Posts: 1271
Re: BGRA-Controls
« Reply #222 on: October 26, 2016, 06:00:21 pm »
Hi Circular

I have tried using Arial as one of the fonts and this does not work when it is assigned in the control, if you leave out the font definition then it will scale correctly, as soon as you explicitly set the font name; then nothing renders.
With lcl controls like tlabel etcl these scale and change font correctly in cocoa.

It appears as though ant change of the Font Name causes a problem; not sure whether BGRABITMAO is changing the font name in any way ie chaninging its case; as cocoa requires the Font case to be 100% correct.

Not sure if any of that helps.
The best way to get accurate information on the forum is to post something wrong and wait for corrections.

lainz

  • Hero Member
  • *****
  • Posts: 4460
    • https://lainz.github.io/
Re: BGRA-Controls
« Reply #223 on: October 26, 2016, 07:46:57 pm »
What if you change Bitmap.Canvas.Font and draw text with that canvas, not using BGRABitmap direct text functions?

Josh

  • Hero Member
  • *****
  • Posts: 1271
Re: BGRA-Controls
« Reply #224 on: October 26, 2016, 08:39:36 pm »
Hi Lainz,

I can try that later.

I have been trying some other components.

TPanel caption is also not showing in cocoa, so I will report this as another cocoa bug, and see if I get response.

Josh
The best way to get accurate information on the forum is to post something wrong and wait for corrections.

 

TinyPortal © 2005-2018