TailBite 1.0 Preview, soon in PureProject and PureArea

TailBite specific forum

Moderators: gnozal, ABBKlaus, lexvictory

gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Maxus wrote:The program with Import, ImportC commands does not work
In my experience, Import/EndImport does work with Tailbite (I use it in PureZIP to import the ZLIB functions).
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
User avatar
Maxus
User
User
Posts: 71
Joined: Thu Feb 16, 2006 9:35 am
Location: Russia
Contact:

Post by Maxus »

At me here this code gives out a mistake:

Code: Select all

Import "zlib.lib"
  crc32()
  inflateReset()
  inflateInit_()
  inflate()
  inflateEnd()
EndImport

ImportC "libPNG.lib"
  png_sig_cmp(a,b,c)
  png_create_read_struct(a.s,b,c,d)
  png_create_info_struct(a)
	png_set_sig_bytes(a,b)
	png_set_read_fn(a,b,c)
	png_read_png(a,b,c,d)
	png_get_IHDR(a,b,c,d,e,f,g,h,i)
	png_get_rows(a,b)
	png_destroy_read_struct(a,b,c)
	
	png_create_write_struct(a.s,b,c,d)
	png_set_write_fn(a,b,c,d)
	png_set_compression_level(a,b)
	png_set_IHDR(a,b,c,d,e,f,g,h,i)
  png_set_rows(a,b,c)
  png_write_png(a,b,c,d)
  png_destroy_write_struct(a,b,c)
EndImport

#PNG_COLOR_MASK_PALETTE=		1
#PNG_COLOR_MASK_COLOR=			2
#PNG_COLOR_MASK_ALPHA=			4

#PNG_COLOR_TYPE_GRAY=			0
#PNG_COLOR_TYPE_PALETTE=		(#PNG_COLOR_MASK_COLOR | #PNG_COLOR_MASK_PALETTE)
#PNG_COLOR_TYPE_RGB=			(#PNG_COLOR_MASK_COLOR)
#PNG_COLOR_TYPE_RGB_ALPHA=		(#PNG_COLOR_MASK_COLOR | #PNG_COLOR_MASK_ALPHA)
#PNG_COLOR_TYPE_GRAY_ALPHA=	(#PNG_COLOR_MASK_ALPHA)
#PNG_COLOR_TYPE_RGBA=			#PNG_COLOR_TYPE_RGB_ALPHA
#PNG_COLOR_TYPE_GA=			#PNG_COLOR_TYPE_GRAY_ALPHA

#PNG_TRANSFORM_IDENTITY=		$0000
#PNG_TRANSFORM_STRIP_16=		$0001
#PNG_TRANSFORM_STRIP_ALPHA=	$0002
#PNG_TRANSFORM_PACKING=		$0004
#PNG_TRANSFORM_PACKSWAP=		$0008
#PNG_TRANSFORM_EXPAND=			$0010
#PNG_TRANSFORM_INVERT_MONO=	$0020
#PNG_TRANSFORM_SHIFT=			$0040
#PNG_TRANSFORM_BGR=			$0080
#PNG_TRANSFORM_SWAP_ALPHA=		$0100
#PNG_TRANSFORM_SWAP_ENDIAN=	$0200
#PNG_TRANSFORM_INVERT_ALPHA=   $0400
#PNG_TRANSFORM_STRIP_FILLER=   $0800

#PNG_COMPRESSION_TYPE_DEFAULT=	0

#PNG_FILTER_TYPE_DEFAULT=		0
#PNG_INTRAPIXEL_DIFFERENCING=	64

#PNG_INTERLACE_NONE=			0
#PNG_INTERLACE_ADAM7=			1


  Global png_stream.l
  Global Bmp.BITMAP

ProcedureC png_read_fn(png_ptr,*buf,size)
  ProcedureReturn ReadData(png_stream,*buf,size)
EndProcedure

ProcedureC.l png_write_fn(png_ptr,*buf,size)
	ProcedureReturn WriteData(png_stream,*buf,size)
EndProcedure

ProcedureC.l png_flush_fn(png_ptr)
	FileSeek(png_stream,0)
EndProcedure

ProcedureDLL PNG_Init()
EndProcedure

ProcedureDLL LoadPNGImage(String$)
	png_stream=ReadFile(#PB_Any,String$)
	If Not png_stream: ProcedureReturn 0:EndIf
	buf.q
	If ReadData(png_stream,@buf,8)<>8 Or png_sig_cmp(@buf,0,8)<>0
	  CloseFile(png_stream)
		ProcedureReturn 0
	EndIf
	png_ptr=png_create_read_struct("1.2.8",#Null,#Null,#Null)
	info_ptr=png_create_info_struct(png_ptr)
	png_set_sig_bytes(png_ptr,8)
	png_set_read_fn(png_ptr,#Null,@png_read_fn())
	png_read_png(png_ptr,info_ptr,#PNG_TRANSFORM_BGR,0)
	png_get_IHDR(png_ptr,info_ptr,@width.l,@height.l,@bit_depth.l,@color_type.l,@interlace_type.l,@compression_type.l,@filter_method.l)
	If bit_depth=8
	  pf.l=0
	  Select color_type
	    Case #PNG_COLOR_TYPE_RGB_ALPHA
	      img.l=CreateImage(#PB_Any,width,height,32)
	      Bmp.BITMAP
        GetObject_(ImageID(img),SizeOf(BITMAP),@Bmp)
        *img=BMP\bmBits+height*BMP\bmWidthBytes
        *rows=png_get_rows(png_ptr,info_ptr)
        For y=0 To height-1
          *img-BMP\bmWidthBytes
          CopyMemory(PeekL(*rows),*img,BMP\bmWidthBytes)
          *rows+4
        Next
		EndSelect
	EndIf
  png_destroy_read_struct(@png_ptr,@info_ptr,#Null)
  CloseFile(png_stream)
  ProcedureReturn img
EndProcedure
PB_LoadPNGImage:
error: symbol already defined.
Sorry my English, I'm Russian
AMT Laboratory
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

I am not sure the problem is related to Tailbite.
There are some problems using ZLIB and a PNG decoder, as both use ZLIB functions : for example, PureZIP compiles Ok, but if you use it with the purebasic PNG decoder you get a linker error.
Did you try to use the 'As' keyword ? Maybe it helps ?

Code: Select all

Import "PureZIP_O.lib"
  ZLIBCompress(*DestBuffer, *DestBufferLen, *SourceBuffer, SourceBufferLen.l) As "_compress@16"
  ZLIBUnCompress(*DestBuffer, *DestBufferLen, *SourceBuffer, SourceBufferLen.l) As "_uncompress@16"
...
EndImport
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
User avatar
Maxus
User
User
Posts: 71
Joined: Thu Feb 16, 2006 9:35 am
Location: Russia
Contact:

Post by Maxus »

Programm not correct work in ProcedureC command.
Sorry my English, I'm Russian
AMT Laboratory
User avatar
Maxus
User
User
Posts: 71
Joined: Thu Feb 16, 2006 9:35 am
Location: Russia
Contact:

Post by Maxus »

Well all like has turned out to realize all.
Now I have learned PureBasic to keep PNG files with Alpha the channel.

Thanks ALL.
Sorry my English, I'm Russian
AMT Laboratory
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

Whoever's working on this, thanks for your time and effort. There is a small bug with calling procedures. It seems if you call a procedure by pointer once you can't call it by name after that. This is good PB code but Tailbite chokes on it:

Code: Select all

Procedure test()
  ProcedureReturn 1
EndProcedure

ProcedureDLL doit()
  CallFunctionFast(@test())
  test()
EndProcedure

doit()
BERESHEIT
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Post by ABBKlaus »

@netmaestro : could you test this Version http://www.purebasicpower.de/downloads/ ... er1.83.exe

i tested it with your example and it worked.

Regards Klaus
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

Yes, it seems fixed. Thanks for the quick work!
BERESHEIT
DarkDragon
Addict
Addict
Posts: 2344
Joined: Mon Jun 02, 2003 9:16 am
Location: Germany
Contact:

Post by DarkDragon »

@ABBKlaus:
---------------------------
TailBite Error
---------------------------
FAsm: Shared\CheckMeshCol.asm

flat assembler version 1.67.15 (348006 kilobytes memory)

C:\Programme\PureBasic4\TailBite\TBTemp\Functions\Shared\CheckMeshCol.asm [287]:

FDIV qword [D6]

error: undefined symbol.


Die Pipe wurde beendet.


---------------------------
OK
---------------------------
still errors... oh El_Choni...

Btw.: I already reported this bug.

http://www.purebasic.fr/english/viewtop ... 384#147384
bye,
Daniel
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Post by ABBKlaus »

@DarkDragon without any snippet i can´t reproduce it :wink:

Regards Klaus
DarkDragon
Addict
Addict
Posts: 2344
Joined: Mon Jun 02, 2003 9:16 am
Location: Germany
Contact:

Post by DarkDragon »

ABBKlaus wrote:@DarkDragon without any snippet i can´t reproduce it :wink:

Regards Klaus
With my snipped you can, but it won't be helpful :wink: .

Well I will send you a PM with the files.
bye,
Daniel
DarkDragon
Addict
Addict
Posts: 2344
Joined: Mon Jun 02, 2003 9:16 am
Location: Germany
Contact:

Post by DarkDragon »

*waits* for an answer... :lol: :)
bye,
Daniel
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Post by ABBKlaus »

well, it is a bit delayed due to good weather 8)

here is a new version to test : TailBite V1.84

Regards Klaus
Dare
Addict
Addict
Posts: 1965
Joined: Mon May 29, 2006 1:01 am
Location: Outback

Post by Dare »

Hi ABBKlaus,

Sorry if I am asking the obvious, but are you now the main maintainer of Tailbite?
And is there a page (link) where your latest release of tailbite can be downloaded at any time?

EDIT: Removed question on quirks. Found the help. :oops:

I did read through this thread but ended up a bit confused. :oops:
I get the impression that tailbite development has forked.
I am after the main branch or fork.


A huge thanks to everyone who has made an effort to get Tailbite back on the road!

Really appreciated! :D


PS:
The lib created is a real lib - (can be used standalone) or needs a dll?
Import seems to dislike it.

Thanks!
Dare2 cut down to size
DarkDragon
Addict
Addict
Posts: 2344
Joined: Mon Jun 02, 2003 9:16 am
Location: Germany
Contact:

Post by DarkDragon »

ABBKlaus wrote:well, it is a bit delayed due to good weather 8)

here is a new version to test : TailBite V1.84

Regards Klaus
Now it works!!! Thanks :-) .

A minor bug: in the statusbar(Desc file for the PBLibMaker) things are going wrong.

Code: Select all

SF3DCreate(X, Y, Width, Height, Flags, Title.s - My Comment which should come after the closing-bracket but it's before)
bye,
Daniel
Post Reply