IUP GUI toolkit and IM / CD libraries (by TECGRAF)

Everything else that doesn't fall into one of the other PB categories.
agb2008
User
User
Posts: 60
Joined: Fri Jan 15, 2016 2:22 pm

IUP GUI toolkit and IM / CD libraries (by TECGRAF)

Post by agb2008 »

IUP is a multi-platform toolkit for building graphical user interfaces. It offers a simple API in three basic languages: C, Lua and LED. IUP's purpose is to allow a program source code to be compiled in different systems without any modification. Its main advantages are:

- high performance, due to the fact that it uses native interface elements.
- fast learning by the user, due to the simplicity of its API.

IUP toolkit available in forms of static and dynamic 32/64 bit libraries for Windows / Linux. Additional information on download options available here.

IM is a toolkit for image representation, storage, capture and processing. The main goal of the library is to provide a simple API and abstraction of imaging for scientific applications.

The most popular file formats are supported: TIFF, BMP, PNG, JPEG, GIF and AVI. Image representation includes scientific data types, and about a hundred Image Processing operations are available.

CD is a vector graphics toolkit with device independent output. It is implemented in several platforms using native graphics libraries: Microsoft Windows (GDI) and X-Windows (XLIB).

The library contains functions to support both vector and image applications, and the visualization surface can be either a window or a more abstract surface, such as Image, Clipboard, Metafile, PS, and so on.

IUP toolkit functionality could be extended by using together with IM and CD libraries. A number of bindings for other programming languages exist for these libraries.

As for usage with PureBasic, one could refer to the following posts:

- bindings for older IUP 3.7/CD/IM static libraries (including static Windows 32 bit libs.) in this forum by edel
- suggested solution for dynamic 32/64 bit libraries usage with PureBasic by hallodri
- few other posts in this forum section related to IUP toolkit usage with PB

Let's discuss usage of these libraries with PureBasic here.
agb2008
User
User
Posts: 60
Joined: Fri Jan 15, 2016 2:22 pm

Re: IUP GUI toolkit and IM / CD libraries (by TECGRAF)

Post by agb2008 »

To be able to use UNICODE (UTF-8) string with IUP toolkit, one must set following Global values
just after toolkit initialization with IupOpen() function:

Code: Select all

IupSetGlobal("UTF8MODE","YES")
Also, as suggested by hallodri, following additional setting could be set:

Code: Select all

IupSetGlobal("UTF8AUTOCONVERT", "YES")
Unfortunately not all functions works correctly, while calling them from PureBasic application compiled in
unicode mode (opposite to earlier version of IUP functions definitions, that were designed for PB non-unicode
applications only):

IupSetAttribute failed to set attributes in UNICODE (UTF-8), but IupSetStrAttribute seems works O.K. - so it could be used as work-around.

For IupGetAttribute function, following work-around suggested by hallodri:

Code: Select all

Procedure.s IupGetAttribute2(i, s.s)
  Protected result = IupGetAttribute(i, s)  
  Protected ss.s = Space(MemoryStringLength(result, #PB_Ascii) *2)  
  If result        
    PokeS(@ss,PeekS(result,-1,#PB_Ascii),-1,#PB_Unicode)
    ProcedureReturn ss
  EndIf  
  ProcedureReturn ""
EndProcedure

Macro IupGetAttribute(a, b)
  IupGetAttribute2(a, b)
EndMacro
agb2008
User
User
Posts: 60
Joined: Fri Jan 15, 2016 2:22 pm

Re: IUP GUI toolkit and IM / CD libraries (by TECGRAF)

Post by agb2008 »

I've compiled IUP, IM and CD toolkit libraries on Linux 32/64 patform and recompiled
demo IUP samples that previously were built using these toolkits and PureBasic on
Windows 64 bit OS. Of cause there were quite simple basic aplications - but, to my
surprise they were compiled almost without any changes (just changed shared library
name).

Do not think that it would be so easy with more complex applications but so far - so good. :D

P.S. Could anyone please advice how static ".a" libraries on Linux could be used with PureBasic ?
agb2008
User
User
Posts: 60
Joined: Fri Jan 15, 2016 2:22 pm

Re: IUP GUI toolkit and IM / CD libraries (by TECGRAF)

Post by agb2008 »

New 3.19 version of IUP libraries now available for download from project web site:

http://iup.sourceforge.net/

Quite important note: a number of controls, headers and functions that were depreciated
removed in this version !

I would try to update PureBasic definitions to reflect these changes.

Other libraries were updated as well:

CD (Canvas Draw) library upgraded to version 5.10: https://sourceforge.net/projects/canvasdraw/

IM (Imaging Toolkit) library upgraded to version 3.11: https://sourceforge.net/projects/imtoolkit
Post Reply