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
Exception Class 'External...
by
Zvoni
[
Today
at 04:19:46 pm]
Using WebSockets with Laz...
by
Warfley
[
Today
at 04:12:16 pm]
Can't get GetMonitorBrigh...
by
pcurtis
[
Today
at 04:07:32 pm]
AutoAdjustColumns() or Co...
by
russeld
[
Today
at 04:02:48 pm]
Would like some feedback ...
by
Handoko
[
Today
at 03:44:47 pm]
[SOLVED] QT5 with latest ...
by
ChrisR
[
Today
at 03:11:58 pm]
Problema al recompilar pa...
by
PINO72
[
Today
at 03:10:44 pm]
How to speed up writing o...
by
engkin
[
Today
at 03:01:26 pm]
Adjust TForm and Buttons ...
by
AlphaInc.
[
Today
at 02:48:18 pm]
TResampleFilter rfBestQua...
by
del
[
Today
at 02:38:17 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: BGRABitmap - copy rectangle (Read 482 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: 2280
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: 147
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: 2280
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: 3679
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