Log in

View Full Version : Loadfromfile



snorga
07-09-2004, 04:24 PM
I have some trouble with TAsphyreImage3.loadfromfile.

LoadFromFile(FileName,Point(16,16),Point(64,64),Po int(16,16),...)

The picture looks like this, ie 4x4 tiles:


01 02 03 04
05 06 07 08
09 10 11 12
13 14 15 16


But after, if i try to draw them from 1 to 16, they come out like this:


01 06 11 16 01 06 11 16 01 06 11 16 01 06 11 16

ie repeating 01 06 11 16

Do i make any sense?
I can try and make a small example if you need it?

snorga
07-09-2004, 04:54 PM
Testing update:

(From "TAsphyreImage.LoadFromFile")

// 2. tile the bitmap on target
Bmp.TileOnBmp(BTarget, nil, ATextureSize, APatternSize, ARealSize, APatternSize, taSource, 0, 0);
BTarget.SaveToFile('c:\temp\'+ExtractFileName(File Name),btBmp,0,0);


For testing i tried the abow, and the filed saved is wrong, when multilined, ie 4x4, or 2x2, but not 4x1.

Seems like the VTDTool.exe have the same problem.

snorga
07-09-2004, 05:09 PM
Found it =)

procedure TBitmapEx.TileOnBmp (in AsphyreBmp.pas)


DestPoint.X:= ((PatternIndex mod ImgInRow) * OutPSize.X) + DestAdd.X;
DestPoint.Y:= (((PatternIndex div ImgInRow) mod ImgInCol) * OutPSize.Y) + DestAdd.Y;
SrcPoint.X:= ((SourcePattern mod PInRow) * InPSize.X) + SourceAdd.X;
SrcPoint.Y:= (((SourcePattern mod PInRow) mod PInCol) * InPSize.Y) + SourceAdd.Y;

the last line should be


SrcPoint.Y:= (((SourcePattern div PInRow) mod PInCol) * InPSize.Y) + SourceAdd.Y;

snorga
07-09-2004, 08:55 PM
Next problem with LoadFromFile:
It seems to have some issues with loading BMP pictures.
Some dont show at all (maybe alpha is #00, but dont know), and some get scaled (down to ~3/4) on width and get some black on the right side. :cry:
Seems to have something to do with alpha channel. :?:
To bmp file it self loads fine, it when converted to texture somethings goes wrong.

Load bmp from the VTDB Tool work fine throu..

LP
08-09-2004, 02:50 AM
Thanks for pointing out the problem! As for problems loading bitmaps, if you can provide a test bitmap, it could help a lot. There were problems loading 24-bit bitmaps (as well as using this bitdepth in VTDb), but I've thought I fixed it (if they don't appear in VTDb tool then I might've included non-fixed DLL).
I've been thinking on making Asphyre to run without DLL, but I've almost finished new Software Renderer (very optimized and even uses MMX to speed things up... also supports more rendering effects than those possible in Direct3D) and since used automatically generated code (optimized for every possible effect combination) - the entire code is *VERY* long and Delphi takes quite time to compile it. Finally I decided to compile the software renderer and new optimized pixel conversion unit into a single DLL and provide it in like in previous PowerDraw versions. I hope not to include any related bugs in it....

Cheers,
Lifepower

snorga
08-09-2004, 06:33 AM
NP, I am just helping you help me :D

As for the BMP, no the problem dont seems to happen with VTDb tool. (it DOES have problem load multi-pattern'ed-pictures still)
So i might just be the non-fixed DLL :P
And it seems to be all bmp's that load wrong.
Any chance of a newer hopfully-fixed-dll? :wink:

snorga
08-09-2004, 04:03 PM
Update: Just found out, as i tried to convert my bmp to tga to make it work. TGA without a alpha channel (ie 24 bpp), does the same as bmp, it get scaled down to 3/4 width.. (with a black last 1/4 width)

updated dll coming soon? *please* :wink: