When I looked at the implementation of Bitmap class of Android,
I found that it uses SkBitmap internally.
And the Bitmap class of Android is allocating
a native heap and a jbyte array for bitmap itself and backing buffer, respectivly.
What is the backing buffer and its goal?
(backing buffer is declaed as 'mBuffer' in the Bitmap class of Android)
Related
In the Delphi IDE, how do you assign a graphic to a TImage?
In VCL, in the Object Inspector, you use the "Picture" property of the TImage. But in FMX, I don't see "Picture" in the Object Inspector, or anything else like it ("Bitmap", "Graphic", etc.)
Please have mercy. I have 20+ years experience in Delphi VCL, but I'm a raw newbie in FireMonkey!
The property you're looking for is MultiResBitmap. It's use is covered in the documentation under Using Multi-Resolution Bitmaps. The portion pertaining to TImage:
In TImage controls. TImage controls keep a TFixedMultiResBitmap multi-resolution bitmap in the MultiResBitmap property. TFixedMultiResBitmap is the descendant of TCustomMultiResBitmap. A TFixedMultiResBitmap multi-resolution bitmap can contain any number of bitmap items having different scales. On each device, TImage retrieves the most appropriate bitmap to display from the bitmap collection in the TFixedMultiResBitmap multi-resolution bitmap and refers to the obtained bitmap with the Bitmap property. The obtained bitmap depends on the device resolution and scales of bitmap items kept in the TFixedMultiResBitmap multi-resolution bitmap. If a multi-resolution bitmap does not contain a bitmap item having exactly the scale required by some particular screen, then FireMonkey automatically stretches or zooms out the bitmap item having the most appropriate scale. For information about how this bitmap is obtained, see Bitmap. Keep in mind that each bitmap item takes resources of the application's executable on all platforms (even if some bitmap item is never used on a particular platform).
I have some image data which is contained in Graphics object. How can I get it and put to Bitmap object, or EncodedImage object? Thanks.
You can obtain a Graphics object from a Bitmap image and draw on it. Take a look at Graphics.create for OS 4.7 and above and the Graphics constructor for previous versions.
Is it possible to use Portable Bitmap Image(pbm) in TBitmap Component in Delphi?
GraphicEx supports the PBM format.
In Delphi 7, I have to deal with pretty large 24bpp bitmaps (several 100 MB). Since I want to use the Graphcis32 library for further processing, they have to be converted to 32bpp (TBitmap32). The LoadFromFile method of TBitmap32, however, creates a temporary conventional TBitmap to load the original 24bpp bitmap which is then assigned to the TBitmap32 to do the required format conversion. Of course, memory load is roughly doubled by having two of these huge bitmaps in memory, and this can be fatal to my application.
What I am thinking of is a way to load the 24bpp bitmap into a preallocated buffer which is dimensioned such that the 32 bpp bitmap fits in. Then, starting from the buffer end, I want to move the RGB bytes to the offsets needed for 32bpp.
Is this possible? How can I load a bitmap into a preallocated buffer? Any idea?
I don't know much of how Graphics32 works. However if you use a standard file format and have direct access to the TBitmap32 pixel data you should be able create your own image loader for the format that does the loading and the up conversion to 32bpp in one go if nothing else works.
Specifications for common file formats are all over the internet, which one are you using?
The TImageList of Delphi 2009 has support for PNG images by adding them in the imagelist editor. Is there any way to extract a TPngImage from a TImagelist and preserving the alpha channel?
What I want to do is actually to extract the images from one TImageList, make a disabled version of them and then add them to another TImageList. During this operation I would of course like to preserve the alpha channel of the PNG images.
I did something like this with Delphi 2006.
TImageList contains a protected method GetImages. It can be accessed using the "protected bug"
type
TGetImageImageList = class (TImageList) // Please use a better name!
end;
You can cast the imagelist to the TGetImageImageList to get to the GetImages.
begin
TGetImageList(ImageList).GetImages(index, bitmap, mask);
end;
Bitmap contains the bitmap and mask is a black and white bitmap that determines the transparant sections.
You now can change the bitmap and store it using:
function Add(Image, Mask: TBitmap): Integer;
I hope this gives you enough pointers to explore further.