How do I add an image plugin?

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by El_Choni.

Hi,

I'd like to know if it's possible to add image plugins as UserLibraries, so they can be used with LoadImage() and SaveImage(), and how to do it. Thanks,

El_Choni
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Manolo.

Yo tampoco, hehehe

:)
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Berikco.

Yes, its possible, as Fred rewrote the Image and Sound system to work with plugins.
I dont Know how it must be done.....Fred :)


Regards,

Berikco

http://users.pandora.be/berikco/purebasic.htm
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by fred.

I will post an example tonight and put it in the SDK if I got some time.

Fred - AlphaSND
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by El_Choni.

Thanks, Fred :)

El_Choni
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by fred.

Ok, done. Try http://www.purebasic.com/ImagePluginFAKE.zip
Give me your comment and impressions to see if its easy enough to understand. Good luck !

Fred - AlphaSND
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by El_Choni.

Hi,

I've played a bit with the example and finally built a PureBasic library (doesn't decode for now, just returns width and height).

But PB complains: can't create PureBasic.exe

NAsm.out says:

Code: Select all

Functions\Image .text: undefined reference to 'PB_ImageDecoder_Register'
This is my desc file:

Code: Select all

ASM
;
0
;
LIB
;
1
ImagePlugin
;
ImagePlugin
; Version 1.0
UsePPMImageDecoder
None
;
;UsePPMImageEncoder
;None
;
This is the related part of the asm file:

Code: Select all

; Header:
extrn PB_ImageDecoder_Register

public PB_UsePPMImageDecoder

; Procedures GetWidth, Check, etc.

PB_UsePPMImageDecoder:
    cmp [Registered], dword 0
    jne .end
    mov [ID.Check], Check
    mov [ID.GetWidth], GetWidth
    mov [ID.GetHeight], GetHeight
    mov [ID.Decode], Decode
    push dword ID
    call PB_ImageDecoder_Register
    mov [Registered], dword 1
  .end:
    mov eax, [Registered]
    ret
Anyone can give me a clue about this? I'm thinking of going back to Nasm, I'm not familiar with Fasm and most the problems I've had with the code was related to the different syntax.

Weel, that's all for now, thanks,

El_Choni
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Amiga5k.
I will post an example tonight and put it in the SDK if I got some time.
SDK? Where could one download such an item?

Russell



***Commodore 64 - Over one million cycles per second, 16 vibrant colors, 3 incredible audio channels and 38,911 Basic Bytes Free! Who could ask for anything more?***
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Berikco.
Originally posted by Amiga5k
I will post an example tonight and put it in the SDK if I got some time.
SDK? Where could one download such an item?

Russell



***Commodore 64 - Over one million cycles per second, 16 vibrant colors, 3 incredible audio channels and 38,911 Basic Bytes Free! Who could ask for anything more?***
The SDK for making userlibs is in your purebasic dir

Regards,

Berikco

http://users.pandora.be/berikco/purebasic.htm
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Amiga5k.

Oh... THAT sdk Very good. Carry on.

Russell

***Commodore 64 - Over one million cycles per second, 16 vibrant colors, 3 incredible audio channels and 38,911 Basic Bytes Free! Who could ask for anything more?***
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by fred.

El_Choni:

It's _PB_ImageDecoder_Register@4 (C stdcall convention). Should work then.

Fred - AlphaSND
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Amiga5k.
I'm thinking of going back to Nasm, I'm not familiar with Fasm and most the problems I've had with the code was related to the different syntax.
Just out of curiosity, why did we change from Nasm to Fasm? (Spasm is next, I think :)) Is Nasm not multiplatform?

Russell

***Commodore 64 - Over one million cycles per second, 16 vibrant colors, 3 incredible audio channels and 38,911 Basic Bytes Free! Who could ask for anything more?***
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Kale.

viewtopic.php?t=2395

--Kale

In love with PureBasic! :)
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by El_Choni.

Thanks, Fred! It works now, and I'll be able to code some plugins :)

El_Choni
Post Reply