Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
Graphics and Multimedia
»
Graphics
(Moderator:
Ask
) »
TBitmap.Scanline with pf32bit broken on Linux (Debian+Mint)
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
Forum Rules
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
Printout in Printer Queue...
by
wwerner
[
Today
at 07:25:31 am]
The compiler fails to war...
by
dseligo
[
Today
at 01:41:21 am]
Embedded qss stylesheets ...
by
big_M
[
Today
at 12:52:34 am]
Theoretical question. Laz...
by
jamie
[
Today
at 12:12:09 am]
Mapping Images Like Odome...
by
SandyG
[January 15, 2026, 11:57:50 pm]
StrToDateTime problems
by
Aruna
[January 15, 2026, 11:56:02 pm]
Newly revised TlistBox in...
by
jamie
[January 15, 2026, 11:17:12 pm]
unit init, finalize and i...
by
PascalDragon
[January 15, 2026, 09:46:49 pm]
Why does FPC behave this ...
by
PascalDragon
[January 15, 2026, 09:26:24 pm]
How to forward a Class in...
by
PascalDragon
[January 15, 2026, 09:21:47 pm]
Pyramid solitaire, re-wri...
by
TBMan
[January 15, 2026, 09:21:07 pm]
Tzipper giving error on M...
by
Josh
[January 15, 2026, 08:46:02 pm]
Copy and Past Code
by
n7800
[January 15, 2026, 07:47:43 pm]
AI: Agentic Design Patter...
by
avra
[January 15, 2026, 06:36:29 pm]
CudaText editor (written ...
by
szlbz
[January 15, 2026, 02:16:25 pm]
PasLLM - LLM Inference En...
by
matthius
[January 15, 2026, 01:41:45 pm]
Stacked bars not drawn pr...
by
apeoperaio
[January 15, 2026, 12:57:01 pm]
New book on Object Pascal
by
matthius
[January 15, 2026, 12:55:36 pm]
[SOLVED] Assembler error ...
by
dbannon
[January 15, 2026, 12:55:16 pm]
four squares (inc)
by
speter
[January 15, 2026, 11:25:05 am]
Regarding the issue of de...
by
Martin_fr
[January 15, 2026, 10:20:35 am]
Dice (raylib + kraft phys...
by
fcu
[January 15, 2026, 09:01:24 am]
Lazarus seems to be makin...
by
Boleeman
[January 15, 2026, 07:54:25 am]
[SOLVED] Lazreport PDF
by
Petrus Vorster
[January 15, 2026, 07:42:59 am]
Maze Makers: Modified Cyl...
by
Boleeman
[January 15, 2026, 07:20:10 am]
« previous
next »
Print
Pages: [
1
]
Author
Topic: TBitmap.Scanline with pf32bit broken on Linux (Debian+Mint) (Read 1157 times)
domasz
Hero Member
Posts: 615
TBitmap.Scanline with pf32bit broken on Linux (Debian+Mint)
«
on:
June 04, 2024, 04:11:31 pm »
Lazarus 3.4 64bit GTK2
(Same problem on Lazarus 2.2.6 64bit GTK2)
FPC 3.2.2
Debian 12 Bookworm
The code below displays a bunch of weird lines instead of a fully blue image. The saved image is correct (fully blue).
Code: Pascal
[Select]
[+]
[-]
TPix
=
packed
record
case
Byte
of
1
:
(
R
,
G
,
B
,
A
:
Byte
)
;
2
:
(
RGBA
:
Cardinal
;
)
end
;
PPixArray
=
^
TPixArray
;
TPixArray
=
array
[
0
..
32766
]
of
TPix
;
x
,
y
:
Integer
;
P
:
PPixArray
;
Result
:
TBitmap
;
begin
Result
:
=
TBitmap
.
Create
;
Result
.
SetSize
(
500
,
500
)
;
Result
.
PixelFormat
:
=
pf32bit
;
for
y
:
=
0
to
Result
.
Height
-
1
do
begin
P
:
=
Result
.
Scanline
[
y
]
;
for
x
:
=
0
to
Result
.
Width
-
1
do
begin
P
^
[
x
]
.
R
:
=
0
;
P
^
[
x
]
.
G
:
=
0
;
P
^
[
x
]
.
B
:
=
255
;
P
^
[
x
]
.
A
:
=
255
;
end
;
end
;
Panel2
.
Canvas
.
Draw
(
0
,
0
,
Result
)
;
Result
.
SaveToFile
(
'hej.bmp'
)
;
Result
.
Free
;
«
Last Edit: June 04, 2024, 08:47:36 pm by domasz
»
Logged
wp
Hero Member
Posts: 13329
Re: Canvas.Draw and Canvas.StretchDraw broken on Linux (Debian)
«
Reply #1 on:
June 04, 2024, 04:55:14 pm »
Working correctly for me on Linux Mint gtk2 and qt5, except for the color (fully red) since R and B are exchanged, and maybe the alpha channel is also at a different location. That's the problem when pixels are accessed via ScanLine...
«
Last Edit: June 04, 2024, 05:33:19 pm by wp
»
Logged
domasz
Hero Member
Posts: 615
Re: Canvas.Draw and Canvas.StretchDraw broken on Linux (Debian)
«
Reply #2 on:
June 04, 2024, 05:04:49 pm »
What version of Lazarus do you have?
What exact version of GTK?
I have the same bug also in Linux Mint 21.3 Cinnamon, Cinnamon version 6.1.4.
«
Last Edit: June 04, 2024, 05:45:58 pm by domasz
»
Logged
wp
Hero Member
Posts: 13329
Re: Canvas.Draw and Canvas.StretchDraw broken on Linux (Debian)
«
Reply #3 on:
June 04, 2024, 05:47:06 pm »
Quote from: domasz on June 04, 2024, 05:04:49 pm
What version of Lazarus do you have?
At first I tried Laz/main with the result reported by me, but now I switched to Laz 3.2 and it shows the striped image that you get.
Logged
domasz
Hero Member
Posts: 615
Re: Canvas.Draw and Canvas.StretchDraw broken on Linux (Debian)
«
Reply #4 on:
June 04, 2024, 08:47:03 pm »
Below works on Linux with pf32bit.
Code: Pascal
[Select]
[+]
[-]
Color
:
=
R
+
(
G
shl
8
)
+
(
B
shl
16
)
;
Result
.
Canvas
.
Pixels
[
x
,
y
]
:
=
Color
;
Logged
TRon
Hero Member
Posts: 4377
Re: Canvas.Draw and Canvas.StretchDraw broken on Linux (Debian)
«
Reply #5 on:
June 05, 2024, 06:03:08 am »
Quote from: domasz on June 04, 2024, 08:47:03 pm
Below works on Linux with pf32bit.
Ofc that works !
It works for every pixelformat (that is with taking the number of colours that are possible for such format into account )
By using the pixels property the class uses the property setter that is responsible for 'setting' the actual pixels, taking away the burden for the user to understand how images are actually stored in memory (and that is a good thing because there as many users as there are (wrong) assumptions
Logged
Today is tomorrow's yesterday.
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
Graphics and Multimedia
»
Graphics
(Moderator:
Ask
) »
TBitmap.Scanline with pf32bit broken on Linux (Debian+Mint)
TinyPortal
© 2005-2018