GfxConverter V1.0 Documentation GfxConverter: completed January 1 1992 for Amiga Computing. Written by Desmond King Belfast N. Ireland. GfxConverter is Copyright 1992 Amiga Computing. A problem most newcommers to programming in assembly language encounter is how to get the graphics they've created in Dpaint into their own code. There are a number of utilties in the PD that allow Brushes to be convertered to raw binary or source files but none of them seem to fit my needs so I set about writting GfxConverter to do just this. So What can GfxConverter do? The main features are outlined below. Convert IFF screens and brushes to raw binary. Convert raw screens to IFF format. Handles all colour modes including HAM and EHB. Handles Hi-Res and Large bitmaps upto 1024x1024. Upto 20 sprite(3 or 15 colour) frames saved in one go. Bobs saved as source or binary with optional mask. Colourmap can be saved as Copper list. Multitasks. That's some of what GfxConverter can do so now an explanation on how to use the program. Since GfxConverter is aimed at assembly language programmers some knowledge of the Amiga hardware and display modes etc. is assumed. HOW TO RUN GFXCONVERTER The program may be run from The CLI in the usual way by typing RUN GfxConverter or just GfxConverter. You can also run it from the Workbench by Double Clicking on it's Icon. No extra files are required to run GfxConverter. In this document I make reference to Dpaint as this is the most used(and best) graphics program, however any programs that save screens in IFF form should be compatable. THE MENUS SCREEN ====== This menu is split into two sections - IFF and Binary. Load IFF - Loads an IFF screen. The display mode will be changed to match that of the file being loaded. All display modes are handled except overscan, although overscan screens will be loaded and can be scrolled. If there is not enough memory, the display will change to a 2 colour lo-res display and you'll be warned of the lack of memory. The file may also be a Dpaint brush. DPaint screens saved with Stencil won't load properly. Save IFF - Save the display as an IFF screen. The File can then be loaded into Dpaint etc. Note that the file is not compacted. Frame - An area of the display may be framed, similar to picking up a brush in dpaint. Only the area in the box will be saved. This is treated as a small screen. If loaded into Dpaint as a brush, there is no transparant colour specified. Load Binary - This lets you load raw bitmaps into the display. A requester will appear asking for the dimensions of the bitmap. Width/Height is the size of the bitmap in pixels, upto 1024. Depth is the number of planes. This needn't be the same as then current display, but if it is less the planes will be loaded starting at plane 1. If it is more then not all planes will be loaded. When the requester opens, the Width gadget will be active, pressing return activates the Height gadget and then the depth gadget so no need to use the Mouse. The program expects each plane to have been saved seperately, as Plane1 then Plane2... and so on. They are not interleaved. This seems to be the most common method used. If the bitmap size dosn't match the screen, then garbage will be displayed. If the screen seems to load slightly offset or with odd colours then try changing the colourmap settings. The existing display remains unchanged and the bitmap will appear at the top left of the display, so you could say, load a lo-res picture into a hi-res display. Use the Set Mode option described later to set the mode of the screen you want to load. Save Binary - This saves the screen as a raw binary file. The planes are saved Plane1..Plane2.. etc. Frame Binary - This saves only the area you have framed. Again this is like a small screen. ColourMap->Before, After, None - This determines if a colourmap is saved or read with binary files. Before will save or read a colourmap before the bitplanes. After will save or read a colourmap after the bitplanes. The pallete is saved as one word per colour, for the RGB values, as for the Hardware registers. The number of colours saved or read depends on the Depth of the display when saving, or the value entered in the Depth gadget when loading. If you are loading a file with more planes than the display has then still set depth to that of the file so that the correct number of colours are read. Set Mode - Allows you to set the display mode for loading binary files. You LOOSE the current screen. A requester appears with gadgets for the display mode. Click on one and the Colour gadget will change to the maximum colours for that mode. Click on the Colour gadget to select the number of colours you want. If you want a larger bitmap than the screen then enter the size in the Width and Height gadgets after you have selected the mode. These can be upto 1024 pixels. The gadgets in the requester reflect the current display mode and bitmap size so this can be used to see what mode a loaded IFF file is. SCROLLING When a screen is loaded you may notice the bottom 11 lines are missing, this is because of the title bar at the top of the screen. To see the rest of the screen use the arrow keys to scroll the display. You can also scroll screens that are larger than the display. Horizantally the screen scrolls 16 pixels or 1 word. Vertically the screen scrolls 8 pixels. FRAMING When Framing an area of the screen the pointer becomes a cross hair. The title bar displays the current X and Y position in pixels and Words is the X word position in the bitmap. Place the cross hair at the Top Left of the box and press and hold the left mouse, drag the box then release where you want. When dragging the box, the X and Y become the size of the box and Words is the X size in words, useful to calculate BLTSIZE. Anything in and under the box will be grabbed. When Dragging the box you may press the Space Bar to return to the cross hair. Pressing Space again cancels the Grab. You may also scroll the screen and toggle the title bar when Framing. ColourMap ========= This lets you save the screens colour map as a source file that can be assembled in say Devpac. RGB Only - Saves the RGB values as DC.W lines, for example- DC.W $0FFF,$0F00,$000F,$0020 The first is colour 0 then colour 1 etc. upto 31 CopperList->Labels, Registers - Saves the colourmap as a Copper List with the colour register follwed by the RGB value. DC.W $0180,$0FFF DC.W $0182,$0F00 DC.W $0184,$000F DC.W $0186,$0020 Labels substitutes the hardware register with a label like... DC.W COLOR00,$0FFF DC.W COLOR01,$0F00 DC.W COLOR02,$000F DC.W COLOR03,$0020 SPRITE ====== Sprites are again saved as Source. You pick up a sprite by framing part of the screen as described above. This time the box is divided horizantly every 16 pixels to show each sprite. If your sprites have been drawn beside each other then you can pick up all sprites in one go, this saves a lot of work and is a good way of saving animation frames for a sprite or making a sprite wider than 16 pixels by joining them. All sprites are 16 pixels wide and any height. On a 320 pixel wide screen you could save 20 sprites, more on wider bitmaps by scrolling. The first line of the source is the file name with a frame number, then the sprite data list for the first sprite then the next and so on like... filename0 DC.W $0000,$0000 controll words DC.W $FFFF,$0DFE plane 1 of sprite then plane 2 DC.W $0010,$1ABA DC.W $0000,$0000 controll words filename1 DC.W $0000,$0000 next sprite DC.W $AFDF,$0DFE DC.W $00F0,$1CCA DC.W $0000,$0000 It is upto you to set the sprite pointers in your program to point to the apropriate sprite. 4 Colour - This is the setting when the screen depth is 2 planes. 16 Colour - This is enabled when the screen depth >=4 planes. Planes 1-4 are used for the data. selecting this Selecting this option toggles between 4 and 16 colour settings. 16 Colour sprites are saved as above but as sprites have to be attached to create a 16 colour sprite, the second sprite in the listing is the attached sprite and has an .AT extension to the label to show it is part of the same sprite... Sprite0 DC.W $0000,$0000 DC.W $FFFF,$0DFE DC.W $0010,$1ABA DC.W $0000,$0000 Sprite0.AT this should be attached DC.W $0000,$0000 to the above Sprite0 DC.W $AFDF,$0DFE to make 16 colour DC.W $00F0,$1CCA DC.W $0000,$0000 The Sprite menu is dissabled when not in Lo-Res mode. Bob === Save ->Source - The first Line of Source will again be the file name. The data is next starting with plane1 and the last plane is the mask if enabled. Each plane is sperated by a blank line. ->Bin The bitplane data is written as binary Mask ->On,OFF - Enables or Dissables the mask. The mask is an extra plane the same size as the Bob and is all planes ORed. The source label will have a .MASK extension. Various ======= About - Not a lot really. Sleep - Sends GfxConverter to sleep untill needed. Returns all memory to system and opens a small window on workbench. Closing the window re-activates GfxConverter(memory permitting). You loose any screen you have. GfxConverter itself remains in memory. Prefs - Lets you alter the following settings. Coords Origin - By default GfxConverter has the Origin at the Bottom left of the bitmap like DPaint, but you can have it at the top if you like. Note that the coordinates are relative to the bitmap and not the screen display. Number System - This lets you choose what system will be used for the source output. This can be Hex, Binary or Decimal. Binary files can be quite long so only use on small Sprites or Bobs. Binary files are quite good for small Intuition gadgets as the image is clearly shown Words Per Line - Determines how many numbers are output on each line of source before a new line. For sprites and copper lists this is best set at 2 Compact - Toggles Compact ON and OFF. When ON DC will be output instead of DC.W and leading zeros will not be output on Hex and Binary numbers, so $0021 would become $21. Quit - Quits GfxConverter. You must select this twice in succession to quit. KEYBOARD The Arrow keys can be used to scroll around the bitmap as described above. F10 toggles the screens title bar. The title bar must be displayed for the coords to be shown. F9 toggles memory display. The value in brackets is the largest available chip memory. THE FILEREQUESTER You may select a file by Double Clicking on the file name, selecting the OK gadget, or pressing Return in the File gadget. Clicking on a file name once will display the size of the file in bytes. The gadget which says EXCLUDE allows files with a certain pattern to be included or excluded from the directory listing. The string gadget can contain a 10 character pattern, if it is empty all files will be displayed. Directories are always displayed. This is set to EXCLUDE .info so .info files are not displayed. I have tested GfxConverter on 1.2/1.3 Amigas with 1/2 - 1 Meg but I would appreciate it if any one could tell me if it works on the likes of the A500P. GfxConverter should work on NTSC machines but I have not been able to test it so I can't guarantee it will. Send Suggestions, questions, bug reports etc. to:- D. King 68 Farnham Street, Ormeau Road, Belfast BT7 2FN. N. Ireland