home *** CD-ROM | disk | FTP | other *** search
- /* Simple test effect - Inverts an image.
-
- Copyright © 1995-1996 Almathera Systems Ltd. All Rights Reserved
-
- */
-
- #include <exec/types.h>
- #include <exec/memory.h>
- #include <clib/exec_protos.h>
- #include <clib/dos_protos.h>
- #include <dos/dos.h>
- #include <clib/alib_protos.h>
- #include <pragmas/exec_pragmas.h>
- #include <pragmas/dos_pragmas.h>
-
- #include <photogenics/pgs_protos.h>
- #include <photogenics/pgsrexx_protos.h>
- #include <photogenics/parse.h>
-
- #include <pragmas/pgsrexx_pragmas.h>
- #include <pragmas/pgs_pragmas.h>
-
- #include <photogenics/gio.h>
- #include <photogenics/efx.h>
-
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
-
- #define DOSBase giodata->DOSBase
- #define PgsBase giodata->PgsBase
-
- __asm ULONG EfxInfo(void)
- {
- return(EFX_24BIT|EFX_NOOPTIONS|EFX_8GREY);
- }
-
- __asm ULONG EfxPreRender(register __a0 struct GIOData *giodata)
- {
- return(0);
- }
-
- __asm ULONG EfxRender(register __a0 struct GIOData *giodata)
- {
- UBYTE r,g,b;
- int x,y;
-
- SetProgress("Inverting image...",0);
-
- switch(giodata->Depth)
- {
- case 24:
- for(y=giodata->WindY;y<giodata->WindY+giodata->WindHeight;y++)
- {
- if(!(y%64))
- {
- if(SetProgress(0,(y-giodata->WindY)*100/giodata->WindHeight)!=1)
- {
- giodata->Error = GIO_ABORTED;
- goto err;
- }
- }
- for(x=giodata->WindX;x<giodata->WindX+giodata->WindWidth;x++)
- {
- GetSrcPixel(giodata,x,y,&r,&g,&b);
- PutDestPixel(giodata,x,y,255-r,255-g,255-b);
- }
- }
- break;
-
- case 8:
- for(y=giodata->WindY;y<giodata->WindY+giodata->WindHeight;y++)
- {
- if(!(y%64))
- {
- if(SetProgress(0,(y-giodata->WindY)*100/giodata->WindHeight)!=1)
- {
- giodata->Error = GIO_ABORTED;
- goto err;
- }
- }
- for(x=giodata->WindX;x<giodata->WindX+giodata->WindWidth;x++)
- {
- r=GetSrcPixel8(giodata,x,y);
- PutDestPixel8(giodata,x,y,255-r);
- }
- }
- break;
- }
- giodata->Error = GIO_OK;
- err:
- return(giodata->Error);
- }
-
- __asm ULONG EfxPrefs(register __a0 struct GIOData *giodata)
- {
- return(0);
- }
-
-