Code using hq2x libhqx.dll

Post your FreeBASIC source, examples, tips and tricks here. Please don’t post code without including an explanation.
Post Reply
lassar
Posts: 306
Joined: Jan 17, 2006 1:35

Code using hq2x libhqx.dll

Post by lassar »

Example of hq2x scaler using libhqx.dll

Code: Select all


'****************************************************************************
'                                   By Randall Glass
'
'                 I donate this code to the public domain
'
'*****************************************************************************

#LANG "fblite"

#include once "fbgfx.bi"
'DEFINT A-Z

Declare function dylibsymbol ( byval libhandle as integer, symbol as string ) as any ptr


DIM DllPTR AS ANY PTR

DIM SHARED hqxInit As SUB stdcall()

DIM SHARED hq2x_32 As SUB stdcall( BYVAL Org AS any ptr, BYVAL Dest AS any ptr, BYVAL width AS INTEGER, BYVAL height AS INTEGER)   
DIM SHARED hq3x_32 As SUB stdcall( BYVAL Org AS any ptr, BYVAL Dest AS any ptr, BYVAL width AS INTEGER, BYVAL height AS INTEGER)   
DIM SHARED hq4x_32 As SUB stdcall( BYVAL Org AS any ptr, BYVAL Dest AS any ptr, BYVAL width AS INTEGER, BYVAL height AS INTEGER)   


DllPTR = DyLibLoad("libhqx-1.dll")
If DllPTR = 0 Then
  Print "Unable to load libhqx-1.dll"
  SLEEP
  END
END IF


hqxInit = DyLibSymbol ( DllPTR, "hqxInit" )
hq2x_32 = DyLibSymbol ( DllPTR, "hq2x_32" )

dim shared ScrPtr as any ptr

ScreenRes(1280, 960, 32,, 1)  ' full screen mode

Dim IMG AS ANY PTR 

IMG = ImageCreate(640, 480,,32)

BLOAD "Radtutor.bmp", IMG

result% = ImageInfo( IMG,,,,, ScrPtr)

cls 
SCREENLOCK
hqxInit()
hq2x_32(ScrPtr, Screenptr, 640, 480)
SCREENUNLOCK
sleep
END

Last edited by lassar on Aug 09, 2018 14:17, edited 5 times in total.
MrSwiss
Posts: 3910
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: Code using hq2x libhqx.dll

Post by MrSwiss »

Is this typedef making a uinteger static array of size 2^24 ?
No, not UInteger but, ULong as in:

Code: Select all

Type uint32_t As ULong
UInteger in FBC 64 = ULongInt! (ULong is always 32 bit's, both compilers!)

You should re-code, with correct data-types ...
Post Reply