summaryrefslogtreecommitdiff
path: root/Source/SaveBitMap.S
blob: 36574b42011fde1ce15286e22a0b0c9f2593a94b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
**
**	$Id: SaveBitMap.S,v 21.1 92/05/15 03:23:02 chris Exp $
**	$Revision: 21.1 $
**
**	$Filename: SaveBitMap.S $
**	$Author: chris $
**	$Release: 19.1 $
**	$Date: 92/05/15 03:23:02 $
**
**	iff.library/IFFL_SaveBitMap
**
**	COPYRIGHT (C) 1987-1992 BY CHRISTIAN A. WEBER, BRUGGERWEG 2,
**	CH-8037 ZUERICH, SWITZERLAND.  ALL RIGHTS RESERVED.  NO PART
**	OF THIS SOFTWARE MAY BE COPIED, REPRODUCED,  OR  TRANSMITTED
**	IN ANY FORM OR BY ANY MEANS,  WITHOUT THE PRIOR WRITTEN PER-
**	MISSION OF THE AUTHOR. USE AT YOUR OWN RISK.
**


		IDNT	IFFL_SaveBitMap
		SECTION	text,CODE

		INCLUDE	"IFFLib.i"

		XREF	SaveClipFunc
		XDEF	SaveBitMapFunc


******* iff.library/IFFL_SaveBitMap *****************************************
*
*    NAME
*	IFFL_SaveBitMap -- save the planes of a BitMap as an IFF-file
*
*    SYNOPSIS
*	result = IFFL_SaveBitMap( filename, bitmap, colortable, flags )
*	D0                        A0        A1      A2          D0
*
*	BOOL IFFL_SaveBitMap(char *, struct BitMap *, UWORD *, ULONG )
*
*    FUNCTION
*	Save the planes of a BitMap as an IFF-file, optionally with a
*	colortable. The IFF file will contain the following chunks:
*
*	FORM  -  The IFF header, with the type ILBM
*	BMHD  -  The BitMap Header structre
*	CMAP  -  The color map, this chunk is omitted if colortable is zero
*	CAMG  -  The Amiga ViewModes word, contains the special ViewModes
*	         information (HAM, LACE, HIRES ...)
*	BODY  -  The (crunched or uncompressed) picture
*
*   INPUTS
*	filename    - Name of the IFF file to create
*	bitmap      - Pointer to the BitMap holding your picture
*	colortable  - Pointer to an Amiga ColorTable structure or zero
*	              (if colortable = 0, no CMAP chunk will be generated).
*	flags       - Bit 0: 1 = Use the "CmpByteRun1" compression algorythm,
*	                     0 = Save the file uncompressed
*                      Bit 7: 1 = This is a HAM (Hold and modify) picture
*	                     0 = This is a normal or Extra-Halfbrite picture
*
*   RESULT
*	Non-zero if successful, 0 if an error occurred. You can then call
*	IFFL_IFFError() to know more about the reason of the failure.
*
*   NOTE
*	Up to V19 this routine needs at least 650 bytes of stack space
*
*   SEE ALSO
*	IFFL_SaveClip()
*
*****************************************************************************

SaveBitMapFunc:	movem.l	d2-d4,-(SP)
		moveq	#0,d1			; X-Offset :  0
		moveq	#0,d2			; Y-Offset :  0
		move.w	bm_BytesPerRow(a1),d3	; Breite   :  maximal
		move.w	bm_Rows(a1),d4		; Höhe     :  maximal
		bsr	SaveClipFunc		; als Ausschnitt speichern
		movem.l	(SP)+,d2-d4
		rts

		END