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
 ImageEn and Graphics32
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

Borut

20 Posts

Posted - Dec 16 2013 :  14:31:09  Show Profile  Reply
I would like to attach graphics32 bitmap to ImageEnView bitmap.
It seems to be impossible because of the native 24 bit ImageEnView bitmap. Is it possible at all?
Thank you for your answers,
Borut

w2m

USA
1990 Posts

Posted - Dec 17 2013 :  10:33:06  Show Profile  Reply
It has been a while since I last used Graphics32, but I suspect that to use Graphics32 with ImageEn you would have to convert the Graphics32 bitmap to a plain TBitmap, then Assign the TBitmap to ImageEnView.Bitmap then call ImageEnView.Update. I do not think it is possible to "Attach" a Graphics32 bitmap to ImageEnView directly.

William Miller
Adirondack Software & Graphics
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html
Go to Top of Page

Borut

20 Posts

Posted - Dec 17 2013 :  15:07:02  Show Profile  Reply
I found your advice for creating transparent 32 bit png :

ImageEnView.IO.Params.BitsPerSample := 8;
ImageEnView.IO.Params.SamplesPerPixel := 4;
iRGB := ImageEnView.IEBitmap.Pixels[0, ImageEnView.IEBitmap.Height - 1];
ImageEnView.Proc.SetTransparentColors(iRGB, iRGB, 0);

I thought that this could be the way of "preparing " the ImageEnView for "accepting" 32 bit bitmap.

Borut

( I am not a professional programmer, so please forgive me , if I am suggesting nonsenses )
Go to Top of Page

w2m

USA
1990 Posts

Posted - Dec 17 2013 :  15:27:05  Show Profile  Reply
I do not think that will help. What you have to do is save the TBitmap32 to a TBitmap using a function provided with Graphics32. ImageEn knows nothing about Graphics32 bitmaps so you have to convert the TBitmap32 to TBitmap using a Graphics32 method.

Search the Graphics 32 help and source code methods to find how this can be done. ImageEn can not do it.

William Miller
Go to Top of Page

spetric

Croatia
308 Posts

Posted - Dec 18 2013 :  03:18:07  Show Profile  Reply
You must now internal structure of TBitmap32. And again, there are too much ifs and buts.

If TBitmap32 has separated color channels from alpha channel, and if color channels are in the same order as TIEbitmap (BGR), and if image alignement is DWORD then you can simply point TBitmap32 color channels to TIEBitamp channel, and alpha to alpha.

For example:

TIEBitmap *ieBitmap; // existing bitmap
TBitmap32 *bmp32; // created with empty bitmap with same size as ieBitmap
LPBYTE byte_ptr; // if you want to cast scanline pointers to BYTE*

bmp32->ColorChannel->ScanLine[bmp32->Height-1] = ieBitmap->Scanline[ieBitmap->Height-1];

/* if there exists alpha channel */
if (ieBitmap->AlphaChannel)
{
bmp32->AlphaChannel->ScanLine[bmp32->Height-1] =
ieBitmap->AlphaChannel->Scanline[ieBitmap->Height-1];
}

NOTE: Probably, there are no bmp32->ColorChannel and bmp32->AlphaChannel properties. I invented the names, but you'll get the picture.
With this method, I'm sharing single ieBitmap among three different image "containers".

But, if TBitmap32 keeps channels in RGBA mode (or ABGR), things get complicated, becuse you must construct some class that will perform pointer arithmetics between ieBitampa and TBitmap32.






Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: