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
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
ld: library 'gtk-3' not f...
by
gferluga
[
Today
at 12:46:56 pm]
Option "RemoveExpressionR...
by
Thaddy
[
Today
at 12:26:55 pm]
Weird error: component no...
by
Thaddy
[
Today
at 12:22:55 pm]
Converting a Project from...
by
Zvoni
[
Today
at 12:22:53 pm]
DateUtils *Span and *Betw...
by
Чебурашка
[
Today
at 12:13:14 pm]
basic question for good s...
by
Thaddy
[
Today
at 12:01:15 pm]
"database not open" - IBX...
by
Nicole
[
Today
at 11:54:25 am]
Warning on identifier usa...
by
marcov
[
Today
at 09:42:49 am]
link error on Ubuntu 22.0...
by
Thaddy
[
Today
at 09:02:12 am]
Lazarus Release Candidate...
by
jonyrh
[
Today
at 05:51:01 am]
How to Run Lazarus App wi...
by
incendio
[
Today
at 04:59:33 am]
ADUG Symposium 2025 is on
by
Mathias Burbach
[
Today
at 02:10:05 am]
Rest API chunk file downl...
by
Leledumbo
[
Today
at 01:01:56 am]
CPU-View
by
Martin_fr
[March 25, 2025, 08:49:41 pm]
/lib/x86_64-linux-gnu/lib...
by
TRon
[March 25, 2025, 08:26:08 pm]
Mixing LazMapViewer and O...
by
MarkMLl
[March 25, 2025, 07:45:53 pm]
GTK3 still alpha
by
Thaddy
[March 25, 2025, 07:16:14 pm]
Fast Fourier Transform (F...
by
VTwin
[March 25, 2025, 04:51:12 pm]
SIMD QuickSort
by
mikerabat
[March 25, 2025, 01:57:44 pm]
[SOLVED] suddenly i have ...
by
CharlyTango
[March 25, 2025, 11:29:56 am]
Problems with Lazaruz 3.8...
by
salvadordf
[March 25, 2025, 11:22:35 am]
Very Slow Online Package ...
by
Marc
[March 25, 2025, 09:52:13 am]
Velthuis.Console.pas - Wo...
by
Thaddy
[March 25, 2025, 08:55:31 am]
No fpc found on a fresh i...
by
Thaddy
[March 25, 2025, 08:30:15 am]
Lazarus is not working
by
Thaddy
[March 25, 2025, 08:18:33 am]
« previous
next »
Print
Pages: [
1
]
Author
Topic: TBitmap.Scanline with pf32bit broken on Linux (Debian+Mint) (Read 972 times)
domasz
Hero Member
Posts: 566
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: 12703
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: 566
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: 12703
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: 566
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: 4165
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