home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 8
/
FreshFishVol8-CD1.bin
/
new
/
gfx
/
edit
/
tsmorph
/
src
/
rendersub.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-02-23
|
25KB
|
972 lines
// TSMorph - Amiga Morphing program
// Copyright (C) © 1993 Topicsave Limited
// 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
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
// mpaddock@cix.compulink.co.uk
/* Amiga headers */
#define INTUI_V36_NAMES_ONLY
#define INTUITION_IOBSOLETE_H
// Include correct math library
#ifdef MY68881
#include <m68881.h>
extern int rand(void);
#else
#ifdef MY68881_6
#include <math.h>
#include <m68881.h>
#define floor(d) __builtin_fpc(0x0003,d)
#else
#include <math.h>
#endif
#endif
// prevent inclusion of another math library
#define LIBRARIES_MATHFFP_H
// other headers, define some non 2.02 header stuff
#include <exec/types.h>
#include <exec/memory.h>
#include <intuition/intuition.h>
#include <intuition/intuitionbase.h>
#include <intuition/gadgetclass.h>
#ifndef PGA_NewLook
#define PGA_NewLook (PGA_Dummy + 0x000A)
#endif
#include <intuition/imageclass.h>
#include <intuition/icclass.h>
#include <devices/input.h>
#include <workbench/workbench.h>
#include <workbench/startup.h>
#include <libraries/gadtools.h>
#ifndef GTMN_FullMenu
#define GTMN_FullMenu GT_TagBase+62
#endif
#include <libraries/asl.h>
#include <clib/exec_protos.h>
#include <clib/dos_protos.h>
#include <clib/layers_protos.h>
#include <clib/graphics_protos.h>
#include <clib/intuition_protos.h>
#include <clib/input_protos.h>
#include <clib/gadtools_protos.h>
#include <clib/asl_protos.h>
#include <clib/utility_protos.h>
#include <clib/alib_protos.h>
#include <pragmas/exec_pragmas.h>
#include <pragmas/dos_pragmas.h>
#include <pragmas/layers_pragmas.h>
#include <pragmas/graphics_pragmas.h>
#include <pragmas/intuition_pragmas.h>
#include <pragmas/input_pragmas.h>
#include <pragmas/gadtools_pragmas.h>
#include <pragmas/asl_pragmas.h>
#include <pragmas/utility_pragmas.h>
#include <proto/diskfont.h>
#include <proto/icon.h>
#include <devices/timer.h>
#include <clib/timer_protos.h>
#include <pragmas/timer_pragmas.h>
#include <clib/alib_protos.h>
#include <rexx/errors.h>
#include <pragmas/rexxsyslib_pragmas.h>
#include <clib/rexxsyslib_protos.h>
#include <libraries/amigaguide.h>
#include <clib/amigaguide_protos.h>
#include <pragmas/amigaguide_pragmas.h>
#include <libraries/reqtools.h>
#include <clib/reqtools_protos.h>
#include <pragmas/reqtools.h>
#include <opal/opallib.h>
#include <libraries/dctv.h>
#include <clib/dctv_protos.h>
#include <pragmas/dctv_pragmas.h>
#include <libraries/nofrag.h>
#include <clib/nofrag_protos.h>
#ifdef LIBRARIES_NOFRAG_H
#undef LIBRARIES_NOFRAG_H
#endif
#include <pragmas/nofrag_pragmas.h>
#ifndef LIBRARIES_NOFRAG_H
#define LIBRARIES_NOFRAG_H 1
#endif
#include <stddef.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
/* Below is not in the 2.02 version of clib/utility_protos.h
pragmas/utility_pragmas.h */
#if INCLUDE_VERSION < 37
LONG Stricmp(UBYTE *string1,UBYTE *string2);
#pragma libcall UtilityBase Stricmp A2 9802
#endif
// IFF header
#include "iffp/ILBMapp.h"
// Progress requester
#include "progress.h"
// JPEG load stuff
#include "JPEG_LS/jinclude.h"
/* Wait pointer */
static USHORT __chip BusyPointerData[] =
{
0x0000,0x0000,
0x0400,0x07C0,0x0000,0x07C0,0x0100,0x0380,0x0000,0x07E0,
0x07C0,0x1FF8,0x1FF0,0x3FEC,0x3FF8,0x7FDE,0x3FF8,0x7FBE,
0x7FFC,0xFF7F,0x7EFC,0xFFFF,0x7FFC,0xFFFF,0x3FF8,0x7FFE,
0x3FF8,0x7FFE,0x1FF0,0x3FFC,0x07C0,0x1FF8,0x0000,0x07E0,
0x0000,0x0000,
};
// Libraries
extern struct ExecBase *SysBase;
extern struct DosLibrary *DOSBase;
extern struct IntuitionBase *IntuitionBase;
extern struct Library *GfxBase, *LayersBase, *IFFParseBase;
extern struct Library *GadToolsBase, *AslBase, *UtilityBase;
extern struct Library *RexxSysBase;
extern struct Library *AmigaGuideBase;
extern struct Library *TimerBase;
extern struct Library *ReqToolsBase;
extern struct Library *DCTVBase;
extern struct NoFragBase *NoFragBase;
extern struct OpalBase *OpalBase;
// Help stuff
extern AMIGAGUIDECONTEXT handle;
extern struct NewAmigaGuide nag;
extern ULONG ASig;
// nofrag.library stuff
extern struct MemoryChain *Chain;
#define MAXMEM 1000
#define H_Help 10
#define H_Library 11
#define H_ESave 12
#define H_AllocVec 13
#define H_OpenPoints 14
#define H_Progress 15
#define H_AllocPlanes 16
#define H_24 17
#define H_Load 18
#define H_AllocIFF 19
#define H_AllocILBM 20
#define H_FileFormat 21
#define H_SizeMatch 22
#define H_Range 23
#define H_MemPointsR 24
#define H_CloseFile 25
#define H_3Points 26
#define H_Open 27
#define H_ARexx 28
#define H_Really 29
#define HE_OldFormat 30
#define HE_OpalVision 31
#define HE_NoOpal 32
// 24 bitplane bitmap
struct MyBitMap {
struct BitMap BitMap;
PLANEPTR xplanes[16];
};
extern char FileName[256]; // File name buffer
extern long OVQuality; // OpalVision JPG quality
extern BOOL OVFast; // OpalVision fast format IFF
extern BOOL OVThumb; // OpalVision Thumbail
extern BOOL HAM6;
extern BOOL HAM8;
extern BOOL BW16;
extern BOOL BW256;
extern BOOL DCTV3;
extern BOOL DCTV4;
extern UBYTE *arrayr, // Pointers to red,green and blue
*arrayg,
*arrayb;
extern BOOL PPM; // PPM save ?
extern UBYTE *p[3];// chunky pointers - order for OpalVision
#define RED p[0]
#define BLUE p[2]
#define GREEN p[1]
extern UWORD swidth; // scaled width (in full words)
extern struct RastPort RP, // Work Rast Ports
TRP;
extern struct MyBitMap MyBitMap; // Real bit map
extern PLANEPTR Planes[24]; // Bit planes
extern BOOL CreateIcons;// Create Icons on pictures?
extern struct OpalScreen *OScrn;
extern char *OVFormat; // Format of OpalVision save JPG or IFF (or anything) default
extern USHORT width, height, pwidth, pheight, pmode;
extern UBYTE *plane0; // Planes for temporary bit maps
extern UBYTE *plane1;
extern UBYTE *plane2;
extern UBYTE *plane3;
extern UBYTE *plane4;
extern UBYTE *plane5;
extern UBYTE *plane6;
extern UBYTE *plane7;
extern char AnimName[]; // Buffer for file name to save
// Table of parameters
extern struct {
LONG xf; // Current frame
LONG xFrames; // Number of frames
LONG xSingle; // Warp or Morph
LONG xmove; // Movement 1 to 2
LONG xr; // red of image 1
LONG xg; // green
LONG xb; // blue
LONG xr2; // red of image 2
LONG xg2; // green
LONG xb2; // blue
LONG xDo; // Produce this image
LONG xrplus; // Add red
LONG xgplus; // green
LONG xbplus; // blue
LONG xrminus; // subtract red
LONG xgminus; // subtract green
LONG xbminus; // subtract blue
LONG xDX; // X skip
LONG xDY; // Y skip
LONG xStart; // Start Frame number
LONG FILLER[32]; // Filler for future expansion
} Arexx;
#define f Arexx.xf
#define Frames Arexx.xFrames
#define Single Arexx.xSingle
#define move Arexx.xmove
#define r Arexx.xr
#define g Arexx.xg
#define b Arexx.xb
#define r2 Arexx.xr2
#define g2 Arexx.xg2
#define b2 Arexx.xb2
#define Do Arexx.xDo
#define rplus Arexx.xrplus
#define gplus Arexx.xgplus
#define bplus Arexx.xbplus
#define rminus Arexx.xrminus
#define gminus Arexx.xgminus
#define bminus Arexx.xbminus
#define DX Arexx.xDX
#define DY Arexx.xDY
#define Start Arexx.xStart
extern char buffer[256];
extern char buffer1[512];
extern char *Postscript;// ARexx postscript
extern WORD x,y; // Current coords
void help(ULONG hnum);
void DisableWindow(void);
void EnableWindow(void);
void AddMessage(UBYTE *message);
// SaveHAMetc.c
BOOL SaveBW16(UBYTE *FileName,USHORT width,USHORT height, UWORD swidth,
USHORT pwidth, USHORT pheight, USHORT pmode,
UBYTE *red, UBYTE *green, UBYTE *blue, struct RastPo