tbitmap

Draw tbitmap with scale and alpha channel faster

我的未来我决定 提交于 2019-12-24 09:27:33
问题 The following code copies a large bitmap blends it with the correct background and then draws a semi transparent image with a clipped region to save draw time... Images are in an array and prescaled... This has been through several levels of optimization based on my limited knowledge of C++ and the Builder graphics... Edit: Updated code... blend(); void blend(Graphics::TBitmap *dst,int x,int y,Graphics::TBitmap *src,BYTE alpha) { const int n=3; // pixel align [Bytes] int dx0,dy0,dx1,dy1, //

Changes to TBitmap do not appear in rendered image in Delphi 6 DirectShow filter and generates lots of soft page faults

这一生的挚爱 提交于 2019-12-23 12:55:11
问题 I have a Delphi6 DirectShow filter (push source video filter) written with the DSPACK component library. I am having a truly vexing problem with some simple code that modifies a bitmap before outputting the modified bitmap to the destination media sample in my FillBuffer() call. The code is shown below. As you can see it is just two simple loops that use a Byte pointer to traverse the RGB values in a 24-bit bitmap. This code worked fine when it was in a non-DirectShow test application.

How to display a TBitmap with alpha channel on TImage correctly?

别来无恙 提交于 2019-12-10 19:56:51
问题 I have a TBitmap which contains semi-transparent image with alpha channel (in this example I got it from TPngImage). var SourceBitmap: TBitmap; PngImage: TPngImage; begin PngImage := TPngImage.Create(); SourceBitmap := TBitmap.Create(); try PngImage.LoadFromFile('ImgSmallTransparent.png'); SourceBitmap.Assign(PngImage); SourceBitmap.SaveToFile('TestIn.bmp'); imgSource.Picture.Assign(SourceBitmap); finally PngImage.Free(); SourceBitmap.Free(); end; When I save this TBitmap to a TestIn.bmp file

How to crop an FMX TBitmap

折月煮酒 提交于 2019-12-02 05:04:18
问题 I receive a bitmap via TCameraComponent.SampleBufferReady event. Then I need to crop the received image so that I get a, for instance, recangular image. I calculate the necessary parameters in the following method: procedure TPersonalF.SampleBufferReady(Sender: TObject; const ATime: TMediaTime); var BMP: TBitmap; X, Y, W, H: Word; begin Try BMP := TBitmap.Create; CameraComponent.SampleBufferToBitmap(BMP, true); if BMP.Width >= BMP.Height then //landscape begin W:=BMP.Height; H:=W; Y:=0; X:

How to crop an FMX TBitmap

一世执手 提交于 2019-12-01 23:04:05
I receive a bitmap via TCameraComponent.SampleBufferReady event. Then I need to crop the received image so that I get a, for instance, recangular image. I calculate the necessary parameters in the following method: procedure TPersonalF.SampleBufferReady(Sender: TObject; const ATime: TMediaTime); var BMP: TBitmap; X, Y, W, H: Word; begin Try BMP := TBitmap.Create; CameraComponent.SampleBufferToBitmap(BMP, true); if BMP.Width >= BMP.Height then //landscape begin W:=BMP.Height; H:=W; Y:=0; X:=trunc((BMP.Width-BMP.Height)/2); end else //portrait begin W:=BMP.Width; H:=W; X:=0; Y:=trunc((BMP.Height

Delphi / C++ builder Windows 10 1709 bitmap operations extremely slow

筅森魡賤 提交于 2019-12-01 11:04:23
问题 Anyone experienced this problem? : It appeared after Windows 10 update to build 1709. After some system up time - a few hours -, bitmap loadings, imagelist item adding gets extremely slow. A 256x256 BMP loads in more than 10 seconds...while doing this, it occupies one CPU core 100%. So compiled applications that start up normally in seconds now start up in minutes! I use hibernation/resume regularly. Display drivers are more than a year old, so that can't be the problem. Any comment on this?

Is it possible to smooth a scaled TBitmap in Delphi?

寵の児 提交于 2019-12-01 03:08:59
问题 I am using Stretched=True on a TImage with a 256x256 bitmap. This gets scaled down by 1,2,4 or 8. As expected, text on the bitmap gets more horrible the more I depart from '1'. I notice though that Windows 7 explorer renders a scaled down version of the bitmap 'softer' and more pleasing. Is it possible to 'blur' a TBitmap in this way? 回答1: I suppose you mean Stretched = True on a TImage, not on A TBitmap. Unfortunately TImage has no resamplers built in, when it comes to resizing images in it.

Delphi - how do I crop a bitmap “in place”?

随声附和 提交于 2019-11-28 13:29:11
If I have a TBitmap and I want to obtain a cropped image from this bitmap, can I perform the cropping operation "in place"? e.g. if I have a bitmap that is 800x600, how can I reduce (crop) it so that it contains the 600x400 image at the centre, i.e. the resulting TBitmap is 600x400, and consists of the rectangle bounded by (100, 100) and (700, 500) in the original image? Do I need to go via another bitmap or can this operation be done within the original bitmap? You can use the BitBlt function try this code. procedure CropBitmap(InBitmap, OutBitMap : TBitmap; X, Y, W, H :Integer); begin

Rotating a square TBitmap on its center

孤街醉人 提交于 2019-11-28 02:27:11
I am trying to find the simplest way to rotate and display a TBitmap on its center by any given angle needed. The TBitmap is square and any clipping that might occur is not important so long as the rotated bitmap's center point remains constant. The image is very small, only around 50 x 50 pixels so speed isn't an issue. Here is the code I have so far which rotates a TBitmap to 90 degrees, which is simple, the any angle thing less so. std::auto_ptr<Graphics::TBitmap> bitmap1(new Graphics::TBitmap); std::auto_ptr<Graphics::TBitmap> bitmap2(new Graphics::TBitmap); bitmap1->LoadFromFile("c:

Delphi - how do I crop a bitmap “in place”?

六月ゝ 毕业季﹏ 提交于 2019-11-27 07:43:24
问题 If I have a TBitmap and I want to obtain a cropped image from this bitmap, can I perform the cropping operation "in place"? e.g. if I have a bitmap that is 800x600, how can I reduce (crop) it so that it contains the 600x400 image at the centre, i.e. the resulting TBitmap is 600x400, and consists of the rectangle bounded by (100, 100) and (700, 500) in the original image? Do I need to go via another bitmap or can this operation be done within the original bitmap? 回答1: You can use the BitBlt