Recent

Author Topic: Mystery in a french tuto  (Read 1431 times)

jipété

  • Full Member
  • ***
  • Posts: 194
Mystery in a french tuto
« on: June 04, 2024, 10:08:22 am »
Hello,

One can read, page https://lazarus.developpez.com/cours/bgrabitmap/#LVI, the line
Code: Pascal  [Select][+][-]
  1. image.InvalidateBitmap; // changé par accès direct
What does it mean ?

Because using Ctrl-Click I've discovered, in unibitmap.inc, line 2249 :
Code: Pascal  [Select][+][-]
  1. procedure TCustomUniversalBitmap.InvalidateBitmap;
  2. begin
  3.   //not linked to a bitmap
  4. end;

So I commented out the "strange" line in the Scanline's code and everything stills works fine.
Thanks for explanation.

Best regards and have a nice day,

And also thanks for that tuto, it's exactly what I need : fast, simple, working well, happiness !

TRon

  • Hero Member
  • *****
  • Posts: 4377
Re: Mystery in a french tuto
« Reply #1 on: June 04, 2024, 11:09:58 pm »
What does it mean ?
Wiki states:

Quote
Basically, BGRABitmap can store an image that may not be drawable as such, not a bitmap object of the system. In order to keep track of changes, the function InvalidateBitmap is called whenever pixel data is modified. So when the bitmap object is requested, the library knows that it needs to be rebuilt.

To sum up, the only time a regular user would call this function is after modifying pixels pointed to by Data / ScanLine directly and before drawing the bitmap or requesting the bitmap object.

Quote
So I commented out the "strange" line in the Scanline's code and everything stills works fine.
Please do not do that and follow the guidelines as expressed. It is there for a reason.
Today is tomorrow's yesterday.

lainz

  • Hero Member
  • *****
  • Posts: 4741
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: Mystery in a french tuto
« Reply #2 on: June 05, 2024, 02:15:27 am »
Hello,

One can read, page https://lazarus.developpez.com/cours/bgrabitmap/#LVI, the line
Code: Pascal  [Select][+][-]
  1. image.InvalidateBitmap; // changé par accès direct
What does it mean ?

Because using Ctrl-Click I've discovered, in unibitmap.inc, line 2249 :
Code: Pascal  [Select][+][-]
  1. procedure TCustomUniversalBitmap.InvalidateBitmap;
  2. begin
  3.   //not linked to a bitmap
  4. end;

So I commented out the "strange" line in the Scanline's code and everything stills works fine.
Thanks for explanation.

Best regards and have a nice day,

And also thanks for that tuto, it's exactly what I need : fast, simple, working well, happiness !

The thing is you are not using universal bitmap. But the descendant for your platform...

jipété

  • Full Member
  • ***
  • Posts: 194
Re: Mystery in a french tuto
« Reply #3 on: June 05, 2024, 11:02:07 am »
Hello,

Thanks for that, I don't know how I've found a procedure without code, I cannot find it again, using Ctrl-Click...
« Last Edit: June 05, 2024, 11:19:20 am by jipété »

 

TinyPortal © 2005-2018