T O P I C R E V I E W |
Borut |
Posted - Dec 16 2013 : 14:31:09 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 |
4 L A T E S T R E P L I E S (Newest First) |
spetric |
Posted - Dec 18 2013 : 03:18:07 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.
|
w2m |
Posted - Dec 17 2013 : 15:27:05 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 |
Borut |
Posted - Dec 17 2013 : 15:07:02 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 ) |
w2m |
Posted - Dec 17 2013 : 10:33:06 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 |
|
|