Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
Graphics and Multimedia
»
Graphics
»
BGRABitmap and LazPaint
»
[CLOSED] BGRABitmap Free
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
Form scaling
by
fxeconomist
[
Today
at 06:11:14 pm]
Does anyone know why this...
by
Laksen
[
Today
at 06:01:04 pm]
For-in loop over constant...
by
alpine
[
Today
at 05:20:47 pm]
pre-processor symbol when...
by
paule32
[
Today
at 05:11:35 pm]
How can i make this windo...
by
TRon
[
Today
at 05:06:35 pm]
How are cookies share Web...
by
Thaddy
[
Today
at 04:59:59 pm]
CORBA interface and Varia...
by
JdeHaan
[
Today
at 04:56:48 pm]
Azure sql database will n...
by
wpflum
[
Today
at 04:04:56 pm]
Values of a custom compon...
by
CM630
[
Today
at 01:42:08 pm]
Arabic text, problem on L...
by
marius.maximus
[
Today
at 12:59:47 pm]
[solved] Lazarus does not...
by
wp
[
Today
at 12:38:09 pm]
How does Castle Game Eng...
by
Aistis
[
Today
at 12:21:03 pm]
CocoaInt.CocoaIconUse no ...
by
MISV
[
Today
at 11:51:28 am]
Minimum code for implemen...
by
MISV
[
Today
at 11:37:54 am]
[re-opened] Package PPU l...
by
CCRDude
[
Today
at 11:19:11 am]
Distro has depreciated qt...
by
TheMouseAUS
[
Today
at 11:12:25 am]
How can I draw a rectangl...
by
jcmontherock
[
Today
at 11:08:24 am]
TBGRABitmap.TextSize retu...
by
KodeZwerg
[
Today
at 10:26:36 am]
Lazreport: Question about...
by
teco
[
Today
at 09:18:07 am]
how to using CryptoLib4Pa...
by
paweld
[
Today
at 07:59:04 am]
How to: create DLL file f...
by
paule32
[
Today
at 07:03:32 am]
[solved]FP IDE(FP.exe) fa...
by
gasensor
[
Today
at 03:00:19 am]
ThumbControl : how to loa...
by
the_magik_mushroom
[
Today
at 01:48:57 am]
[solved] Iteration of cla...
by
Joanna
[
Today
at 01:45:47 am]
leetcode doesn’t support ...
by
Joanna
[
Today
at 01:18:56 am]
« previous
next »
Print
Pages: [
1
]
Author
Topic: [CLOSED] BGRABitmap Free (Read 2765 times)
pcurtis
Hero Member
Posts: 951
[CLOSED] BGRABitmap Free
«
on:
January 25, 2022, 05:11:03 pm »
When I do this
Code: Pascal
[Select]
[+]
[-]
procedure
TfrmMain
.
btnOKClick
(
Sender
:
TObject
)
;
var
MyImage
:
TBGRABitmap
;
begin
MyImage
:
=
TBGRABitmap
.
Create
;
MyImage
.
LoadFromFile
(
'1.bmp'
)
;
Image1
.
Picture
.
Bitmap
:
=
MyImage
.
Bitmap
;
MyImage
.
Free
;
end
;
When MyImage is freed the Imagebox shows a black square. With a TBitmap it works fine.
Am I missing something?
«
Last Edit: January 25, 2022, 11:06:17 pm by pcurtis
»
Logged
Windows 10 20H2
Laz 2.2.0
FPC 3.2.2
Josh
Hero Member
Posts: 1273
Re: BGRABitmap Free
«
Reply #1 on:
January 25, 2022, 06:46:12 pm »
hi try to update image1, before you free MyImage
Code: Pascal
[Select]
[+]
[-]
MyImage
:
=
TBGRABitmap
.
Create
(
'1.bmp'
)
;
// MyImage.LoadFromFile('1.bmp');
Image1
.
Picture
.
Bitmap
:
=
MyImage
.
Bitmap
;
Image1
.
Update
;
MyImage
.
Free
;
Logged
The best way to get accurate information on the forum is to post something wrong and wait for corrections.
pcurtis
Hero Member
Posts: 951
Re: BGRABitmap Free
«
Reply #2 on:
January 25, 2022, 06:59:52 pm »
OK Thanks that works, but with tbitmap I don't need it. Why?
Logged
Windows 10 20H2
Laz 2.2.0
FPC 3.2.2
winni
Hero Member
Posts: 3197
Re: BGRABitmap Free
«
Reply #3 on:
January 25, 2022, 09:21:37 pm »
Hi!
This is a problem of the widget set.
With linux / gtk2 it is not necessary.
Winni
Logged
pcurtis
Hero Member
Posts: 951
Re: BGRABitmap Free
«
Reply #4 on:
January 25, 2022, 11:05:09 pm »
Enough said.
Built for *nix, pray it works on other OS's.
Logged
Windows 10 20H2
Laz 2.2.0
FPC 3.2.2
winni
Hero Member
Posts: 3197
Re: [CLOSED] BGRABitmap Free
«
Reply #5 on:
January 25, 2022, 11:26:27 pm »
Hi!
Just do it how it is shown in the tutorials:
https://wiki.freepascal.org/BGRABitmap_tutorial
I pray for nothing.
But that is the correct way to use it:
Code: Pascal
[Select]
[+]
[-]
MyImage
.
Draw
(
Image1
.
Canvas
,
0
,
0
)
;
MyImage
.
free
;
Winni
Logged
pcurtis
Hero Member
Posts: 951
Re: [CLOSED] BGRABitmap Free
«
Reply #6 on:
January 25, 2022, 11:56:59 pm »
So how do you use center, stretch, proportional properties of TImage?
Logged
Windows 10 20H2
Laz 2.2.0
FPC 3.2.2
winni
Hero Member
Posts: 3197
Re: [CLOSED] BGRABitmap Free
«
Reply #7 on:
January 26, 2022, 12:02:13 am »
Hi!
If your google is broken then use the "search" option of this forum.
Winni
Logged
pcurtis
Hero Member
Posts: 951
Re: [CLOSED] BGRABitmap Free
«
Reply #8 on:
January 26, 2022, 12:17:34 am »
My Google works fine.
Why reinvent the wheel?
Code: Pascal
[Select]
[+]
[-]
Image1
.
Picture
.
Bitmap
:
=
MyImage
.
Bitmap
;
Image1
.
Update
;
Works fine.
Logged
Windows 10 20H2
Laz 2.2.0
FPC 3.2.2
Josh
Hero Member
Posts: 1273
Re: [CLOSED] BGRABitmap Free
«
Reply #9 on:
January 26, 2022, 05:54:12 pm »
you could use an intermeddiate bitmap to hold the image; should work on all os's. no update should be needed.
Code: Pascal
[Select]
[+]
[-]
var
bmp
:
tbitmap
;
MyImage
:
TBGRABitmap
;
begin
MyImage
:
=
TBGRABitmap
.
Create
;
bmp
:
=
tbitmap
.
Create
;
myimage
.
LoadFromFile
(
'1.bmp'
)
;
bmp
.
SetSize
(
myimage
.
Width
,
myimage
.
Height
)
;
bmp
.
Canvas
.
Draw
(
0
,
0
,
myimage
.
Bitmap
)
;
image1
.
Picture
.
Bitmap
:
=
bmp
;
MyImage
.
Free
;
bmp
.
free
;
end
;
Logged
The best way to get accurate information on the forum is to post something wrong and wait for corrections.
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
Graphics and Multimedia
»
Graphics
»
BGRABitmap and LazPaint
»
[CLOSED] BGRABitmap Free
TinyPortal
© 2005-2018