System: Windows, Linux, other
Compiler/IDE: FPC, Lazarus
Libraries/API: None

After seeing the threads and playing with hq2x myself I started looking for a pascal equivalent. There is none . So, I converted it myself.

I converted the entire contents of hp2x from C++ to FPC/Lazarus (should work in Delphi too). Problem is the output image is always black (read blank). I know that this is due to pointer problems, but it may also be due to the fact that I had to use LazarusRGB to load the images (this is so I can get the pointer to the pixels).

If anyone feels frisky download http://www.eonclash.com/PGD/hq2x.zip and see if you can fix it.

I think that there is quite a few of us that could benefit from just such a unit.

In case your lazy, my conversion of the pointers looks as follows:
C Source:
Code:
*((int*)pc) = (c1*3+c2) >> 2;
Pascal:[pascal]Longword(pc{$IFDEF DeReferenceOutPointers}^{$ENDIF}) := (c1*3+c2) shr 2;[/pascal]

If you have DeReferenceInPointers defined then the app will blow up with an invalid index (I think this is due to the alpha channel in Lazarus RGB pixel pointer), if you don't have it defined then you get a black output image. Undefining DeReferenceOutPointers won't allow the application to compile, as the compiler can't match the types. I also had to make one minor change to the init method due to FPC complaining about signed assignment when there wasn't a problem in the first place .

Lets get this working for all of our sakes