Smart Fpg Editor

Started by darío, January 03, 2009, 01:19:52 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

darío

Hi,

I have uploaded a new version of Smart Fpg Editor (0.2.0).

It includes, among others, a graphic viewer, a visual control point editor, an advanced control point editor, support for a great deal of graphic formats, 8bpp FPGs palette can be selected from gif and png files, it can load DIV font files as FPGs, full color conversion support, you can remove transparency from added graphics when working with 16 and 32 bits, etc.

To my mind, it is quite usable if you don't need graphic extraction (which has not been implemented yet).

You can download it from the project page.

I appreciate any comment and specially, I appreciate if you can try it and say if it works or not, as I have a very limited number of computers where I can try it.

Hope you find it useful.

Darío
My sites:
Smart Fpg Editor - Painless FPG Edition for Bennu and PixTudio
fenixlib - .NET support for manipulating PixTudio, Bennu and Div graphic formats

square

I love this app.

Also, I would like to see this completed. At this point does most of the jobs that FPGEdit did but looks and works so much nicer.

All credit to you Darío.

I'll report any obvious bugs to you in this thread.
Square-theorist.

MisterN

i was hoping to use it but it served no purpose to me because it could not export to .map, im sure your program would become the #1 .fpg editor for that very sole purpose :)
now even though im posting in a thread thats old, maybe hell read it and come back and give us the finished results.
werg

handsource-dyko

#18
Yes, smart fpg editor is great. Especially because of it's controlpoint support. It's much more userfriendly then fpg edit 2005/2009.
Right now, I use them both, the only thing missing are some basic export features.


try compiling this program with the latest bennu version (not with fenix!)



/* "map convert".
*
* Copyright (C) 2010 Pieter kuperus/DYKO.
*
* This PROGRAM is free software; you can redistribute it AND/OR modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, OR
* (at your option) any later version.
*
* This PROGRAM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License FOR more details.
*
* You should have received a copy of the GNU General Public License
* along with this PROGRAM; IF NOT, write TO the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*
*/

/*
  This program allows a map or png file to be converted into another format.
*/ 


//IMPORT "mod_debug";
IMPORT "mod_dir";
IMPORT "mod_file";
//IMPORT "mod_key";
IMPORT "mod_map";
IMPORT "mod_screen";
IMPORT "mod_say";
IMPORT "mod_string";
IMPORT "mod_proc";
IMPORT "mod_video"
IMPORT "mod_sys";




CONST

SHELL=0; WIN=1;

LOCAL



GLOBAL



int extension;

int bits_per_pixel=0;
int info_bpp; info_width; info_height;


int systemmap; systemfile;

int inputfile;
int outputfile;

int filenamelength;

string inputfilename;
string outputfilename;

string inputfileextension;
int filetype_map; filetype_png;

string command_arg;


STRUCT dykoconfig;
   int handle;
   int command_result;
   string input_command;
   string compare_command="win";
   byte mode;
END


PRIVATE

BEGIN
   
   IF (file_exists("dykotools.cfg"))
      dykoconfig.handle=fopen("dykotools.cfg",O_READ);
      dykoconfig.input_command=fgets(dykoconfig.handle);
      fclose(dykoconfig.handle);
      // compare the command strings
      dykoconfig.command_result=strcasecmp(dykoconfig.input_command,dykoconfig.compare_command);
     
      IF (dykoconfig.command_result==0)
         dykoconfig.mode=WIN;
      ELSE
         dykoconfig.mode=SHELL;
      END           
   ELSE
      dykoconfig.mode=SHELL;
   END
   
   // fetch the filename from the first commandline argument
   inputfilename=argv[1];
   
   say("");
   say("");
   say("");
   say("");
   say("DYKO-Bennutools mapconvert, © 2010 Pieter Kuperus/DYKO.");
   say("");
   say("");
   say("");
   say("This PROGRAM is free software; you can redistribute it AND/OR modify");
   say("it under the terms of the GNU General Public License as published by");
   say("the Free Software Foundation; either version 2 of the License, OR");
   say("(at your option) any later version.");
   say("");
   say("This PROGRAM is distributed in the hope that it will be useful,");
   say("but WITHOUT ANY WARRANTY; without even the implied warranty of");
   say("MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  See the");
   say("GNU General Public License FOR more details.");
   say("");
   say("You should have received a copy of the GNU General Public License");
   say("along with this PROGRAM; IF NOT, write TO the Free Software");
   say("Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA");
   say("");
   say("");
   say("Bear in mind that when you use this tool on 8-bit images, the color palette");
   say("extracted from the file should be loaded when you open the converted imagefile");
   say("into a Fenix/Bennu compatible fpg/map application.");
   say("");
   say("");
   
   
   
   // check if a filename is entered, or if the filename exists.
   // if not, print a error message, otherwise start the conversion.   
   IF (NOT file_exists(inputfilename))
      IF (dykoconfig.mode==SHELL)
         say("file does not exist or no argument is given.");
         say("");
         say("USAGE: mapconvert filename.map  OR  mapconvert filename.png");
      END
      IF (dykoconfig.mode==WIN)
         SWITCH (os_id)
     
               CASE OS_WIN32:
                  command_arg="-mc1";
                  exec(_P_WAIT,"sterrdlg.exe",1,&command_arg);
               END
               CASE OS_LINUX:
                  command_arg="-mc1";
                  exec(_P_WAIT,"sterrdlg",1,&command_arg);
               END
               DEFAULT:
                  command_arg="-mc1";
                  exec(_P_WAIT,"sterrdlg",1,&command_arg);
               END
            END     
         END   
      exit("",0);
   ELSE
      // obtain the length of the filename.
      filenamelength=len(inputfilename);
   
      // remove the ".map or .png" extension of the filename.
      outputfilename=substr(inputfilename,0,(filenamelength-4));
     
      // obtain the file extesion.
      inputfileextension=substr(inputfilename,(filenamelength-3),3);
     
   
      // display the name of the inputfile and load it.
      say("filename loaded: "+inputfilename);
     
      // compare the filename extensions, and detect the filetype.
      filetype_map=strcasecmp(inputfileextension,"map");
      filetype_png=strcasecmp(inputfileextension,"png");
     
      IF (filetype_map==0)
         extension=1;
      END
     
      IF (filetype_png==0)
         extension=2;
      END
     
     
     
      SWITCH (extension)   
         CASE 1: // convert from MAP to PNG
         
            inputfile=map_load(inputfilename);
           
            info_bpp=graphic_info(0,inputfile,G_DEPTH);
           
            SWITCH (info_bpp)
               CASE 1:
                  bits_per_pixel=1;
                  set_mode(1024,768,8);
           
                  // create the system buffer.
                  systemmap=map_new(1024,768,8);
               END
               CASE 8:
                  bits_per_pixel=8;
                  set_mode(1024,768,8);
           
                  // create the system buffer.
                  systemmap=map_new(1024,768,8);
               END
               CASE 16:
                  bits_per_pixel=16;
                  set_mode(1024,768,16);
           
                  // create the system buffer.
                  systemmap=map_new(1024,768,16);
               END
               CASE 32:
                  bits_per_pixel=32;
                  set_mode(1024,768,32);
           
                  // create the system buffer.
                  systemmap=map_new(1024,768,32);
               END
               DEFAULT:
                  bits_per_pixel=32;
                  set_mode(1024,768,32);
           
                  // create the system buffer.
                  systemmap=map_new(1024,768,32);
               END             
            END
           
            // display a message that the file conversion is in progess.
            say("converting: "+inputfilename+ " to "+outputfilename+".png");
            outputfile=png_save(0,inputfile,(outputfilename+".png"));
           
            // create a palette file for the output file (only in 8 bpp mode)
            IF (bits_per_pixel==8)
            save_pal(outputfilename+"-map.pal");  
            END             
         END
         
         CASE 2: // convert from PNG to MAP
           
            inputfile=png_load(inputfilename);   

            info_bpp=graphic_info(0,inputfile,G_DEPTH);             
           
            SWITCH (info_bpp)
               CASE 1:
                  bits_per_pixel=1;
                  set_mode(1024,768,8);
           
                  // create the system buffer.
                  systemmap=map_new(1024,768,8);
               END
               CASE 8:
                  bits_per_pixel=8;
                  set_mode(1024,768,8);
           
                  // create the system buffer.
                  systemmap=map_new(1024,768,8);
               END
               CASE 16:
                  bits_per_pixel=16;
                  set_mode(1024,768,16);
           
                  // create the system buffer.
                  systemmap=map_new(1024,768,16);
               END
               CASE 32:
                  bits_per_pixel=32;
                  set_mode(1024,768,32);
           
                  // create the system buffer.
                  systemmap=map_new(1024,768,32);
               END
               DEFAULT:
                  bits_per_pixel=32;
                  set_mode(1024,768,32);
           
                  // create the system buffer.
                  systemmap=map_new(1024,768,32);
               END
            END   
           
            put_screen(0,inputfile);
           
            // display a message that the file conversion is in progess.
            say("converting: "+inputfilename+ " to "+outputfilename+".map");
            outputfile=map_save(0,inputfile,(outputfilename+".map"));
           
            // create a palette file for the output file (only in 8 bpp mode)
            IF (bits_per_pixel==8)
            save_pal(outputfilename+"-png.pal");
            end           
         END   
      END
   
      // say that it's completed.
      IF (dykoconfig.mode==SHELL)
         say("done.");
      END
      IF (dykoconfig.mode==WIN)
         SWITCH (os_id)
     
               CASE OS_WIN32:
                  command_arg="-mc2";
                  exec(_P_WAIT,"sterrdlg.exe",1,&command_arg);
               END
               CASE OS_LINUX:
                  command_arg="-mc2";
                  exec(_P_WAIT,"sterrdlg",1,&command_arg);
               END
               DEFAULT:
                  command_arg="-mc2";
                  exec(_P_WAIT,"sterrdlg",1,&command_arg);
               END
            END
        END   
   END
     
END





It's a commandline tool I wrote about a year ago for this purpose. Be carefull with 8 bit images though, palettes are not
handled properly.

Usag of the program: bgdi mapconvert.dcb filename.png will convert png to map.
If you write a batch file you can create a batch conversion proces with this tool.


MisterN

error:
file does not exist or no argument is given

USAGE: mapconvert filename.map or mapconvert filename.png
werg

handsource-dyko

You did someting wrong.

example: bgdi.exe mapconvert.dcb sprite1.png (ofcourse you need to compile it first with bgdc)

should work, have you ever worked with dos or linux or commandline interfaces before?
If you compile the program as:bgdc -s bgdi.exe mapconvert.prg
a mapconvrt.exe file will be created, then you can also type: mapconvert sprite1.png

darío

Hi,

This has been discontinued for a while... However I've decided to upload  a new package with an updated version that adds MAP exporting functionality and fixes some bugs (being the most important, one that could cause loss of Control Point information from maps containing non-consecutive control points).

All the relevant information is in the first post, which is also available in Spanish.

Regards,

Darío

P.D.: If you use the program when working with Bennu I'd really like to know... it's encouraging :)
My sites:
Smart Fpg Editor - Painless FPG Edition for Bennu and PixTudio
fenixlib - .NET support for manipulating PixTudio, Bennu and Div graphic formats

darío

New version uploaded with PNG export support.
My sites:
Smart Fpg Editor - Painless FPG Edition for Bennu and PixTudio
fenixlib - .NET support for manipulating PixTudio, Bennu and Div graphic formats

SplinterGU

Download Lastest BennuGD Release: http://www.bennugd.org/node/2

handsource-dyko


darío

I want to share some progress I made this weekend:

The following video shows the new Drag&Drop and Copy&Paste features that will be major includes for next release 0.4.
My sites:
Smart Fpg Editor - Painless FPG Edition for Bennu and PixTudio
fenixlib - .NET support for manipulating PixTudio, Bennu and Div graphic formats

tmoney


handsource-dyko

Wow! Looks pretty neat. This will surely become the ultimate fpg tool.
Keep it up.

izubiaurre

Great Darío! The first release was good, but this one working directly with drawing apps gains a lot of functionality! I think if it works with Photoshop, also it'll work with PaintShopPro.

Thanks a lot!

darío

#29
Thanks for all the comments! :)

I want to explain some limitations for in case someone can help me to overcome them. NOTE: You might not be interested in the following!:

The clipboard and d&d will work with any application that supports CF_DIB format for the clipboard and drag&drop operations. However, all applications I tested (photoshop, gimp, paint.NET, openoffice, paint, ...), generate always a 32bpp WITHOUT alpha component, no matter the picture you are working with so:

  • For 32bpp images it is not very useful if we are working with transparencies (if this it not the case, there is no problem)
  • For 16 bpp images it will be more or less OK as soon as I implement a functionality "define transparent color" for the "add graphic dialog", since current conversion from 32bpp only converts ">50 % transparent" pixels to rgb5:6:5 0x00 and "32bpp black pixels" would be converted to 0x01.
  • For 8bpp it will work well provided the following:

  • The colors you are using in your graphic editor app match exactly those of the palette.
  • The palette does not contain duplicated colors.
[/list]
In other cases the conversion process does not ensure having the expected results.

So summing up: we are still stuck to work with PNG (or other formats) files... only in some cases we can safely use the copy&paste or drag&dropp functionality without losing information... (this does not happen within SFPGE because it defines its own clipboard format.)

I don't see a way to overcome this limitation.. I noticed that the behaviour is exactly the same as when copying or drag&dropping from Photoshop to other applications....
If you have any suggestion I'd like to hear it!

I'm thinking of another possible way to ease the process of editing graphics outside SPGE with has nothing to do with Copy&Paste, but it is not a priority for the incoming releases (0.4 and 0.5)...
My sites:
Smart Fpg Editor - Painless FPG Edition for Bennu and PixTudio
fenixlib - .NET support for manipulating PixTudio, Bennu and Div graphic formats