fuluppi
asked on
CopyRect from one Bitmap to another
Dear experts,
I have got a camera image 240x320 px which comes 6 times
per second. I need to copy a specific part out of the image
into another one. This must be really fast !!! I tried using
the canvas.CopyRect function (code below) but this is extremely
slow and makes my CPU going up to 100%.
I need a working solution (code) very fast.
Thanks a lot
fuluppi
My code example:
b:=TBitmap.Create;
b.Width := 320;
b.Height := 240;
b.LoadFromStream(ms);
b.Canvas.FillRect(Rect(0,0 ,320,100)) ;
b.Canvas.FillRect(Rect(0,1 50,320,240 ));
n := TBitmap.Create;
n.width := 190;
n.height := 100;
//THIS IS SO SLOW !!!
n.Canvas.CopyRect(rect(0,0 ,190,100), b.Canvas,R ect(60,100 ,250,200)) ;
image1.Picture.Bitmap := b;
I have got a camera image 240x320 px which comes 6 times
per second. I need to copy a specific part out of the image
into another one. This must be really fast !!! I tried using
the canvas.CopyRect function (code below) but this is extremely
slow and makes my CPU going up to 100%.
I need a working solution (code) very fast.
Thanks a lot
fuluppi
My code example:
b:=TBitmap.Create;
b.Width := 320;
b.Height := 240;
b.LoadFromStream(ms);
b.Canvas.FillRect(Rect(0,0
b.Canvas.FillRect(Rect(0,1
n := TBitmap.Create;
n.width := 190;
n.height := 100;
//THIS IS SO SLOW !!!
n.Canvas.CopyRect(rect(0,0
image1.Picture.Bitmap := b;
use the bitblt-api
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
All right meikl
BitBlt is 6 times faster
BitBlt is 6 times faster
yep, just got no time for a sample yesterday,
but you did this already mokule, you deserves the points,
if this is the solution
meikl ;-)
but you did this already mokule, you deserves the points,
if this is the solution
meikl ;-)
ASKER
hi !
i tried bitblt. it works fine and pretty fast with a TImage but when I try to copy thge rectangle into a new bitmap
it doesn't work any longer. why ???
b:=TBitmap.Create;
b.Width := 320;
b.Height := 240;
b.LoadFromStream(ms);
b1:=TBitmap.Create;
b1.Width := 320;
b1.Height := 100;
BitBlt (b1.Canvas.Handle,0,0,320, 100,b.Canv as.Handle, 0,0,srccop y);
I'm not able to pass b1 as parameter to a component for further processing....
thanks
Philip
i tried bitblt. it works fine and pretty fast with a TImage but when I try to copy thge rectangle into a new bitmap
it doesn't work any longer. why ???
b:=TBitmap.Create;
b.Width := 320;
b.Height := 240;
b.LoadFromStream(ms);
b1:=TBitmap.Create;
b1.Width := 320;
b1.Height := 100;
BitBlt (b1.Canvas.Handle,0,0,320,
I'm not able to pass b1 as parameter to a component for further processing....
thanks
Philip
Hi
Set
b1.PixelFormat := b.PixelFormat;
Set
b1.PixelFormat := b.PixelFormat;
In a few moments I'll give You some code