home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 7 / FreshFishVol7.bin / new / gfx / show / bview / picsrc / picture.c < prev    next >
C/C++ Source or Header  |  1994-01-30  |  3KB  |  102 lines

  1. /*
  2.  *  Changed by Joeri Alberty to work with output of Bview 1.05 or higher
  3.  *  as example.
  4.  *  Created: 03/09/93 Update: 30/01/94 Compiler: SASC 6.50                  
  5.  */
  6.  
  7. // Shows how to include C Source from IFF ILBM's in your own source. 
  8. // The color table used in Brush.h is 4 bits/gun. These are TRIPLETS.       
  9.  
  10. // For ECS Amiga's 4 bits/gun use LoadRGB4() for colortable
  11. // Use function LoadRGB4() (see code below)
  12. // 'Save picture...'    (BUTTON gadget)
  13. // Format: 'SASC source'(CYCLE gadget).
  14. // Colors: 'LoadRGB4()' (CYCLE gadget).
  15.  
  16. // For AGA 32 bits/gun use LoadRGB32() or SetRGB32() for colortable.
  17. // 'Save picture...' 
  18. // Format: 'SASC source'.
  19. // Colors: 'LoadRGB32()' or 'SetRGB32()'.
  20. // Bview will make than a table for this function.
  21.  
  22. /*
  23. This example is provided in electronic form by Commodore-Amiga, Inc. for
  24. use with the "Amiga ROM Kernel Reference Manual: Libraries", 3rd Edition,
  25. published by Addison-Wesley (ISBN 0-201-56774-1).
  26. */
  27.  
  28. #define INTUI_V36_NAMES_ONLY
  29.  
  30. #include <exec/types.h>
  31. #include <intuition/intuition.h>
  32. #include <graphics/displayinfo.h>
  33. #include <graphics/gfxbase.h>
  34. #include <stdio.h>
  35.  
  36. #include <clib/exec_protos.h>
  37. #include <clib/alib_protos.h>
  38. #include <clib/dos_protos.h>
  39. #include <clib/intuition_protos.h>
  40. #include <clib/graphics_protos.h>
  41.  
  42. #include <pragmas/graphics_pragmas.h>
  43. #include <pragmas/intuition_pragmas.h>
  44.  
  45. /* My .h file made by Bview */
  46.  
  47. #include "Brush.h"
  48.  
  49. #ifdef LATTICE
  50. int CXBRK(void)    { return(0); }  /* Disable Lattice CTRL/C handling */
  51. int chkabort(void) { return(0); }  /* really */
  52. #endif
  53.  
  54. struct IntuitionBase *IntuitionBase = NULL;
  55. struct GfxBase       *GfxBase = NULL;
  56.  
  57. //UWORD pens[] = { ~0 };
  58.  
  59. VOID main(int argc, char *argv[])
  60. {
  61. struct Screen *scr;
  62. struct Window *win;
  63.  
  64. // Note: OpenLibrary not needed any more in SASC6.5 (done here for compatib.)
  65. // Use ...
  66. // extern struct IntuitionBase *IntuitionBase; 
  67. // extern struct GfxBase       *GfxBase;
  68. // and no OpenLibrary() or CloseLibrary()
  69.  
  70. if(IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library",37))
  71.   {  
  72.   if(GfxBase = (struct GfxBase *)OpenLibrary("graphics.library",37))
  73.     {
  74.     if (NULL != (scr = OpenScreenTags(NULL,
  75.                         SA_DisplayID,   ModeID,
  76.                         SA_Depth,       2,
  77.                         TAG_END)))
  78.         {
  79.  
  80.         // This depends on what colortable Bview generated (See above)
  81.         LoadRGB4(&scr->ViewPort,colortable,COLORS);
  82.  
  83.         if (NULL != (win = OpenWindowTags(NULL,
  84.                             WA_RMBTrap,      TRUE,
  85.                             WA_CustomScreen, scr,
  86.                             TAG_END)))
  87.             {
  88.             // See .h file for stucture Im_xxx
  89.             DrawImage(win->RPort,&Im_Brush,20,20);
  90.  
  91.             Delay(500);
  92.  
  93.             CloseWindow(win);
  94.             }
  95.         CloseScreen(scr);
  96.         }
  97.     CloseLibrary((struct Library *)GfxBase);
  98.     }
  99.   CloseLibrary((struct Library *)IntuitionBase);
  100.   }
  101. }
  102.