• Welcome to Vampyre Imaging Library Forum. Please login or sign up.
 

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Galfar

151
Could you post a screenshot of how distorted it looks?

QuoteI suspect that I need to explictly state somewhere the file format to OpenGL?

No, OpenGL doesn't care how the file was stored on the disk.

Did you set texture filtering, wraping, etc. after the texture was created? Have you setup alpha blending in OpenGl correctly?
152
I would definitely use Asphyre if the target is Windows only. It has quite active forum and many examples (though many are for older versions). Latest edition can also directly use Imaging for loading images. 

153
In that last version of UnDelphiX which eats a lot of memory how do you display those 32bit images with alpha? You must use that TDXImageList or does it work with Surface.Draw as well?

With the code I sent you earlier you can convert any format with alpha channel (PNG, DDS, TGA, JNG, ...) to DIB32. Using TCanvas to draw anything is usually too slow for realtime usage.


I guess switching from DelphiX to another library is not an option for you, right?

154
Check out TDXImageList class mentioned in this forum thread http://delphigamedev.com/forums/viewtopic.php?f=2&t=1185.

I think you can't get any alpha blending simply by using Surface.Draw methods (http://www.gamedev.net/community/forums/topic.asp?topic_id=303701 - it would have to be hardware supported to work).
155
Looks like TDIB is bottom-top image, so try this instead of that single Move:


  LineBytes := DIB.WidthBytes;
  for I := 0 to Img.Height - 1 do
    Move(PByteArray(Img.Bits)[I * LineBytes], DIB.Scanline[I]^, LineBytes);
156
This should convert TImageData to TDIB, test it please.

var
  DIB: TDIB;
  Img: TImageData;

... load DDS to Img ...

DIB := TDIB.Create;
DIB.SetSize(Img.Width, Img.Height);
// make sure both are 32bit
DIB.BitCount := 32;
ConvertImage(Img, ifA8R8G8B8);
// copy bits
Move(Img.Bits, DIB.PBits, Img.Size);

... now make surface out of DIB32 ...


How do you display the surface afterwards?


EDIT: There's some info about drawing images with alpha channel in DelphiX: http://delphigamedev.com/forums/viewtopic.php?f=2&t=1185

157
TImagingGraphic loads all file types supported by Imaging, but saves only bitmaps. Saving is not needed though - try dxsurf.LoadFromGraphic(img)
Move(img, dxsurf, SizeOf(img);
and the other one is totally wrong, you can't use it like this.
I'll post some code for you to try later today.
158
One way is to load DDS file into TImagingGraphic (see ImagingComponents.pas unit). It's regular TGraphic descendant so you can then use TDirectDrawSurface.LoadFromGraphic method to load the surface. But I looked at the code of LoadFromGraphic and it won't preserve alpha channel.
Better way would be to create empty surface, lock it, and copy bits from image to the surface (and unlock).
Somewhat simpler may be to convert TImageData contents to DelphiX's TDIB. You can then create surface with preserved alpha from TDIB easily.



160
Help & Questions / Re: Copyrect doesn't work?
22 March 2010, 18:00:08
Img2 is empty (size 0x0 pixels) so you can't copy anything into it. Use NewImage function before CopyRect.

161
There's no self animated TGraphic class in Imaging currently.
You could manually switch frames one by one (you'll need to know frame delays for proper animation read from the file - this will be in SVN repository during today). Another option is to modify ExtraGIF mod found in Imaging\Extras\Contrib\ExtraGIF (self animating class for GIF images) to support APNG images as well.
162
Imaging only loads whole images. For many file formats it's easy but there are some that must be read entirely. Which formats are you interested in?

163
Check out VCL Image Browser and LCL Imager demos - they both can load and display APNG images.
Basically you need to load the image into TMultiImage and then convert each frame to VCL TBitmap descendant which you can easily display on form.
 
164
Can that JNG file be successfully opened back by LCL imager? If yes it's probably just some explorer error. How big is that file in bytes?
165
PNG would be the best I think (it's most widely supported).
You can try JNG (than's Jpeg with alpha channel - if you want to keep the file size very small) but not many programs support it.

SMF spam blocked by CleanTalk