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
Add,update and delete by ...
by
paweld
[
Today
at 09:29:14 am]
I'm wondering, what kind ...
by
Marc
[
Today
at 09:13:56 am]
Error after installing ne...
by
dbannon
[
Today
at 09:12:52 am]
Strange behavior of IDE l...
by
Thaddy
[
Today
at 08:36:25 am]
Segmentation fault
by
Thaddy
[
Today
at 08:24:53 am]
File IO issues
by
paweld
[
Today
at 07:42:14 am]
efficiency problem
by
Thaddy
[
Today
at 07:15:44 am]
FPC 2.2.2 for classic Mac...
by
Thaddy
[
Today
at 07:13:48 am]
zeosdb zupdate don't work...
by
paweld
[
Today
at 06:59:14 am]
The Silver Coder on YouTu...
by
silvercoder70
[
Today
at 05:00:34 am]
Hooking to `OnISupport` d...
by
Gustavo 'Gus' Carreno
[
Today
at 03:17:18 am]
PostgreSQL "no route to h...
by
dseligo
[
Today
at 01:04:44 am]
lazarus-darwin-aarch64-3....
by
dbannon
[
Today
at 12:50:21 am]
Lepton Test Program with ...
by
Boleeman
[
Today
at 12:29:20 am]
Sets Vs Arrays. When to ...
by
TBMan
[
Today
at 12:18:00 am]
New 2D StarField
by
Gigatron
[
Today
at 12:16:26 am]
Online Package Manager
by
wp
[March 14, 2025, 11:27:23 pm]
to read an UTF8 text file
by
nk
[March 14, 2025, 10:24:30 pm]
Pi day today
by
Key-Real
[March 14, 2025, 09:12:33 pm]
how to create a text file...
by
nk
[March 14, 2025, 08:54:35 pm]
LAMW Bindings fix
by
Key-Real
[March 14, 2025, 08:54:33 pm]
full featured Android Nat...
by
Key-Real
[March 14, 2025, 08:47:32 pm]
Converting a Project from...
by
1HuntnMan
[March 14, 2025, 08:12:58 pm]
[SOLVED] TSpinEditEx and ...
by
dangersgromit
[March 14, 2025, 08:03:16 pm]
how to native camera?
by
Key-Real
[March 14, 2025, 06:57:17 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: TBitmap.Scanline with pf32bit broken on Linux (Debian+Mint) (Read 962 times)
domasz
Hero Member
Posts: 563
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: 12676
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: 563
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: 12676
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: 563
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: 4133
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