Recent

Author Topic: [SOLVED] Help in Using ScanLine  (Read 8927 times)

Xor-el

  • Sr. Member
  • ****
  • Posts: 413
Re: Help in Using ScanLine
« Reply #15 on: October 25, 2018, 09:51:20 am »
@Everyone, Thanks a lot for your help, I finally got it working.  :)
Attached below is my working source.
Although I did notice something weird, it seems ScanLine does not work properly on Linux but that is another question.

Thanks once again.
Regards.

flowCRANE

  • Hero Member
  • *****
  • Posts: 986
Re: [SOLVED] Help in Using ScanLine
« Reply #16 on: October 26, 2018, 03:12:05 pm »
Your GetRandom32BitMap function always returns a bitmap filled entirely with the hardcoded color, so you do not need ScanLine here. The code below does exactly the same:

Code: Pascal  [Select][+][-]
  1. function GetRandom32BitMap(AX, AY: integer): TBitmap;
  2. begin
  3.   Result := TBitmap.Create();
  4.   Result.Pixelformat := pf24bit;
  5.   Result.SetSize(AX, AY);
  6.  
  7.   Result.Canvas.Brush.Color := $00A5FF;
  8.   Result.Canvas.FillRect(Result.Canvas.ClipRect);
  9. end;

Besides, this function should be called CreateColored24Bitmap, because this code creates a one-color 24-bit bitmap. Unless it's just an example, but it does not look like it.

Don't know about ScanLine in Linux, I don't use this system.
« Last Edit: October 26, 2018, 03:16:13 pm by furious programming »
Lazarus 4.6 with FPC 3.2.2, Windows 11 — all 64-bit

Working solo on a top-down retro-style action/adventure game (pixel art), programming the engine from scratch, using Free Pascal and SDL3.

Xor-el

  • Sr. Member
  • ****
  • Posts: 413
Re: [SOLVED] Help in Using ScanLine
« Reply #17 on: October 26, 2018, 03:16:37 pm »
Your GetRandom32BitMap function always returns a bitmap filled entirely with the hardcoded color, so you do not need ScanLine here. The code below does exactly the same:

Code: Pascal  [Select][+][-]
  1. function GetRandom32BitMap(AX, AY: integer): TBitmap;
  2. begin
  3.   Result := TBitmap.Create();
  4.   Result.Pixelformat := pf24bit;
  5.   Result.SetSize(AX, AY);
  6.  
  7.   Result.Canvas.Brush.Color := $00A5FF;
  8.   Result.Canvas.FillRect(Result.Canvas.ClipRect);
  9. end;

Don't know about ScanLine in Linux, I don't use this system.

Yes, but my demo is just a simplified example of what I really wanted to do.

flowCRANE

  • Hero Member
  • *****
  • Posts: 986
Re: [SOLVED] Help in Using ScanLine
« Reply #18 on: October 26, 2018, 03:23:01 pm »
Ok, roger that.
Lazarus 4.6 with FPC 3.2.2, Windows 11 — all 64-bit

Working solo on a top-down retro-style action/adventure game (pixel art), programming the engine from scratch, using Free Pascal and SDL3.

 

TinyPortal © 2005-2018