Recent

Author Topic: TBrush.Style .. who? where? what?  (Read 1620 times)

Birger52

  • Sr. Member
  • ****
  • Posts: 309
TBrush.Style .. who? where? what?
« on: July 11, 2020, 12:55:56 pm »
Wanting to draw text on a two-colored background.
Canvas.TextOut() uses current brush as background, so the result is not really what I want.
So figured Brush might have a transparent color - tried clNone, which does not do the trick.
So wanted to try a Brush.style, that does not draw anything.
Tried bsNone - which gives a compile error: found TFormBorderStyle expected TFPBrushStyle.
So tried to find a list of defined values for TFPBorder style ...

There doesn't seem to be any?
Not in SourceForge online, not in build in "documentation".
Lazarus 2.0.8 FPC 3.0.4
Win7 64bit
Playing and learning - strictly for my own pleasure.

Blaazen

  • Hero Member
  • *****
  • Posts: 3237
  • POKE 54296,15
    • Eye-Candy Controls
Re: TBrush.Style .. who? where? what?
« Reply #1 on: July 11, 2020, 01:10:13 pm »
You should use
Code: Pascal  [Select][+][-]
  1. Brush.Style:=bsClear;
which draw transparent text.
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

Birger52

  • Sr. Member
  • ****
  • Posts: 309
Re: TBrush.Style .. who? where? what?
« Reply #2 on: July 11, 2020, 04:00:34 pm »
Thx - figured it out by listing all constants in Graphics.

Still think TFormBorderStyle and/or TFPBrushStyle should be documented somewhere...
Lazarus 2.0.8 FPC 3.0.4
Win7 64bit
Playing and learning - strictly for my own pleasure.

dsiders

  • Hero Member
  • *****
  • Posts: 1052
Re: TBrush.Style .. who? where? what?
« Reply #3 on: July 11, 2020, 04:58:22 pm »
Thx - figured it out by listing all constants in Graphics.

Still think TFormBorderStyle and/or TFPBrushStyle should be documented somewhere...

I'm no sure how TFormBorderStyle applies here, but TBrushStyle in LCL is an alias to TFPBrushStyle in FCL. And nothing in the fcl-image package is documented. I suppose the alias could be documented in LCL.

In any case, I would file a missing docs bug report. Otherwise, it'll get the same amount of attention as any other old forum post.
Preview Lazarus 3.99 documentation at: https://dsiders.gitlab.io/lazdocsnext

jamie

  • Hero Member
  • *****
  • Posts: 6090
Re: TBrush.Style .. who? where? what?
« Reply #4 on: July 11, 2020, 05:26:16 pm »

https://lazarus-ccr.sourceforge.io/docs/lcl/graphics/tcanvas.html


If you scroll down you will see TBrush.. click on that and it gives you a little more details

Also, you can visit Delphi web site and check out the Docs they have for Tbrush.

These are suppose to behave the same, not saying they do but what ever  :D

btw, I did  report some time ago that various items in the canvas was more or less undocumented..

  Like the Pen.Mode etc..
you can find this documentation looking at windows graphics help files because they have the same meaning.
« Last Edit: July 11, 2020, 05:28:25 pm by jamie »
The only true wisdom is knowing you know nothing

wp

  • Hero Member
  • *****
  • Posts: 11853
Re: TBrush.Style .. who? where? what?
« Reply #5 on: July 11, 2020, 05:41:35 pm »
So tried to find a list of defined values for TFPBorder style ...

There doesn't seem to be any?
Not in SourceForge online, not in build in "documentation".

It is much more helpful to learn how to navigate in the sources of Lazarus or FPC (or any other third-party code). So, in any LCL-graphics related code the unit "graphics" should be listed in "uses", and an identifier like "Brush.Style" should be understandable for the IDE. Hold the CTRL key down and left-click on the "Style" in "Brush.Style" --> the IDE opens the unit in which Brush.Style is declared (graphics, of course), in my case, the cursor is in the line "property Style default bsSolid". Since "bsSolid" is one allowed Brush.Style, repeat the same procedure: CTRL-click on "bsSolid" and the IDE will jump to the position where "bsSolid" is declared: "bsSolid = FPCanvas.bsSolid;" - this mean that "bsSolid is an alias for the "bsSolid" of "FPCanvas". So. you repeat with CTRL-clicking on the bsSolid of "FPCanvas.bsSolid" - and this finally brings you to the declaration of TFPBrushStyle in unit FPCanvas:

Code: Pascal  [Select][+][-]
  1. type
  2.   TFPBrushStyle = (bsSolid, bsClear, bsHorizontal, bsVertical, bsFDiagonal,
  3.                    bsBDiagonal, bsCross, bsDiagCross, bsImage, bsPattern);

As you can see, to "no-fill" brush style is called "bsClear".

To learn about these brushes you could open the demo project in the folder examples/canvas_test in your Lazarus installation.

Birger52

  • Sr. Member
  • ****
  • Posts: 309
Re: TBrush.Style .. who? where? what?
« Reply #6 on: July 11, 2020, 08:39:59 pm »
wp - that's helpful and good advice.
Thx.
Lazarus 2.0.8 FPC 3.0.4
Win7 64bit
Playing and learning - strictly for my own pleasure.

 

TinyPortal © 2005-2018