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
 OpenGL

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
Tim Frost Posted - Jul 10 2013 : 07:16:43
Hi I am using ImageEn to load texture files for OpenGL. I have been using TImageEnIO with a TIEBitmap. However I want to be able to load and render in 64 bit RGBA (or BGRA). I have tried setting NativePixelFormat to true, but this does not seem to alter the format.

What is the best way to achieve this?

Thanks

Tim
6   L A T E S T    R E P L I E S    (Newest First)
fab Posted - Aug 16 2013 : 03:46:39
You should call SynchronizeRGBA(false) to copy from alpha plane to the A channel of the RGBA pixel.
Executing following code:

  ImageEnView1->LegacyBitmap = false;
  ImageEnView1->IO->LoadFromFile("test.png");
  ImageEnView1->IEBitmap->PixelFormat = ie32RGB;
  ImageEnView1->IEBitmap->SynchronizeRGBA(false);
  ShowMessage(IntToStr(ImageEnView1->IEBitmap->Pixels_ie32RGB[0, 0].A));


"test.png" has the top-left pixel fully transparent (0), so this code shows correctly "0". Removing SynchronizeRGBA, shows "255" (not synched).
Tim Frost Posted - Aug 15 2013 : 04:24:30
I have now more or less managed to open a file with an alpha channel. However I'd want to get the pixels in real RGBA or BGRA format, rather than haveing a separate bitmap for it. I have tried using:

if (IEView->IEBitmap->HasAlphaChannel)
{
IEView->IEBitmap->PixelFormat = ie32RGB;
IEView->IEBitmap->SynchronizeRGBA(true);
}

The pixel format is reset to ie24RGB when the file loads and it seemed that SynchronizeRGBA should put the alpha channel back in the right place. (using false makes no difference.)

What am I doing wrong?
fab Posted - Aug 15 2013 : 03:03:15
Native pixel format is not possible with ie32RGB format. You should convert to RGBA using the suggested code.
Tim Frost Posted - Aug 08 2013 : 08:13:23
And...

I am using IEView->IO->IEBitmap->Memory to access the pixels, as I need a pointer to all of them to pass to OpenGL.
Tim Frost Posted - Aug 08 2013 : 08:09:00
I am now back on this task.

I need to open a file and have the pixels in native format. I don't need a TImageEnView component as OpenGL will handle the dislay part.

I have tried this (with and TImageEnView component):
IEView->LegacyBitmap = false;
IEView->IO->NativePixelFormat = true;
IEView->IO->LoadFromFile(sFilename);

But whatever I do the format is alway 24bit RGB.

Could you give an example of how to open files in native format and how to extract the format from the IO->Params.

Thanks.
fab Posted - Jul 15 2013 : 03:39:24
ImageEn doesn't support 64 bit RGBA, but only 32 bit RGBA. You can set 32 bit RGBA with:

ImageEnView.LegacyBitmap := false;
ImageEnView.IEBitmap.PixelFormat := ie32RGB;

There are limitation using ie32RGB (ie some image processing functions or resampling filters do not work...).