ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Layers & TIEBitMap
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

bmesser

United Kingdom
234 Posts

Posted - Nov 02 2012 :  09:40:44  Show Profile  Reply
Hi

I am putting together an animated GIF but want access to the Bitmap object of each layer in a TImageEnView component but can only find a TIEBitmap property. How do convert or cast a TBitmap from that TIEBitmap?

Bruce.

w2m

USA
1990 Posts

Posted - Nov 02 2012 :  10:08:15  Show Profile  Reply
If LegacyBitmap is True, IEBitmap is just a wrapper for TBitmap that may be accessed using the Bitmap property.

What is means is if LegacyBitmap is True, Bitmap will contain a TBitmap of the image and IEBitmap will contain the TIEBitmap. Both the Bitmap and IEBitmap will contain the same image.

You can test this with the following:
procedure TForm1.Button1Click(Sender: TObject);
begin
  ImageEnView2.Clear;
  ImageEnView2.Bitmap.Assign(ImageEnView1.Bitmap);
  ImageEnView2.Update;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
  ImageEnView2.Clear;
  ImageEnView2.IEBitmap.Assign(ImageEnView1.IEBitmap);
  ImageEnView2.Update;
end;

If LegacyBitmap is True, ImageEn uses TBitmap to store the image, but the image is also available in the TIEBitmap otherwise ImageEn uses TIEBitmap. TIEBitmap handles images using memory mapped file (for large images) or main memory. This allows handling of large images and to include input/output and image processing in a multi-threaded environment. Also TIEBitmap supports a larger number of pixel formats (TIEPixelFormat).

If you are loading very large images it is best to use TIEBitmap because IEBitmap can handle large images while Bitmap can not. Most of the time for general imaging application it is best to use TIEBitmap, especially if large images will be used.

If you are using ImageEnView with LegacyBitmap = False then use IEBitmap.CopyToTBitmap. You will also have to use IEBitmap.CopyToBitmap when using layers, because layers only have an IEBitmap. Keep in mind that TBitmap may not be able to handle a very large TIEBitmap.
procedure CopyToTBitmap(Dest: TBitmap);

Description
CopyToTBitmap copies the image to the Dest TBitmap object. These PixelFormat conversions are applied:
ie1g -> pf1bit
ie8p -> pf8bit
ie8g -> pf8bit (create gray scale palette)
ie16g -> pf8bit (copy only high 8 bit)
ie24RGB -> pf24bit
RGBA32-Bit is not supported

With Layers
ImageEnView2.Clear;
ImageEnView1.Layers[ImageEnView1.LayersCurrent].Bitmap.CopyToTBitmap(ImageEnView2.Bitmap);
ImageEnView2.Update;

With Layers and RGB-32bit- Use a Bitmap memory stream
procedure TForm1.Button3Click(Sender: TObject);
var
  iMS: TMemoryStream;
begin
  iMS := TMemoryStream.Create;
  try
    ImageEnView1.Clear;
    //BMP_HandleTransparency = true then display with transparency
    ImageEnView1.IO.Params.BMP_HandleTransparency := True;
    ImageEnView1.IO.SaveToStreamBMP(iMS);
    iMS.Position := 0;
    //BMP_HandleTransparency = true then display with transparency
    ImageEnView2.IO.Params.BMP_HandleTransparency := True;
    ImageEnView2.IO.LoadFromStreamBMP(iMS);
    ImageEnView2.Update;
  finally
    iMS.Free;
  end;
end;

William Miller
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: