1 ;/* simpleimage.c - program to show the use of a simple Intuition Image.
2 lc -b1 -cfist -v -y -j73 simpleimage.c
3 blink FROM LIB:c.o+"simpleimage.o" TO "simpleimage" LIB LIB:lc.lib LIB:amiga.lib
8 Copyright (c) 1992 Commodore-Amiga, Inc.
10 This example is provided in electronic form by Commodore-Amiga, Inc. for
11 use with the "Amiga ROM Kernel Reference Manual: Libraries", 3rd Edition,
12 published by Addison-Wesley (ISBN 0-201-56774-1).
14 The "Amiga ROM Kernel Reference Manual: Libraries" contains additional
15 information on the correct usage of the techniques and operating system
16 functions presented in these examples. The source and executable code
17 of these examples may only be distributed in free electronic form, via
18 bulletin board or as part of a fully non-commercial and freely
19 redistributable diskette. Both the source and executable code (including
20 comments) must be included, without modification, in any copy. This
21 example may not be published in printed form or distributed with any
22 commercial product. However, the programming techniques and support
23 routines set forth in these examples may be used in the development
24 of original executable software products for Commodore Amiga computers.
26 All other rights reserved.
28 This example is provided "as-is" and is subject to change; no
29 warranties are made. All use is at your own risk. No liability or
30 responsibility is assumed.
33 #define INTUI_V36_NAMES_ONLY
35 #include <exec/types.h>
36 #include <intuition/intuition.h>
37 #include <intuition/intuitionbase.h>
39 #include <proto/exec.h>
40 #include <proto/dos.h>
41 #include <proto/intuition.h>
45 static const char version
[] = "$VER: simpleimage 41.1 (14.3.1997)\n";
52 #include <proto/alib.h>
56 int CXBRK(void) { return(0); } /* Disable Lattice CTRL/C handling */
57 int chkabort(void) { return(0); } /* really */
60 struct IntuitionBase
*IntuitionBase
= NULL
;
62 #define MYIMAGE_LEFT (0)
63 #define MYIMAGE_TOP (0)
64 #define MYIMAGE_WIDTH (24)
65 #define MYIMAGE_HEIGHT (10)
66 #define MYIMAGE_DEPTH (1)
68 /* This is the image data. It is a one bit-plane open rectangle which is 24
69 ** pixels wide and 10 high. Make sure that it is in CHIP memory, or allocate
70 ** a block of chip memory with a call like this: AllocMem(data_size,MEMF_CHIP),
71 ** and then copy the data to that block. See the Exec chapter on Memory
72 ** Allocation for more information on AllocMem().
74 UWORD __chip myImageData
[] =
89 ** main routine. Open required library and window and draw the images.
90 ** This routine opens a very simple window with no IDCMP. See the
91 ** chapters on "Windows" and "Input and Output Methods" for more info.
92 ** Free all resources when done.
94 int main(int argc
, char *argv
[])
99 IntuitionBase
= (struct IntuitionBase
*)OpenLibrary("intuition.library",37);
100 if (IntuitionBase
!= NULL
)
103 if (NULL
!= (win
= OpenWindowTags(NULL
,
107 WA_IDCMP
, IDCMP_RAWKEY
,
110 if (NULL
!= (win
= OpenWindowTags(NULL
,
117 myImage
.LeftEdge
= MYIMAGE_LEFT
;
118 myImage
.TopEdge
= MYIMAGE_TOP
;
119 myImage
.Width
= MYIMAGE_WIDTH
;
120 myImage
.Height
= MYIMAGE_HEIGHT
;
121 myImage
.Depth
= MYIMAGE_DEPTH
;
122 myImage
.ImageData
= myImageData
;
123 myImage
.PlanePick
= 0x1; /* use first bit-plane */
124 myImage
.PlaneOnOff
= 0x0; /* clear all unused planes */
125 myImage
.NextImage
= NULL
;
127 /* Draw the 1 bit-plane image into the first bit-plane (color 1) */
128 DrawImage(win
->RPort
,&myImage
,10,10);
130 /* Draw the same image at a new location */
131 DrawImage(win
->RPort
,&myImage
,100,10);
134 /* Wait for a keypress */
135 Wait (1L << win
->UserPort
->mp_SigBit
);
137 /* Wait a bit, then quit.
138 ** In a real application, this would be an event loop, like the
139 ** one described in the Intuition Input and Output Methods chapter.
146 CloseLibrary((struct Library
*)IntuitionBase
);