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
Can I get the position an...
by
wp
[
Today
at 12:23:04 am]
Translate .lfm file in a ...
by
wp
[
Today
at 12:07:11 am]
Playing video without to ...
by
n7800
[April 17, 2026, 11:51:39 pm]
Delimited text - how find...
by
n7800
[April 17, 2026, 11:28:25 pm]
overloading issues fpc3.2...
by
Martin_fr
[April 17, 2026, 10:21:07 pm]
Ann: Deinline: a de-inlin...
by
LeP
[April 17, 2026, 09:58:08 pm]
FPC Unleashed (inline var...
by
440bx
[April 17, 2026, 08:38:11 pm]
Seeking advice on setting...
by
schuler
[April 17, 2026, 03:36:28 pm]
AI assisted translation o...
by
schuler
[April 17, 2026, 03:27:56 pm]
Ann: DeCoperators
by
DomingoGP
[April 17, 2026, 03:23:39 pm]
Error: Compilation raised...
by
marcov
[April 17, 2026, 02:44:06 pm]
TLazSerial : serial port ...
by
CM630
[April 17, 2026, 09:50:34 am]
I hope FreePascal can sup...
by
xiyi0616
[April 17, 2026, 05:49:05 am]
[Solved] Help needed comp...
by
landolfi
[April 17, 2026, 02:45:10 am]
DataPort or Synpase stat...
by
eldonfsr
[April 16, 2026, 11:32:18 pm]
[FPC 3.2.4, Windows] PTC ...
by
Fred vS
[April 16, 2026, 08:26:24 pm]
Cannot build Units for Si...
by
NormanDunbar
[April 16, 2026, 07:39:07 pm]
IDE: Property editor does...
by
dsiders
[April 16, 2026, 07:04:22 pm]
What is wrong with this c...
by
OH1KH
[April 16, 2026, 04:32:48 pm]
[work arounded]Naming dae...
by
LeP
[April 16, 2026, 03:36:10 pm]
Lazarus Bugfix Release 4....
by
Jonax
[April 16, 2026, 03:06:25 pm]
CudaText editor (written ...
by
AlexTP
[April 16, 2026, 10:43:12 am]
C header function with on...
by
440bx
[April 16, 2026, 09:13:38 am]
(Solved)TUpDown KeyDown ...
by
LeP
[April 15, 2026, 11:21:09 pm]
Zipper: Addition of mult...
by
marcov
[April 15, 2026, 10:35:15 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: TBitmap.Scanline with pf32bit broken on Linux (Debian+Mint) (Read 1210 times)
domasz
Hero Member
Posts: 625
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: 13489
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: 625
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: 13489
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: 625
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