Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
Graphics and Multimedia
»
Graphics
»
BGRABitmap and LazPaint
»
BGRABitmap - copy rectangle
Free Pascal
Website
Downloads
Wiki
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Bugtracker
IRC channel
Latest SVN
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
problem executting tproce...
by
ASBzone
[
Today
at 12:53:03 am]
Help with task using arra...
by
Kays
[
Today
at 12:43:35 am]
Are there any existing vn...
by
willbprog9933
[March 02, 2021, 11:19:57 pm]
Copy the contents of a po...
by
jamie
[March 02, 2021, 10:46:41 pm]
Using WebSockets with Laz...
by
Warfley
[March 02, 2021, 10:33:16 pm]
Adding event to a runtime...
by
justnewbie
[March 02, 2021, 09:59:09 pm]
50 years of Pascal
by
willbprog9933
[March 02, 2021, 09:52:07 pm]
[RESOLVED]Error ExportPDF
by
berghem
[March 02, 2021, 09:38:57 pm]
Websockets Server/Client ...
by
Warfley
[March 02, 2021, 09:29:52 pm]
LAMW: jMsSqlJDBCConnectio...
by
af0815
[March 02, 2021, 09:14:34 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: BGRABitmap - copy rectangle (Read 256 times)
mosquito
New Member
Posts: 26
BGRABitmap - copy rectangle
«
on:
February 23, 2021, 09:48:49 am »
I have a TBGRABitmap in memory, how can I extract a rectangle from this bitmap and copy it to another temporary bitmap?
Logged
winni
Hero Member
Posts: 2196
Re: BGRABitmap - copy rectangle
«
Reply #1 on:
February 23, 2021, 10:41:20 am »
Hi!
Easy:
Code: Pascal
[Select]
[+]
[-]
NewBGRAbitmap
:
=
TBGRAbitmap
.
create
;
NewBGRAbitmap
:
=
OldBGRAbitmap
.
GetPart
(
Rect
(
10
,
10
,
100
,
100
)
)
;
Done.
Winni
Logged
mosquito
New Member
Posts: 26
Re: BGRABitmap - copy rectangle
«
Reply #2 on:
February 23, 2021, 12:03:51 pm »
Thanks, this is just what I was looking for.
Logged
Roland57
Full Member
Posts: 121
Re: BGRABitmap - copy rectangle
«
Reply #3 on:
February 23, 2021, 02:40:24 pm »
Hello!
@Winni
The first line isn't required. It would create a memory leak.
Regards.
Roland
Logged
https://github.com/rchastain
https://gitlab.com/rchastain
winni
Hero Member
Posts: 2196
Re: BGRABitmap - copy rectangle
«
Reply #4 on:
February 24, 2021, 05:49:49 pm »
Hi Roland.
That depends on the version of BGRAbitmap your using.
Old versions behaved this way: If you did not do a create before the Getpart you got a nice crash.
Nice that it was at long last changed.
Winni
Logged
circular
Hero Member
Posts: 3666
Re: BGRABitmap - copy rectangle
«
Reply #5 on:
February 24, 2021, 06:49:05 pm »
Hmmm nope it has always been a memory leak.
Assigning to the variable replaces the previous pointer.
Maybe you’re thinking of BGRAReplace?
Logged
Conscience is the debugger of the mind
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
Graphics and Multimedia
»
Graphics
»
BGRABitmap and LazPaint
»
BGRABitmap - copy rectangle
TinyPortal
© 2005-2018