diff --git a/.gitattributes b/.gitattributes index 6d81b45f44..b48c8cd0e7 100644 --- a/.gitattributes +++ b/.gitattributes @@ -5803,7 +5803,9 @@ packages/morphunits/src/ahi.pas svneol=native#text/plain packages/morphunits/src/amigados.pas svneol=native#text/plain packages/morphunits/src/amigalib.pas svneol=native#text/plain packages/morphunits/src/asl.pas svneol=native#text/plain +packages/morphunits/src/cgxvideo.pas svneol=native#text/plain packages/morphunits/src/clipboard.pas svneol=native#text/plain +packages/morphunits/src/cybergraphics.pas svneol=native#text/plain packages/morphunits/src/datatypes.pas svneol=native#text/plain packages/morphunits/src/diskfont.pas svneol=native#text/plain packages/morphunits/src/exec.pas svneol=native#text/plain diff --git a/packages/morphunits/Makefile.fpc.fpcmake b/packages/morphunits/Makefile.fpc.fpcmake index d0ddb5e39f..ba80c11e86 100644 --- a/packages/morphunits/Makefile.fpc.fpcmake +++ b/packages/morphunits/Makefile.fpc.fpcmake @@ -9,7 +9,7 @@ version=3.1.1 [target] units= aboxlib agraphics ahi amigados asl clipboard datatypes exec get9 \ hardware inputevent intuition keymap kvm layers mui muihelper timer \ - tinygl utility iffparse diskfont + tinygl utility iffparse diskfont cybergraphics cgxvideo [compiler] includedir=src diff --git a/packages/morphunits/fpmake.pp b/packages/morphunits/fpmake.pp index e1a320eb7f..f020c3fe23 100644 --- a/packages/morphunits/fpmake.pp +++ b/packages/morphunits/fpmake.pp @@ -53,6 +53,8 @@ begin T:=P.Targets.AddUnit('get9.pas'); T:=P.Targets.AddUnit('tinygl.pas'); T:=P.Targets.AddUnit('diskfont.pas'); + T:=P.Targets.AddUnit('cybergraphics.pas'); + T:=P.Targets.AddUnit('cgxvideo.pas'); {$ifndef ALLPACKAGES} Run; diff --git a/packages/morphunits/src/cgxvideo.pas b/packages/morphunits/src/cgxvideo.pas new file mode 100644 index 0000000000..0b5cde684a --- /dev/null +++ b/packages/morphunits/src/cgxvideo.pas @@ -0,0 +1,234 @@ +{ + This file is part of the Free Pascal MorphOS support package + + Copyright (c) 2015 Karoly Balogh + member of the Free Pascal Development Team + + cgxvideo.library interface unit + + See the file COPYING.FPC, included in this distribution, + for details about the copyright. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +**********************************************************************} + +{$mode fpc} +{$packrecords 2} +unit cgxvideo; + +interface + +uses + exec, intuition, utility; + +{ + Contents of this file is based on cgxvideo.h from the MorphOS SDK: + + $VER: cgxvideo.h 43.2 (13.08.2008) + include file for cgxvideo.library + Copyright (c) 1996-1998 by phase5 digital products + Copyright (c) 1999-2008 by Vision Factory Development + All Rights reserved. +} + +const + CGXVIDEONAME = 'cgxvideo.library'; + +var + CGXVideoBase: PLibrary; + +type + TVLayerHandle = Pointer; + PVLayerHandle = ^TVLayerHandle; + +const + VOA_LeftIndent = $88000001; + VOA_RightIndent = $88000002; + VOA_TopIndent = $88000003; + VOA_BottomIndent = $88000004; + + VOA_SrcType = $88000005; + VOA_SrcWidth = $88000006; + VOA_SrcHeight = $88000007; + + VOA_Error = $88000008; + + VOA_UseColorKey = $88000009; + + VOA_UseBackfill = $8800000a; + + VOA_UseFilter = $8800000c; + + VOA_BaseAddress = $88000030; + VOA_ColorKeyPen = $88000031; + VOA_ColorKey = $88000032; + +{* v42 additions *} + VOA_Identifier = $8800000b; + + VOA_FrameBase0 = $88000033; + VOA_FrameBase1 = $88000034; + VOA_FrameType = $88000035; + + VOA_Width = $88000036; + VOA_Height = $88000037; + VOA_Modulo = $88000038; {* may be specified by CreateVLayerTagList() for v43 *} + +{* V43 additions *} + + VOA_DoubleBuffer = $8800000d; + VOA_InterLaced = $8800000e; + VOA_CaptureMode = $8800000f; + + VOA_BaseOffset = $88000039; + +{* V50 additions *} + + VOA_FrameIndex = $88000010; + VOA_MultiBuffer = $88000011; + VOA_ZoomRect = $88000012; + + VOA_BaseOffset0 = $88000040; + VOA_BaseOffset1 = $88000041; + VOA_BaseOffset2 = $88000042; + VOA_BaseOffset3 = $88000043; + VOA_BaseOffset4 = $88000044; + VOA_BaseOffset5 = $88000045; + + + VOA_Color0SP = $88000050; + VOA_Color1SP = $88000051; + VOA_Color2SP = $88000052; + VOA_Color3SP = $88000053; + VOA_Color4SP = $88000054; + VOA_Color5SP = $88000055; + VOA_Color6SP = $88000056; + VOA_Color7SP = $88000057; + VOA_Color8SP = $88000058; + VOA_Color9SP = $88000059; + VOA_Color10SP = $8800005A; + VOA_Color11SP = $8800005B; + VOA_Color12SP = $8800005C; + VOA_Color13SP = $8800005D; + VOA_Color14SP = $8800005E; + VOA_Color15SP = $8800005F; + + VOA_SubPicture = $88000060; + VOA_EnableSP = $88000061; + VOA_StreamRectSP = $88000062; + VOA_ColConSP = $88000063; + VOA_HLEnableSP = $88000065; + VOA_HLRectSP = $88000064; + VOA_HLColConSP = $88000066; + VOA_SrcWidthSP = $88000067; + VOA_SrcHeightSP = $88000068; + +const + VSQ_Dummy = (TAG_USER + $A5000); + VSQ_SupportedFeatures = (VSQ_Dummy + 1); + + VSQ_FEAT_OVERLAY = (1 shl 0); + VSQ_FEAT_DOUBLEBUFFER = (1 shl 1); + VSQ_FEAT_MULTIBUFFER = (1 shl 2); + VSQ_FEAT_COLORKEYING = (1 shl 3); + VSQ_FEAT_FILTERING = (1 shl 4); + VSQ_FEAT_CAPTUREMODE = (1 shl 5); + VSQ_FEAT_INTERLACE = (1 shl 6); + VSQ_FEAT_ZOOMRECT = (1 shl 7); + VSQ_FEAT_SUBPICTURE = (1 shl 8); + + VSQ_SupportedFormats = (VSQ_Dummy + 2); + + VSQ_FMT_YUYV = (1 shl 0); + VSQ_FMT_R5G5B5_LE = (1 shl 1); + VSQ_FMT_R5G6B5_LE = (1 shl 2); + VSQ_FMT_YUV420_PLANAR = (1 shl 3); + + VSQ_MaxWidth = (VSQ_Dummy + 3); {* will return maximum width for overlay *} + + VSQ_MaxWidthSP = (VSQ_Dummy + 4); {* will return maximum width for subpicture *} + +{* possible errors returned with VOA_Error tag *} +const + VOERR_OK = 0; {* No error *} + VOERR_INVSCRMODE = 1; {* video overlay not possible for that mode *} + VOERR_NOOVLMEMORY = 2; {* No memory for video overlay *} + VOERR_INVSRCFMT = 3; {* Source format not supported *} + VOERR_NOMEMORY = 4; {* Not enough memory *} + +{* Source data types *} +{* see cgxvideo.doc for more info *} +const + SRCFMT_YUV16 = 0; {* obsolete *} + SRCFMT_YCbCr16 = 1; + SRCFMT_RGB15 = 2; {* this format is actually byte swapped *} + SRCFMT_R5G5B5PC = 2; + SRCFMT_RGB16 = 3; {* this format is actually byte swapped *} + SRCFMT_R5G6B5PC = 3; + SRCFMT_YCbCr420 = 4; {* YUV planar *} + +function CreateVLayerHandleTagList(screen: PScreen location 'a0'; tags: PTagItem location 'a1'): PVLayerHandle; syscall CGXVideoBase 30; +function DeleteVLayerHandle(VLayerHandle: PVLayerHandle location 'a0'): LongWord; syscall CGXVideoBase 36; +function AttachVLayerTagList(VLayerHandle: PVLayerHandle location 'a0'; window: PWindow location 'a1'; tags: PTagItem location 'a2'): LongWord; syscall CGXVideoBase 42; +function DetachVLayer(VLayerHandle: PVLayerHandle location 'a0'): LongWord; syscall CGXVideoBase 48; +function GetVLayerAttr(VLayerHandle: PVLayerHandle location 'a0'; AttrID: LongWord location 'd0'): LongWord; syscall CGXVideoBase 54; +function LockVLayer(VLayerHandle: PVLayerHandle location 'a0'): LongWord; syscall CGXVideoBase 60; +function UnlockVLayer(VLayerHandle: PVLayerHandle location 'a0'): LongWord; syscall CGXVideoBase 66; +procedure SetVLayerAttrTagList(VLayerHandle: PVLayerHandle location 'a0'; tags: PTagItem location 'a1'); syscall CGXVideoBase 72; +procedure SwapVLayerBuffer(VLayerHandle: PVLayerHandle location 'a0'); syscall CGXVideoBase 96; +function WriteSPLine(VLayerHandle: PVLayerHandle location 'a0'; buffer: PByte location 'a1'; x: LongInt location 'a0'; y: LongInt location 'd1'; w: LongInt location 'd2'): LongWord; syscall CGXVideoBase 102; +function QueryVLayerAttr(screen: PScreen location 'a0'; AttrID: LongWord location 'd0'): LongWord; syscall CGXVideoBase 108; + +{ +#if !defined(USE_INLINE_STDARG) +ULONG AttachVLayerTags(struct VLayerHandle *,struct Window *,Tag, ...); +#endif + +#if !defined(USE_INLINE_STDARG) +struct VLayerHandle *CreateVLayerHandleTags(struct Screen *,Tag, ...); +#endif + +#if !defined(USE_INLINE_STDARG) +void SetVLayerAttrTags(struct VLayerHandle *,Tag, ...); +#endif +} + +function InitCGXVideoLibrary: boolean; + +implementation + +const + { Change VERSION and LIBVERSION to proper values } + + VERSION : string[2] = '0'; + LIBVERSION : longword = 0; + +var + cgxvideo_exit : Pointer; + +procedure CloseCGXVideoLibrary; +begin + ExitProc := cgxvideo_exit; + if CGXVideoBase <> nil then begin + CloseLibrary(CGXVideoBase); + CGXVideoBase := nil; + end; +end; + +function InitCGXVideoLibrary: boolean; +begin + CGXVideoBase := nil; + CGXVideoBase := OpenLibrary(CGXVIDEONAME,LIBVERSION); + if CGXVideoBase <> nil then begin + cgxvideo_exit := ExitProc; + ExitProc := @CloseCGXVideoLibrary; + InitCGXVideoLibrary := true; + end else begin + InitCGXVideoLibrary := false; + end; +end; + +end. diff --git a/packages/morphunits/src/cybergraphics.pas b/packages/morphunits/src/cybergraphics.pas new file mode 100644 index 0000000000..ba0536cf94 --- /dev/null +++ b/packages/morphunits/src/cybergraphics.pas @@ -0,0 +1,429 @@ +{ + This file is part of the Free Pascal MorphOS support package + + Copyright (c) 2015 Karoly Balogh + member of the Free Pascal Development Team + + cybergraphics.library interface unit + + See the file COPYING.FPC, included in this distribution, + for details about the copyright. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +**********************************************************************} + +{$mode fpc} +{$packrecords 2} + +UNIT CYBERGRAPHICS; + +INTERFACE + +USES + exec,agraphics,utility; + +VAR CyberGfxBase : pLibrary; + +const + CYBERGRAPHICSNAME : PChar = 'cybergraphics.library'; + +{ + Contents of this file is based on cybergraphics.h from the MorphOS SDK: + + $VER: cybergraphics.h 50.12 (13.08.2008) + include file for cybergraphics.library + Copyright (c) 1996-2008 by Vision Factory Development + All Rights reserved. +} + + const + CYBERGFXNAME = 'cybergraphics.library'; + CYBERGFX_INCLUDE_VERSION = 41; + { + Definition of CyberModeNode (Returned in AllocModeList) + } + type + PCyberModeNode = ^tCyberModeNode; + tCyberModeNode = record + Node : tNode; + ModeText : array[0..(DISPLAYNAMELEN)-1] of char; { name for this mode } + DisplayID : ULONG; { display id associated with the node } + Width : UWORD; { visible width } + Height : UWORD; { visible height } + Depth : UWORD; { display depth } + DisplayTagList : PTagItem; { taglist with extended ModeID information } + end; + + { + Parameters for GetCyberMapAttr() + } + const + { function returns BytesPerRow if its called with this parameter } + CYBRMATTR_XMOD = $80000001; + { BytesPerPixel shall be returned } + CYBRMATTR_BPPIX = $80000002; + { do not use this ! private tag } + CYBRMATTR_DISPADR = $80000003; + { the pixel format is returned } + CYBRMATTR_PIXFMT = $80000004; + { returns width in pixels } + CYBRMATTR_WIDTH = $80000005; + { returns height in lines } + CYBRMATTR_HEIGHT = $80000006; + { returns bits per pixel } + CYBRMATTR_DEPTH = $80000007; + { returns -1 if supplied bitmap is a cybergfx one } + CYBRMATTR_ISCYBERGFX = $80000008; + { returns -1 if supplied bitmap is linear accessable } + CYBRMATTR_ISLINEARMEM = $80000009; + { returns colormap associated with that bitmap (v50) } + CYBRMATTR_COLORMAP = $8000000A; + { + Parameters for GetCyberIDAttr() + } + { the pixel format is returned } + CYBRIDATTR_PIXFMT = $80000001; + { returns visible width in pixels } + CYBRIDATTR_WIDTH = $80000002; + { returns visible height in lines } + CYBRIDATTR_HEIGHT = $80000003; + { returns bits per pixel } + CYBRIDATTR_DEPTH = $80000004; + { BytesPerPixel shall be returned } + CYBRIDATTR_BPPIX = $80000005; + { + Tags for CyberModeRequest() + } + CYBRMREQ_TB = TAG_USER + $40000; + { + FilterTags + } + { Minimum depth for displayed screenmode } + CYBRMREQ_MinDepth = CYBRMREQ_TB + 0; + { Maximum depth " " " } + CYBRMREQ_MaxDepth = CYBRMREQ_TB + 1; + { Minumum width " " " } + CYBRMREQ_MinWidth = CYBRMREQ_TB + 2; + { Maximum width " " " } + CYBRMREQ_MaxWidth = CYBRMREQ_TB + 3; + { Minumum height " " " } + CYBRMREQ_MinHeight = CYBRMREQ_TB + 4; + { Minumum height " " " } + CYBRMREQ_MaxHeight = CYBRMREQ_TB + 5; + CYBRMREQ_CModelArray = CYBRMREQ_TB + 6; + CYBRMREQ_WinTitle = CYBRMREQ_TB + 20; + CYBRMREQ_OKText = CYBRMREQ_TB + 21; + CYBRMREQ_CancelText = CYBRMREQ_TB + 22; + { Screen you wish the Requester to open on } + CYBRMREQ_Screen = CYBRMREQ_TB + 30; + { + Tags for BestCyberModeID() + } + CYBRBIDTG_TB = TAG_USER + $50000; + { FilterTags } + CYBRBIDTG_Depth = CYBRBIDTG_TB + 0; + CYBRBIDTG_NominalWidth = CYBRBIDTG_TB + 1; + CYBRBIDTG_NominalHeight = CYBRBIDTG_TB + 2; + CYBRBIDTG_MonitorID = CYBRBIDTG_TB + 3; + CYBRBIDTG_BoardName = CYBRBIDTG_TB + 5; + { + definition of divers pixel formats + } + PIXFMT_LUT8 = 0; + PIXFMT_RGB15 = 1; + PIXFMT_RGB15X = 2; + PIXFMT_BGR15 = 2; + PIXFMT_RGB15PC = 3; + PIXFMT_BGR15PC = 4; + PIXFMT_RGB16 = 5; + PIXFMT_BGR16 = 6; + PIXFMT_RGB16PC = 7; + PIXFMT_BGR16PC = 8; + PIXFMT_RGB24 = 9; + PIXFMT_BGR24 = 10; + PIXFMT_ARGB32 = 11; + PIXFMT_BGRA32 = 12; + PIXFMT_RGBA32 = 13; + { + SrcRectangle formats defines for xxxPixelArray calls() + } + RECTFMT_RGB = 0; + RECTFMT_RGBA = 1; + RECTFMT_ARGB = 2; + RECTFMT_LUT8 = 3; + RECTFMT_GREY8 = 4; + RECTFMT_RAW = 5; + { + Parameters for CVideoCtrlTagList() + } + SETVC_DPMSLevel = $88002001; + { Full operation } + DPMS_ON = 0; + { Optional state of minimal power reduction } + DPMS_STANDBY = 1; + { Significant reduction of power consumption } + DPMS_SUSPEND = 2; + { Lowest level of power consumption } + DPMS_OFF = 3; + { + Tags for LockBitMapTagList() + } + LBMI_WIDTH = $84001001; + LBMI_HEIGHT = $84001002; + LBMI_DEPTH = $84001003; + LBMI_PIXFMT = $84001004; + LBMI_BYTESPERPIX = $84001005; + LBMI_BYTESPERROW = $84001006; + LBMI_BASEADDRESS = $84001007; + { + Tags for UnLockBitMapTagList() + } + UBMI_UPDATERECTS = $85001001; + UBMI_REALLYUNLOCK = $85001002; + { + Message passed to the DoCDrawMethodTagList() hook function + } + + type + PCDrawMsg = ^tCDrawMsg; + tCDrawMsg = record + cdm_MemPtr : APTR; + cdm_offx : ULONG; + cdm_offy : ULONG; + cdm_xsize : ULONG; + cdm_ysize : ULONG; + cdm_BytesPerRow : UWORD; + cdm_BytesPerPix : UWORD; + cdm_ColorModel : UWORD; + end; + + { + Colour Table source formats for WriteLUTPixelArray() + } + { ULONG [] table } + + const + CTABFMT_XRGB8 = 0; + { + graphics.library/AllocBitMap() extended flags + } + BMB_SPECIALFMT = 7; + BMF_SPECIALFMT = 1 shl BMB_SPECIALFMT; + + BMF_REQUESTVMEM = (BMF_MINPLANES or BMF_DISPLAYABLE); + + BMB_ROOTMAP = 5; + BMF_ROOTMAP = 1 shl BMB_ROOTMAP; + + BMB_3DTARGET = 8; + BMF_3DTARGET = 1 shl BMB_3DTARGET; + +{* + * Operations for ProcessPixelArray() (v50) + * + *} + const + POP_BRIGHTEN = 0; + POP_DARKEN = 1; + POP_SETALPHA = 2; + POP_TINT = 3; + POP_BLUR = 4; + POP_COLOR2GREY = 5; + POP_NEGATIVE = 6; + POP_NEGFADE = 7; + POP_TINTFADE = 8; + POP_GRADIENT = 9; + POP_SHIFTRGB = 10; + +{* + * Values for POP_SHIFTRGB + * + *} + const + RGBSHIFT_BGR = 1; + RGBSHIFT_BRG = 2; + RGBSHIFT_GBR = 3; + RGBSHIFT_GRB = 4; + RGBSHIFT_RBG = 5; + +{* + * Tags for ProcessPixelArray() ops + * + *} + const + PPAOPTAG_FADEFULLSCALE = $85231020; + PPAOPTAG_FADEOFFSET = $85231021; + + PPAOPTAG_GRADIENTTYPE = $85231022; + + GRADTYPE_HORIZONTAL = 0; + GRADTYPE_VERTICAL = 1; + +{* yet unsupported gradient types follow *} + GRADTYPE_RECTANGLE = 2; + GRADTYPE_LINEAR_ANGLE = 3; + GRADTYPE_RADIAL = 4; {* "circle" center-based *} + + GRADIENT_NUMTYPES = 2; + + PPAOPTAG_GRADCOLOR1 = $85231023; + PPAOPTAG_GRADCOLOR2 = $85231024; + + PPAOPTAG_GRADFULLSCALE = PPAOPTAG_FADEFULLSCALE; + PPAOPTAG_GRADOFFSET = PPAOPTAG_FADEOFFSET; + + PPAOPTAG_RGBMASK = $85231025; + + PPAOPTAG_GRADSYMCENTER = $85231026; + +{* + * Tags for BltBitMap(RastPort)Alpha() (v50) + * + *} + const + BLTBMA_MIXLEVEL = $88802000; {* from 0(0%) to 0xFFFFFFFF (100%) *} + BLTBMA_USESOURCEALPHA = $88802001; + BLTBMA_GLOBALALPHA = BLTBMA_MIXLEVEL; + BLTBMA_DESTALPHAVALUE = $88802002; + + DESTALPHAVALUE_UNDEFINED = 0; {* default *} + DESTALPHAVALUE_ONE = 1; + DESTALPHAVALUE_USESOURCE = 2; + DESTALPHAVALUE_USEDEST = 3; + + + +FUNCTION AllocCModeListTagList(ModeListTags : pTagItem location 'a1') : pList; syscall CyberGfxBase 072; +FUNCTION BestCModeIDTagList(BestModeIDTags : pTagItem location 'a0') : longword; syscall CyberGfxBase 060; +FUNCTION CModeRequestTagList(ModeRequest : POINTER location 'a0'; ModeRequestTags : pTagItem location 'a1') : longword; syscall CyberGfxBase 066; +PROCEDURE CVideoCtrlTagList(ViewPort : pViewPort location 'a0'; TagList : pTagItem location 'a1'); syscall CyberGfxBase 162; +PROCEDURE DoCDrawMethodTagList(Hook : pHook location 'a0'; a1arg : pRastPort location 'a1'; TagList : pTagItem location 'a2'); syscall CyberGfxBase 156; +FUNCTION ExtractColor(a0arg : pRastPort location 'a0'; BitMap : pBitMap location 'a1'; Colour : longword location 'd0'; SrcX : longword location 'd1'; SrcY : longword location 'd2'; Width : longword location 'd3'; Height : longword location 'd4') : longword; syscall CyberGfxBase 186; +FUNCTION FillPixelArray(a1arg : pRastPort location 'a1'; DestX : WORD location 'd0'; DestY : WORD location 'd1'; SizeX : WORD location 'd2'; SizeY : WORD location 'd3'; ARGB : longword location 'd4') : longword; syscall CyberGfxBase 150; +PROCEDURE FreeCModeList(ModeList : pList location 'a0'); syscall CyberGfxBase 078; +FUNCTION GetCyberIDAttr(CyberIDAttr : longword location 'd0'; CyberDisplayModeID : longword location 'd1') : longword; syscall CyberGfxBase 102; +FUNCTION GetCyberMapAttr(CyberGfxBitmap : pBitMap location 'a0'; CyberAttrTag : longword location 'd0') : longword; syscall CyberGfxBase 096; +FUNCTION InvertPixelArray(a1arg : pRastPort location 'a1'; DestX : WORD location 'd0'; DestY : WORD location 'd1'; SizeX : WORD location 'd2'; SizeY : WORD location 'd3') : longword; syscall CyberGfxBase 144; +FUNCTION IsCyberModeID(displayID : longword location 'd0') : wordbool; syscall CyberGfxBase 054; +FUNCTION LockBitMapTagList(BitMap : POINTER location 'a0'; TagList : pTagItem location 'a1') : POINTER; syscall CyberGfxBase 168; +FUNCTION MovePixelArray(SrcX : WORD location 'd0'; SrcY : WORD location 'd1'; a1arg : pRastPort location 'a1'; DestX : WORD location 'd2'; DestY : WORD location 'd3'; SizeX : WORD location 'd4'; SizeY : WORD location 'd5') : longword; syscall CyberGfxBase 132; +FUNCTION ReadPixelArray(destRect : POINTER location 'a0'; destX : WORD location 'd0'; destY : WORD location 'd1'; destMod : WORD location 'd2'; a1arg : pRastPort location 'a1'; SrcX : WORD location 'd3'; SrcY : WORD location 'd4'; SizeX : WORD location 'd5'; SizeY : WORD location 'd6'; DestFormat : byte location 'd7') : longword; syscall CyberGfxBase 120; +FUNCTION ReadRGBPixel(a1arg : pRastPort location 'a1'; x : WORD location 'd0'; y : WORD location 'd1') : longword; syscall CyberGfxBase 108; +FUNCTION ScalePixelArray(srcRect : POINTER location 'a0'; SrcW : WORD location 'd0'; SrcH : WORD location 'd1'; SrcMod : WORD location 'd2'; a1arg : pRastPort location 'a1'; DestX : WORD location 'd3'; DestY : WORD location 'd4'; DestW : WORD location 'd5'; DestH : WORD location 'd6'; SrcFormat : byte location 'd7') : LONGINT; syscall CyberGfxBase 090; +PROCEDURE UnLockBitMap(Handle : POINTER location 'a0'); syscall CyberGfxBase 174; +PROCEDURE UnLockBitMapTagList(Handle : POINTER location 'a0'; TagList : pTagItem location 'a1'); syscall CyberGfxBase 180; +FUNCTION WriteLUTPixelArray(srcRect : POINTER location 'a0'; SrcX : WORD location 'd0'; SrcY : WORD location 'd1'; SrcMod : WORD location 'd2'; a1arg : pRastPort location 'a1'; ColorTab : POINTER location 'a2'; DestX : WORD location 'd3'; DestY : WORD location 'd4'; SizeX : WORD location 'd5'; SizeY : WORD location 'd6'; CTFormat : byte location 'd7') : longword; syscall CyberGfxBase 198; +FUNCTION WritePixelArray(srcRect : POINTER location 'a0'; SrcX : WORD location 'd0'; SrcY : WORD location 'd1'; SrcMod : WORD location 'd2'; a1arg : pRastPort location 'a1'; DestX : WORD location 'd3'; DestY : WORD location 'd4'; SizeX : WORD location 'd5'; SizeY : WORD location 'd6'; SrcFormat : byte location 'd7') : longword; syscall CyberGfxBase 126; +FUNCTION WriteRGBPixel(a1arg : pRastPort location 'a1'; x : WORD location 'd0'; y : WORD location 'd1'; argb : longword location 'd2') : LONGINT; syscall CyberGfxBase 114; + +{*** v43 ***} +FUNCTION WritePixelArrayAlpha(srcRect : POINTER location 'a0'; SrcX : WORD location 'd0'; SrcY : WORD location 'd1'; SrcMod : WORD location 'd2'; a1arg : pRastPort location 'a1'; DestX : WORD location 'd3'; DestY : WORD location 'd4'; SizeX : WORD location 'd5'; SizeY : WORD location 'd6'; globalAlpha : LongWord location 'd7') : longword; syscall CyberGfxBase 216; +PROCEDURE BltTemplateAlpha(source : pWORD location 'a0'; xSrc : LongInt location 'd0'; srcMod : LongInt location 'd1'; destRP : pRastPort location 'a1'; xDest : LongInt location 'd2'; yDest : LongInt location 'd3'; xSize : LongInt location 'd4'; ySize : LongInt location 'd5'); SysCall CyberGfxBase 222; +PROCEDURE ProcessPixelArray(rastPort: pRastPort location 'a0'; destX: LongWord location 'd0'; destY: LongWord location 'd1'; sizeX: LongWord location 'd2'; sizeY: LongWord location 'd3'; operation: LongWord location 'd4'; value: LongInt location 'd5'; taglist: pTagItem location 'a2'); syscall CyberGfxBase 228; + +{*** v50 ***} +FUNCTION BltBitMapAlpha(srcBitMap : pBitMap location 'a0'; xSrc : LongInt location 'd0'; ySrc : LongInt location 'd1'; destBitMap : pBitMap location 'a1'; xDest : LongInt location 'd2'; yDest : LongInt location 'd3'; xSize : LongInt location 'd4'; ySize : LongInt location 'd5'; tagList : pTagItem location 'a2') : LongWord; syscall CyberGfxBase 234; +FUNCTION BltBitMapRastPortAlpha(srcBitMap : pBitMap location 'a0'; xSrc : LongInt location 'd0'; ySrc : LongInt location 'd1'; destRP : pRastPort location 'a1'; xDest : LongInt location 'd2'; yDest : LongInt location 'd3'; xSize : LongInt location 'd4'; ySize : LongInt location 'd5'; tagList : pTagItem location 'd2') : LongWord; SysCall CyberGfxBase 240; +FUNCTION ScalePixelArrayAlpha(srcRect : POINTER location 'a0'; SrcW : WORD location 'd0'; SrcH : WORD location 'd1'; SrcMod : WORD location 'd2'; a1arg : pRastPort location 'a1'; DestX : WORD location 'd3'; DestY : WORD location 'd4'; DestW : WORD location 'd5'; DestH : WORD location 'd6'; globalAlpha : LongWord location 'd7') : LONGINT; syscall CyberGfxBase 252; + +{ + Functions and procedures with array of const go here +} +{ +FUNCTION AllocCModeListTags(const ModeListTags : Array Of Const) : pList; +FUNCTION BestCModeIDTags(const BestModeIDTags : Array Of Const) : longword; +FUNCTION CModeRequestTags(ModeRequest : POINTER; const ModeRequestTags : Array Of Const) : longword; +PROCEDURE CVideoCtrlTags(ViewPort : pViewPort; const TagList : Array Of Const); +PROCEDURE DoCDrawMethodTags(Hook : pHook; a1arg : pRastPort; const TagList : Array Of Const); +FUNCTION LockBitMapTags(BitMap : POINTER; const TagList : Array Of Const) : POINTER; +PROCEDURE UnLockBitMapTags(Handle : POINTER; const TagList : Array Of Const); +} +function SHIFT_PIXFMT(fmt : longint) : longint; + +function InitCyberGfxLibrary: boolean; + +IMPLEMENTATION + +{uses +tagsarray;} + +{ + Functions and procedures with array of const go here +} +{ +FUNCTION AllocCModeListTags(const ModeListTags : Array Of Const) : pList; +begin + AllocCModeListTags := AllocCModeListTagList(readintags(ModeListTags)); +end; + +FUNCTION BestCModeIDTags(const BestModeIDTags : Array Of Const) : longword; +begin + BestCModeIDTags := BestCModeIDTagList(readintags(BestModeIDTags)); +end; + +FUNCTION CModeRequestTags(ModeRequest : POINTER; const ModeRequestTags : Array Of Const) : longword; +begin + CModeRequestTags := CModeRequestTagList(ModeRequest , readintags(ModeRequestTags)); +end; + +PROCEDURE CVideoCtrlTags(ViewPort : pViewPort; const TagList : Array Of Const); +begin + CVideoCtrlTagList(ViewPort , readintags(TagList)); +end; + +PROCEDURE DoCDrawMethodTags(Hook : pHook; a1arg : pRastPort; const TagList : Array Of Const); +begin + DoCDrawMethodTagList(Hook , a1arg , readintags(TagList)); +end; + +FUNCTION LockBitMapTags(BitMap : POINTER; const TagList : Array Of Const) : POINTER; +begin + LockBitMapTags := LockBitMapTagList(BitMap , readintags(TagList)); +end; + +PROCEDURE UnLockBitMapTags(Handle : POINTER; const TagList : Array Of Const); +begin + UnLockBitMapTagList(Handle , readintags(TagList)); +end; +} +function SHIFT_PIXFMT(fmt : longint) : longint; inline; +begin + SHIFT_PIXFMT:=(ULONG(fmt)) shl 24; +end; + + +const + { Change VERSION and LIBVERSION to proper values } + + VERSION : string[2] = '0'; + LIBVERSION : longword = 0; + +var + cybergfx_exit : Pointer; + +procedure CloseCyberGfxLibrary; +begin + ExitProc := cybergfx_exit; + if CyberGfxBase <> nil then begin + CloseLibrary(CyberGfxBase); + CyberGfxBase := nil; + end; +end; + +function InitCyberGfxLibrary: boolean; +begin + CyberGfxBase := nil; + CyberGfxBase := OpenLibrary(CYBERGFXNAME,LIBVERSION); + if CyberGfxBase <> nil then begin + cybergfx_exit := ExitProc; + ExitProc := @CloseCyberGfxLibrary; + InitCyberGfxLibrary := true; + end else begin + InitCyberGfxLibrary := false; + end; +end; + +END. (* UNIT CYBERGRAPHICS *)