Recent

Author Topic: [SOLVED] Error in Scanline example (from years...)  (Read 1153 times)

jipété

  • Full Member
  • ***
  • Posts: 172
[SOLVED] Error in Scanline example (from years...)
« on: June 20, 2024, 08:21:08 pm »
Hello,

In the last /usr/share/lazarus/3.4.0/examples/scanline, one can read, lines 22-23 of unit1.pas :
Code: Pascal  [Select][+][-]
  1.     This example demonstrates how to
  2.     - create an image with an internal format similar to Delphi''s pf24bit
and then, line 79 :
Code: Pascal  [Select][+][-]
  1.   // create an image with a format similar to Delphi''s pf32bit
So, where is the truth ? 24 or 32 ?

Then, lines 115 and 116 :
Code: Pascal  [Select][+][-]
  1. // LineStart is pointer to the start of a scanline with the following format:
  2. // 4 bytes per pixel. First byte is blue, second green, third is red.
So I ask : what is the format of the missing fourth byte ?

And finally, one can read :
Code: Pascal  [Select][+][-]
  1. line 121 : // fill line with [b]gray[/b]
  2. line 123 : PByte(LineStart)[i]:=0; // set red, green and blue to 0 (i.e. black)

I'm lost...
(of course, the image is black with a diagonal red line)
« Last Edit: June 29, 2024, 04:50:53 pm by jipété »

Handoko

  • Hero Member
  • *****
  • Posts: 5247
  • My goal: build my own game engine using Lazarus
Re: Error in Scanline example (from years...)
« Reply #1 on: June 20, 2024, 08:35:10 pm »
The fourth byte is for alpha value (transparency). If you want to learn more about scanline and pixel format I recommend this demo:
https://forum.lazarus.freepascal.org/index.php/topic,37242.msg488758.html#msg488758
« Last Edit: June 20, 2024, 08:39:07 pm by Handoko »

jipété

  • Full Member
  • ***
  • Posts: 172
Re: Error in Scanline example (from years...)
« Reply #2 on: June 21, 2024, 11:35:57 am »
Hello,

Thanks for the link, very interesting.

But regarding the errors in the text at the beginning of /usr/share/lazarus/3.4.0/examples/scanline/unit1.pas, what can I (we) do ?

Handoko

  • Hero Member
  • *****
  • Posts: 5247
  • My goal: build my own game engine using Lazarus
Re: Error in Scanline example (from years...)
« Reply #3 on: June 21, 2024, 04:27:36 pm »

bytebites

  • Hero Member
  • *****
  • Posts: 651
Re: Error in Scanline example (from years...)
« Reply #4 on: June 21, 2024, 07:09:48 pm »
Line 79 says:
Code: Pascal  [Select][+][-]
  1.  // create an image with a format similar to Delphi's pf32bit  

jipété

  • Full Member
  • ***
  • Posts: 172
Re: Error in Scanline example (from years...)
« Reply #5 on: June 27, 2024, 09:36:15 am »
Hello,

sorry for the delay but the forum didn't notify me that there was a reply...

Line 79 says:
Code: Pascal  [Select][+][-]
  1.  // create an image with a format similar to Delphi's pf32bit  
Yes we know. So what ?

In my first post there are two lines that talk about the same thing but in a different way, and an unanswered question...
beginning_of_post.png



You can report it at the bugtrackter:
https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues
Done : https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/41003
Thanks for the link.

jipété

  • Full Member
  • ***
  • Posts: 172
Re: Error in Scanline example (from years...)
« Reply #6 on: June 29, 2024, 04:50:29 pm »
will be fixed in 3.6.

 

TinyPortal © 2005-2018