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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Layers & TIEBitMap

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
bmesser Posted - Nov 02 2012 : 09:40:44
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.
1   L A T E S T    R E P L I E S    (Newest First)
w2m Posted - Nov 02 2012 : 10:08:15
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