Recent

Author Topic: AfterImage and BGRABitmap  (Read 1426 times)

Fred vS

  • Hero Member
  • *****
  • Posts: 3716
    • StrumPract is the musicians best friend
AfterImage and BGRABitmap
« on: May 05, 2023, 11:55:14 pm »
Hello.

With the image-attachment, stare at the red dot on her nose for 30 seconds, then look at a plain wall while blinking fast.
And discover what is an afterimage.
https://en.wikipedia.org/wiki/Afterimage

Do you have a idea how to create, using BGRABitmap, a negative image from any color-image, to have the same effect "afterimage" as the image-attachment?

Thanks.

Fre;D
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

lainz

  • Hero Member
  • *****
  • Posts: 4738
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: AfterImage and BGRABitmap
« Reply #1 on: May 06, 2023, 12:22:51 am »
From BCFilters.pas:

Code: Pascal  [Select][+][-]
  1. procedure Invert(Bitmap: TBGRABitmap);
  2. var
  3.   i: integer;
  4.   p: PBGRAPixel;
  5. begin
  6.   p := Bitmap.Data;
  7.  
  8.   for i := Bitmap.NBPixels - 1 downto 0 do
  9.   begin
  10.     p^.red := not p^.red;
  11.     p^.green := not p^.green;
  12.     p^.blue := not p^.blue;
  13.     //p^.alpha := not p^.alpha;
  14.     Inc(p);
  15.   end;
  16. end;

Edit. if is not simply an invert, you can use the same method to touch each channel here with any formula...

Fred vS

  • Hero Member
  • *****
  • Posts: 3716
    • StrumPract is the musicians best friend
Re: AfterImage and BGRABitmap
« Reply #2 on: May 06, 2023, 12:41:01 am »
Thanks Lainz  ;)

Fre;D

PS: Did you feel the afterimage-effect of the attached-picture?
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

lainz

  • Hero Member
  • *****
  • Posts: 4738
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: AfterImage and BGRABitmap
« Reply #3 on: May 06, 2023, 01:42:58 am »
Thanks Lainz  ;)

Fre;D

PS: Did you feel the afterimage-effect of the attached-picture?

Yes, I've seen like a floating girl in the monitor, with cyan dress.

circular

  • Hero Member
  • *****
  • Posts: 4450
    • Personal webpage
Re: AfterImage and BGRABitmap
« Reply #4 on: May 07, 2023, 10:00:38 pm »
You might get, but I am not sure, doing the negative with gamma correction, by calling TBGRABitmap.Negative function.

That is indeed fun to see the image  :)
Conscience is the debugger of the mind

Fred vS

  • Hero Member
  • *****
  • Posts: 3716
    • StrumPract is the musicians best friend
Re: AfterImage and BGRABitmap
« Reply #5 on: May 07, 2023, 10:09:23 pm »
You might get, but I am not sure, doing the negative with gamma correction, by calling TBGRABitmap.Negative function.

That is indeed fun to see the image  :)

Yes, I was impressed the fist time I tried it.
It works too with a blinking background after stare the red dot of the image.
https://forum.lazarus.freepascal.org/index.php/topic,63314.msg479323.html

Conclusion: lot of things in our brain is the reverse of reality...  :-X
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

circular

  • Hero Member
  • *****
  • Posts: 4450
    • Personal webpage
Re: AfterImage and BGRABitmap
« Reply #6 on: May 08, 2023, 07:15:40 pm »
Conclusion: lot of things in our brain is the reverse of reality...  :-X
Indeed, in fact our cortex is reversed, left is right, top is down, front is back. For example the visual cortex is behind be we see it before our eyes.
Conscience is the debugger of the mind

 

TinyPortal © 2005-2018