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
Make a part of text of a ...
by
vico
[
Today
at 05:20:51 pm]
[SOLVED] SQLite check if ...
by
Pe3s
[
Today
at 04:50:25 pm]
Changes in "Search Result...
by
n7800
[
Today
at 04:48:28 pm]
Hole punching - Step by S...
by
rvk
[
Today
at 04:43:23 pm]
Making a little chart app
by
phoenix27
[
Today
at 04:31:15 pm]
Are We Dead Yet?
by
Warfley
[
Today
at 03:28:19 pm]
Fast Base64 encoding/deco...
by
mikerabat
[
Today
at 03:05:26 pm]
Letters chopped off in hi...
by
Martin_fr
[
Today
at 02:48:07 pm]
Error in Sway
by
AlexTP
[
Today
at 02:02:39 pm]
Default and speed effect
by
Okoba
[
Today
at 01:39:38 pm]
LazPaint (alpha-blending,...
by
circular
[
Today
at 11:49:46 am]
Touchscreen selecting rec...
by
Jon Trepte
[
Today
at 11:44:03 am]
Would folks find these mi...
by
wp
[
Today
at 11:42:15 am]
Clean up at ide/include/i...
by
JuhaManninen
[
Today
at 11:34:06 am]
Code clean up at TFontMan...
by
wp
[
Today
at 11:09:11 am]
Why is the rectangle the ...
by
Tomi
[
Today
at 10:56:24 am]
PostgreSQL: typeinfo erro...
by
SymbolicFrank
[
Today
at 10:31:23 am]
How to use the Event Log?
by
WooBean
[
Today
at 09:13:35 am]
[SOLVED] SQLite Unique
by
Pe3s
[
Today
at 09:00:12 am]
Help for downloand file
by
Jurassic Pork
[
Today
at 08:33:10 am]
how to download fulling f...
by
greenzyzyzy
[
Today
at 04:12:30 am]
help choosing laptop
by
Weiss
[
Today
at 03:11:56 am]
using the create_lazarus_...
by
jshand2010
[
Today
at 02:01:04 am]
LAMW - simple esc/POS pri...
by
jmpessoa
[
Today
at 01:51:58 am]
Installing GDB on MAC OS ...
by
Martin_fr
[
Today
at 01:49:44 am]
« previous
next »
Print
Pages: [
1
]
Author
Topic: fcl-image and TImage (Read 329 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: 10853
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