home *** CD-ROM | disk | FTP | other *** search
- /* cybergraphics saver - (C) Vision Factor Development 1994 31/12/94
-
- Saver for Photogenics
- Photogenics © Almathera 1994, All Rights Reserved
-
- REQUIRES: SAS C V6.50 or higher.
-
- */
-
- #include <exec/types.h>
- #include <clib/exec_protos.h>
- #include <dos/dos.h>
- #include <pragmas/exec_pragmas.h>
- #include <cybergraphics/cybergraphics.h>
- #include <intuition/intuition.h>
- #include <pragmas/intuition_pragmas.h>
- #include <pragmas/cybergraphics_pragmas.h>
- #include <proto/exec.h>
- #include <proto/intuition.h>
- #include <proto/graphics.h>
- #include <proto/cybergraphics.h>
- #include "pgs_protos.h"
- #include "pgs_pragmas.h"
- #include "gio.h"
-
- struct TagItem CModeTags[]=
- {
- CYBRMREQ_Screen,0,
- CYBRMREQ_MinDepth,15,
- CYBRMREQ_MaxDepth,32,
- CYBRMREQ_WinTitle,(ULONG)"Select CyBERgraphics ScreenMode",
- CYBRMREQ_OKText,(ULONG)"OK",
- CYBRMREQ_CancelText,(ULONG)"Cancel",
- TAG_DONE
- };
-
-
- struct Library *CyberGfxBase;
-
- /* prototypes */
- __asm ULONG __saveds GioInfo(void);
- __asm ULONG __saveds GioExamine(register __a0 struct GIOData *giodata);
- __asm ULONG __saveds GioRead(register __a0 struct GIOData *giodata);
- __asm ULONG __saveds GioWrite(register __a0 struct GIOData *giodata);
- /* end of prototypes */
-
-
- __asm ULONG __saveds GioInfo(void)
- {
- return(GIOF_SAVER24);
- }
-
- __asm ULONG __saveds GioExamine(register __a0 struct GIOData *giodata)
- {
- return(0L);
- }
-
- #define DOSBase giodata->DOSBase
- #define PgsBase giodata->PgsBase
- #define IntuitionBase giodata->IntuitionBase
-
- __asm ULONG __saveds GioRead(register __a0 struct GIOData *giodata)
- {
- return(0L);
- }
-
- __asm ULONG __saveds GioWrite(register __a0 struct GIOData *giodata)
- {
- if (giodata->Depth == 24)
- {
- int ScrWidth,ScrHeight,OffX=0,OffY=0,DispWidth,DispHeight;
-
- if(CyberGfxBase=OpenLibrary("cybergraphics.library",40))
- {
- struct Screen *Scr;
- int Width,Height;
- ULONG ModeID;
-
- CModeTags[0].ti_Data=(ULONG)giodata->PgsScreen;
- ModeID=CModeRequestTagList(0L,CModeTags);
-
- Width = giodata->Width; Height = giodata->Height;
-
- if(Scr=(struct Screen *)OpenScreenTags(0L,SA_DisplayID,ModeID,
- SA_AutoScroll,1,
- SA_Overscan,1,
- SA_Depth,8,
- TAG_DONE))
- {
- struct Window *Wnd;
- ScrWidth=Scr->Width; ScrHeight=Scr->Height;
- if(Wnd=(struct Window *)OpenWindowTags(0L,WA_Activate,1,
- WA_CustomScreen,Scr,
- WA_Width,Scr->Width,
- WA_Height,Scr->Height,
- WA_Borderless,1,
- WA_Backdrop,1,
- WA_IDCMP,IDCMP_RAWKEY|IDCMP_MOUSEBUTTONS,
- TAG_DONE))
- {
- struct IntuiMessage *imsg;
- BOOL end=FALSE,UpdateDis=TRUE;
-
-
- DispWidth=ScrWidth; if(Width < ScrWidth) DispWidth = Width;
- DispHeight=ScrHeight; if(Height < ScrHeight) DispHeight = Height;
-
- while(!end)
- {
- if(UpdateDis)
- {
- int y;
- UBYTE *peeker;
- for(y=0;y<DispHeight;y++)
- {
- peeker=GetLine(giodata,y+OffY);
- WritePixelArray(peeker,OffX,0,DispWidth*4,&Scr->RastPort,0,y,DispWidth,1,RECTFMT_RGB);
- ReleaseLine(giodata,y+OffY);
- };
- UpdateDis=FALSE;
- }
-
- WaitPort(Wnd->UserPort);
-
- while(imsg=(struct IntuiMessage *)GetMsg(Wnd->UserPort))
- {
- ULONG IClass=imsg->Class;
- UWORD IQual=imsg->Qualifier;
- UWORD ICode=imsg->Code;
- UWORD StepX,StepY;
-
- switch(IClass)
- {
- case MOUSEBUTTONS:
- end=TRUE;
- break;
- case RAWKEY:
- if(IQual & (IEQUALIFIER_LSHIFT|IEQUALIFIER_RSHIFT))
- { StepX=StepY=1; }
- else
- { StepX=DispWidth; StepY=DispHeight; }
-
- switch(ICode)
- {
- case CURSORUP: // CSUP
- if(OffY!=0)
- { OffY-=StepY; if(OffY < 0) OffY=0; UpdateDis=TRUE; }
- break;
- case CURSORDOWN: // CSDN
- if(Height > DispHeight)
- {
- OffY+=StepY;
- if(OffY > Height-DispHeight)
- { OffY=Height-DispHeight; if(OffY < 0) OffY=0; }
- UpdateDis=TRUE;
- };
- break;
- case CURSORRIGHT: // CSRT
- if(Width > DispWidth)
- {
- OffX+=StepX;
- if(OffX > Width-DispWidth)
- { OffX=Width-DispWidth; if(OffX < 0) OffX=0; };
- UpdateDis=TRUE;
- };
- break;
- case CURSORLEFT: // CSLT
- if(OffX!=0)
- { OffX-=StepX; if(OffX < 0) OffX=0; UpdateDis=TRUE; };
- break;
- }
- break;
- } // end of switch
- } // end of while
- } // end of while(!end)
- CloseWindow(Wnd);
- } // end of OpenWindow
- else giodata->Error = LOAD_RAMERR;
- CloseScreen(Scr);
- } // end of OpenScreen
- else giodata->Error = LOAD_RAMERR;
- CloseLibrary(CyberGfxBase);
- }
- else giodata->Error = LOAD_SYSERR;
- }
- else
- {
- giodata->Error = LOAD_WRONGTYPE;
- }
- return(0L);
- }
-
-
-