Load image in gem app

GFA BASIC-related articles in here please

Moderators: simonsunnyboy, Mug UK, Zorro 2, Moderator Team

sashapont
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 148
Joined: Sat Jun 03, 2017 9:40 pm

Load image in gem app

Postby sashapont » Thu Jan 10, 2019 2:09 pm

I Try to find some example of loading images in gem program. I find this sample but it is not work in mint. How I can fix it?

Code: Select all

'
' Palette cycling
'
RESERVE 50000                   ! Memory for GFA itself
REZ|=XBIOS(4)                   ! Save the basic rez
VOID XBIOS(5,L:-1,L:-1,0)       ! Low Rez
LOADPIC("CYCLING")
~XBIOS(6,L:PAL%)                ! Install the palette
BMOVE PIC%,XBIOS(2),32000       ! Display the picture
'
REPEAT
  VSYNC
  VSYNC                         ! Add more VSYNC to get a slower animation speed
  COLOR_OUT&=CARD{PAL%+30}      ! Save the last color (nø15)
  BMOVE PAL%+2,PAL%+4,28        ! Shift all colors to the right
  CARD{PAL%+2}=COLOR_OUT&       ! Replace the fist color (nø1) by the saved one
  ~XBIOS(6,L:PAL%)              ! Install new palette
  '
  KEYTEST C|                    ! Test the keyboard
UNTIL C|=32     ! Quit if space pressed
'
~XBIOS(5,L:-1,L:-1,REZ|)        ! Back to the right Rez
~MFREE(PAL%)                    ! Clear the pal...
~MFREE(PIC%)                    ! ... and pic areas
END
'
PROCEDURE LOADPIC(IMAGE$)
  IMAGE$=IMAGE$+".PI1"
  PAL%=MALLOC(32)
  PIC%=MALLOC(32000)
  OPEN "I",#1,IMAGE$
  SEEK #1,2                     ! Jump over the Rez coded in the pic
  BGET #1,PAL%,32               ! Get the color palette
  BGET #1,PIC%,32000            ! Get the picture itself
  CLOSE
RETURN
Atari Falcon, Firebee

User avatar
lp
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2446
Joined: Wed Nov 12, 2003 11:09 pm
Location: GFA Headquarters
Contact:

Re: Load image in gem app

Postby lp » Thu Jan 10, 2019 3:06 pm

Under MiNT if you clobber the screen, you must find a way to restore it.

Code: Select all

~wind_update(begin_update) !lock screen to stop other apps from drawing on it
sget srcn$ !save screen
' show your image here
sput scrn$ !restore screen
~wind_update(end_update) !unlock screen

Correct way is to put image in a window under multitasking. ;)
Last edited by lp on Thu Jan 10, 2019 3:10 pm, edited 3 times in total.

User avatar
Rajah Lone
Captain Atari
Captain Atari
Posts: 454
Joined: Wed Aug 07, 2002 12:27 pm
Location: Lyon / France
Contact:

Re: Load image in gem app

Postby Rajah Lone » Thu Jan 10, 2019 3:06 pm

- XBIOS screen functions are forbidden with non-standard Atari screenmodes and/or multitasking environment. Your source code may work on standard ST-low mode, but is not compatible with other machines and screens.

- with GEM, use GEM functions -> VDI for screen and AES for objects/windows/events -> the function used to show bitmap on screen is vro_cpyfm (GFA's BITBLT function is similar)

- 32000 is the size for ST screen: x*y*nb_planes = 320*200*4 or 640*200*2 or 640*400*1. On FireBee or Falcon or TT, the amount is different.

-> you should read Manga Puzzle or Sygne code sources. I use a converter named 2VDI or 2DGX, to convert GIF to VDI custom format (separated bitplanes) easy to use for whatever kind of screens. As always, see the tos.hyp doc about VDI functions.

NB: learning takes time and GEM/VDI on enhanced Ataris may seem very tedious. If your goal is to learn, then I wish you good luck. If your purpose is to obtain a full grown application quickly, maybe you should explain your project to me, and I may write the correct GEM-GFA code.

sashapont
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 148
Joined: Sat Jun 03, 2017 9:40 pm

Re: Load image in gem app

Postby sashapont » Thu Jan 10, 2019 10:02 pm

Rajah Lone: Thank you very much! I will try to read code from this project!

Rajah Lone wrote:-

NB: learning takes time and GEM/VDI on enhanced Ataris may seem very tedious. If your goal is to learn, then I wish you good luck. If your purpose is to obtain a full grown application quickly, maybe you should explain your project to me, and I may write the correct GEM-GFA code.


Yes it is very hard, but very interesting for me. It is sad that there are no good tutorial/videos about modern mint development for gem apps. I think, that will be great feature if in GFA will be wizards or constructors for creating basic gem apps.
Atari Falcon, Firebee

User avatar
Rajah Lone
Captain Atari
Captain Atari
Posts: 454
Joined: Wed Aug 07, 2002 12:27 pm
Location: Lyon / France
Contact:

Re: Load image in gem app

Postby Rajah Lone » Thu Jan 10, 2019 10:59 pm

sashapont wrote:It is sad that there are no good tutorial/videos about modern mint development for gem apps.

A video or even a tube channel won't be enough. Worth a try (Vincent Rivière ?). There are very good articles from old magazines such as Claude ATTARD's in french ST Magazine, but it's hard to translate them. Read but don't use his crappy samples code. Surely some good articles exists in English language.
sashapont wrote:I think, that will be great feature if in GFA will be wizards or constructors for creating basic gem apps.

There are some GEM librairies, but only for the AES part. It simplfies work, but prevent people to understand GEM and become a master.
A good way is to take an open/free/bits of sources of a program, make your own by modify it to your purposes. I started with the old MENU.PRG, GFA coded, provided with the GFA compiler, this was so bad a program that everyone wanted to fix it.

sashapont
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 148
Joined: Sat Jun 03, 2017 9:40 pm

Re: Load image in gem app

Postby sashapont » Mon Jan 14, 2019 7:19 pm

Rajah Lone wrote:-
-> you should read Manga Puzzle or Sygne code sources. I use a converter named 2VDI or 2DGX, to convert GIF to VDI custom format (separated bitplanes) easy to use for whatever kind of screens. As always, see the tos.hyp doc about VDI functions.


What gif format and resolution must for manga-puzzle? I tru to convert and always have crash
Atari Falcon, Firebee

User avatar
Rajah Lone
Captain Atari
Captain Atari
Posts: 454
Joined: Wed Aug 07, 2002 12:27 pm
Location: Lyon / France
Contact:

Re: Load image in gem app

Postby Rajah Lone » Mon Jan 14, 2019 8:38 pm

The converter uses PARX.SYS modules for image/gif loading. GIF format should be standard, works with the macOS softwares my setup.

Also take care of the 68k or CFv4e version, setimage.org is old, there is not FATAL test to know about the used CPU.

sashapont
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 148
Joined: Sat Jun 03, 2017 9:40 pm

Re: Load image in gem app

Postby sashapont » Mon Jan 14, 2019 8:48 pm

Yes I install PARX.SYS and compile it for cf Image is gif 500*375
Atari Falcon, Firebee

User avatar
Rajah Lone
Captain Atari
Captain Atari
Posts: 454
Joined: Wed Aug 07, 2002 12:27 pm
Location: Lyon / France
Contact:

Re: Load image in gem app

Postby Rajah Lone » Mon Jan 14, 2019 8:59 pm

Also, the TRM module crashes in 256c screenmode: it can't handle the "packed pixels" screenmode of the FireBee (big difference on the Falcon, the 256c screenmode is "interleaved" bitplanes).

I suggest you try on Aranym or AtariX or Hatari.

sashapont
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 148
Joined: Sat Jun 03, 2017 9:40 pm

Re: Load image in gem app

Postby sashapont » Tue Jan 15, 2019 8:05 pm

Yes in hatary it is work!
Atari Falcon, Firebee

sashapont
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 148
Joined: Sat Jun 03, 2017 9:40 pm

Re: Load image in gem app

Postby sashapont » Tue Jan 15, 2019 8:15 pm

Is it possible to load image to RSC files not to vdi?
Atari Falcon, Firebee

User avatar
Rajah Lone
Captain Atari
Captain Atari
Posts: 454
Joined: Wed Aug 07, 2002 12:27 pm
Location: Lyon / France
Contact:

Re: Load image in gem app

Postby Rajah Lone » Tue Jan 15, 2019 10:07 pm

Yes, but as color icons. In Ressource Master or Interface, create a color icon and import the image in XIMG format. You'll have a palette problem, so convert your image to NVDI palette (better than standard TOS/GEM palette). You can unset the selected version of the icon, and some 1x, 2x, 4x bitplanes to have only a 8x bitplanes unselected icon = image. The AES translates/converts the icon/image to the screenmode.

I did it with old version of Rosemary's Racoon Strip Game (comics cover in info windows). But there are several drawback:
- eats a lot of RAM.
- with some old AES, convertion is bad -> better use a real image. That will work with all AES, event on TOS 1.0.

Playmobil
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 140
Joined: Fri Nov 13, 2015 7:40 pm

Re: Load image in gem app

Postby Playmobil » Wed Jan 16, 2019 6:33 pm

Rajah Lone wrote:...You'll have a palette problem, so convert your image to NVDI palette (better than standard TOS/GEM palette).


Hi Rajah... Wich app you use to convert PNG/GIf ==> XIMG ==> NVDI palette ? Because I have some troubles with that when I want to convert a PNG/GIF image, to an icone...


In French :
Salut Rajah... J'ai aussi parfois ce problème de couleurs lors de conversion d'icône PNG ou GIF, une fois importé dans RSC Master, bhaaa, parfois les couleurs sont dégueux... Un joli dégradé de bleu, devient par exemple un amalgame de orange et vert du (pas) plus bel effet ! :o
Cela ne le fait pas sur toutes les images/icônes... Donc quel logiciel, méthode ? Merci d'avance ! :wink:

sashapont
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 148
Joined: Sat Jun 03, 2017 9:40 pm

Re: Load image in gem app

Postby sashapont » Wed Jan 16, 2019 7:03 pm

In what app I can create icons and how I can import it to Ressource file. I cannot find import option in Ressource Master
Atari Falcon, Firebee

User avatar
Rajah Lone
Captain Atari
Captain Atari
Posts: 454
Joined: Wed Aug 07, 2002 12:27 pm
Location: Lyon / France
Contact:

Re: Load image in gem app

Postby Rajah Lone » Wed Jan 16, 2019 9:05 pm

Interface is better for icon management, but Ressource Master can do it also. Finding the import option is hard, but it can be done, in the icon editor, click the icons on the top-left which enable other icons, one of them is the import function. Create your icon the save size of the image. The size should be small, huge images are not advised.

sashapont
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 148
Joined: Sat Jun 03, 2017 9:40 pm

Re: Load image in gem app

Postby sashapont » Thu Jan 17, 2019 8:15 am

Rajah Lone wrote:Interface is better for icon management, but Ressource Master can do it also. Finding the import option is hard, but it can be done, in the icon editor, click the icons on the top-left which enable other icons, one of them is the import function. Create your icon the save size of the image. The size should be small, huge images are not advised.


It is my screen of ResourceMaster. Where is import function?

https://cloud.mail.ru/public/9Bbv/bM2fGi7rT
Atari Falcon, Firebee

Playmobil
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 140
Joined: Fri Nov 13, 2015 7:40 pm

Re: Load image in gem app

Postby Playmobil » Thu Jan 17, 2019 12:38 pm

:D Beetween the Hand tool, and the yellow icon selected....

Here too, I have all this colored pixels... :?

User avatar
Rajah Lone
Captain Atari
Captain Atari
Posts: 454
Joined: Wed Aug 07, 2002 12:27 pm
Location: Lyon / France
Contact:

Re: Load image in gem app

Postby Rajah Lone » Thu Jan 17, 2019 11:44 pm

sashapont wrote:It is my screen of ResourceMaster. Where is import function?


The icons related to image importation are jammed.


sashapont
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 148
Joined: Sat Jun 03, 2017 9:40 pm

Re: Load image in gem app

Postby sashapont » Fri Jan 18, 2019 12:14 pm

Cool! I try it! Thank you! In what format sounds in manga app?
Atari Falcon, Firebee

User avatar
Rajah Lone
Captain Atari
Captain Atari
Posts: 454
Joined: Wed Aug 07, 2002 12:27 pm
Location: Lyon / France
Contact:

Re: Load image in gem app

Postby Rajah Lone » Fri Jan 18, 2019 2:47 pm

Sounds in my games are raw format (no header). I use 525.PRG (five to five) sound converter, the data are directly used for DMA sound functions.
use 525.PRG directly on Hatari, I don't think it will run on the FireBee.
Sorry, can't find it on the internet, so provided in this post (sorry if the author read this).
You do not have the required permissions to view the files attached to this post.

sashapont
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 148
Joined: Sat Jun 03, 2017 9:40 pm

Re: Load image in gem app

Postby sashapont » Fri Jan 18, 2019 5:05 pm

In 525.PRG I can convert wav file to snd is it right?
Atari Falcon, Firebee

User avatar
Rajah Lone
Captain Atari
Captain Atari
Posts: 454
Joined: Wed Aug 07, 2002 12:27 pm
Location: Lyon / France
Contact:

Re: Load image in gem app

Postby Rajah Lone » Fri Jan 18, 2019 7:27 pm

No. SND format is for the YM chip. You have to edit partitions with a SND "tracker"/editor.

Here, we are talking of DMA sound with digitalized datas. 525.PRG: WAV or whatever to RAW.

sashapont
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 148
Joined: Sat Jun 03, 2017 9:40 pm

Re: Load image in gem app

Postby sashapont » Thu Jan 31, 2019 9:28 pm

Is DGI format=VDI format? I try to convert 2VDI from Rosemary and have this output format. Is it right?
Atari Falcon, Firebee

User avatar
Rajah Lone
Captain Atari
Captain Atari
Posts: 454
Joined: Wed Aug 07, 2002 12:27 pm
Location: Lyon / France
Contact:

Re: Load image in gem app

Postby Rajah Lone » Thu Jan 31, 2019 10:11 pm

Nearly.

Most of the times, DGI or VDI = 20 bytes corresponding to the MDFB structure + datas of the image, in separated planes = standard format.
Sometimes, I put also the color palette in this file (bytesize = number of colors * 6 INT)

To convert to the screen format = device-dependent format, then I use :
- for duochrome/monochrome screenmode : no convertion, standard = device-dependant.
- for palette screenmodes (ie 4, 16, 256 colors) : vr_tnsfm() which transform on standard Atari => interleaved planes, on FireBee => pixel packed = chunky mode.
- for no palette (= no CLUT, ie True Colors, TC15/16, TC24, TC32), I have a built-in convertor. An array of colors is built from the palette and screen pixel informations.

-> read the source of 2VDI.PRG save function and the source of load image function in Rosemary.


Social Media

     

Return to “GFA BASIC”

Who is online

Users browsing this forum: No registered users and 2 guests