Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
Graphics and Multimedia
»
Graphics
(Moderator:
Ask
) »
fcl-image and TImage
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
IRC channel
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
Hole punching - Step by S...
by
Key-Real
[
Today
at 12:19:58 am]
Is Meta programming possi...
by
Joanna
[May 31, 2023, 11:57:27 pm]
[Solved] Dark mode in app...
by
d7_2_laz
[May 31, 2023, 11:28:56 pm]
SQLite Unique
by
paweld
[May 31, 2023, 11:02:27 pm]
Letters chopped off in hi...
by
jamie
[May 31, 2023, 11:00:49 pm]
SQLite check if record ex...
by
paweld
[May 31, 2023, 10:38:45 pm]
How to download a file fr...
by
c4p
[May 31, 2023, 10:09:56 pm]
Magic, non referenced var...
by
PascalDragon
[May 31, 2023, 09:55:09 pm]
How to use the Event Log?
by
Martin_fr
[May 31, 2023, 09:55:07 pm]
BoxChart cannot be color ...
by
kiyo
[May 31, 2023, 08:35:05 pm]
Default and speed effect
by
Martin_fr
[May 31, 2023, 06:51:41 pm]
LazPaint (alpha-blending,...
by
circular
[May 31, 2023, 06:38:33 pm]
Anonymous Unions-Middle R...
by
jamie
[May 31, 2023, 06:08:15 pm]
Initializing an array
by
jamie
[May 31, 2023, 05:35:14 pm]
PostgreSQL: typeinfo erro...
by
Чебурашка
[May 31, 2023, 04:50:52 pm]
Sevenzip. Pas with multiv...
by
datilas
[May 31, 2023, 04:33:37 pm]
Error in Sway
by
AmatCoder
[May 31, 2023, 04:02:28 pm]
Google Snappy bindings fo...
by
Okoba
[May 31, 2023, 03:39:37 pm]
CEF4Delphi under Ubuntu C...
by
myisjwj
[May 31, 2023, 02:51:10 pm]
how to download fulling f...
by
af0815
[May 31, 2023, 02:36:40 pm]
Why is the rectangle the ...
by
zeljko
[May 31, 2023, 02:35:37 pm]
lhelp not working on Linu...
by
zeljko
[May 31, 2023, 02:33:47 pm]
min() function behavior i...
by
tetrastes
[May 31, 2023, 10:17:25 am]
Help for downloand file
by
rvk
[May 31, 2023, 09:29:43 am]
Installing GDB on MAC OS ...
by
dbannon
[May 31, 2023, 01:53:46 am]
« previous
next »
Print
Pages: [
1
]
Author
Topic: fcl-image and TImage (Read 328 times)
adderthorn
New Member
Posts: 19
fcl-image and TImage
«
on:
February 25, 2023, 05:42:29 pm »
I am working with a library that creates bitmaps using the fcl-image classes, I am trying to integrate this into a GUI application and display these bitmaps, I can't seem to find a way to do this. I've tried doing this with a stream, but it fails on me. Any thoughts?
Code: Pascal
[Select]
[+]
[-]
ABitmap
:
=
LIBRARYCLASS
.
ToBitmapImage
(
1
,
1
)
;
Writer
:
=
TFPWriterBMP
.
Create
;
AStream
:
=
TMemoryStream
.
Create
;
ABitmap
.
SaveToStream
(
AStream
,
Writer
)
;
Image1
.
Picture
.
Bitmap
.
LoadFromStream
(
AStream
,
1
)
;
Logged
wp
Hero Member
Posts: 10851
Re: fcl-image and TImage
«
Reply #1 on:
February 25, 2023, 05:50:11 pm »
Assuming that line 1 in your example is correct, then you simply can assign ABitmap to Image1.Picture:
Code: Pascal
[Select]
[+]
[-]
Image1
.
Picture
.
Assign
(
ABitmap
)
;
Your code with the stream should work, too. But you must be aware that the stream.Position is at the end after ABitmap.SaveToStream; therefore, there's nothing to read for Image1.Picture.Bitmap.LoadFromStream. Rewinding the stream should help:
Code: Pascal
[Select]
[+]
[-]
...
ABitmap
.
SaveToStream
(
AStream
,
Writer
)
;
AStream
.
Position
:
=
0
;
Image1
.
Picture
.
Bitmap
.
LoadFromStream
(
AStream
,
1
)
;
Logged
adderthorn
New Member
Posts: 19
Re: fcl-image and TImage
«
Reply #2 on:
February 25, 2023, 06:21:04 pm »
Thank-you! This was what I needed. Still having an issue (now getting Invalid palette index 0), but I think this is the library I'm using, so I'm doing some more debugging.
Logged
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
Graphics and Multimedia
»
Graphics
(Moderator:
Ask
) »
fcl-image and TImage
TinyPortal
© 2005-2018