Hi!


The first attachment is the extension API header file of LibOVL.

The second attachment contains the extension internals of LibOVL.


If they are ok, then we can start writing the targets.
The framework itself compiles and is ready.


BTW: Which target/s make/s sense to implement for now?



CU,

Christoph Egger
E-Mail: [EMAIL PROTECTED]
/*
******************************************************************************

   LibOVL: extension API header file

   Copyright (C) 2001 Christoph Egger   [[EMAIL PROTECTED]]

   Permission is hereby granted, free of charge, to any person obtaining a
   copy of this software and associated documentation files (the "Software"),
   to deal in the Software without restriction, including without limitation
   the rights to use, copy, modify, merge, publish, distribute, sublicense,
   and/or sell copies of the Software, and to permit persons to whom the
   Software is furnished to do so, subject to the following conditions:

   The above copyright notice and this permission notice shall be included in
   all copies or substantial portions of the Software.

   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
   THE AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
   IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
   CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


******************************************************************************
*/

#ifndef _GGI_OVL_H
#define _GGI_OVL_H

#include <ggi/ggi.h>

__BEGIN_DECLS



/* Extension management
 */
int ggiOvlInit(void);
int ggiOvlExit(void);

int ggiOvlAttach(ggi_visual_t vis);
int ggiOvlDetach(ggi_visual_t vis);


/* Structure
 */

#ifdef HAVE_STRUCT_OVL
typedef struct ggiOvl *ggiOvl_t;
#else
typedef void *ggiOvl_t;
#endif


enum OverlayFeaturetype {

        /* defined by extension */
        OVL_FT_SUBTYPE_MASK =   0x00000fff,
        OVL_FT_TYPE_MASK =      0x000ff000,

        /* generic drawing area in same format as the main fb */
        OVL_FT_SWATCH =         0x00002000,

        /* Right/left eye data */
        OVL_FT_STEREO =         0x00003000,

        /* Sprite/hw cursors */
        OVL_FT_SPRITE =         0x00004000,

        /* video */
        OVL_FT_VIDEO =          0x00005000,

        /* any window */
        OVL_FT_WINDOW =         0x00006000,

        /* e.g. feature connector */
        OVL_FT_PASSTHRU =       0x00007000,

        /* # of hardware "layers" */
        OVL_FT_OVERLAY_MASK =   0x0ff00000,

        /* there is direct MMIO access to the feature's data */
        OVL_FT_DIRECTBUFFER =   0x10000000,



        /* Subtypes for sprite features */
        OVL_FT_SPRITE_DONTCARE =0x00000000,

        /* Hardware pointer cursor */
        OVL_FT_SPRITE_POINTER = 0x00000001,

        /* Hardware text cursor */
        OVL_FT_SPRITE_CURSOR =  0x00000002,

        /* True sprite (a-la C-64) */
        OVL_FT_SPRITE_SPRITE =  0x00000003,



        /* Subtypes for video features */
        OVL_FT_VIDEO_DONTCARE = 0x00000000,

        /* motion video */
        OVL_FT_VIDEO_MOTION =   0x00000010,

        /* streaming video */
        OVL_FT_VIDEO_STREAMING =0x00000011,



        /* Subtypes for window features */
        OVL_FT_WINDOW_DONTCARE =0x00000000,

        /* YUV-Viewport */
        OVL_FT_WINDOW_YUV =     0x00000020,
};


enum OverlayOptiontype {

        /* Used for transluency effects */
        OVLOP_ALPHA,

        /* Used for blending-effects */
        OVLOP_BLENDING,

        /* Used for setting up a hw-source for images */
        OVLOP_SRC,
};


/* Overlay Error-Codes */

#include <ggi/errors.h>

#define OVL_OK                  GGI_OK

#define OVL_EUNAVAILABLE        -1
#define OVL_EDOESNOTHING        -2




/* API functions
 */




/* checks, if an object of the given type and properties is available.
 * If not, then it fails else it allocates it with the given size.
 */
ggiOvl_t ggiOvlAllocate(ggi_visual_t vis, enum OverlayFeaturetype type,
                        void *properties, int width, int height);


/* checks, if the given type of overlay with the given properties
 * will work. If not, then the modified properties passed back
 * should work. If NOTHING would work on the current target, then
 * it returns an error-code.
 */
int ggiOvlCheck(ggi_visual_t vis, enum OverlayFeaturetype type,
                void *properties, int width, int height);


/* free's the allocated area by ggiOvlAllocate
 */
int ggiOvlFree(ggiOvl_t ovl);


/* Set the given image (vis) to the ovl-area with grabbing the image
 * from a visual at pos (x,y)
 */
int ggiOvlSetImage(ggiOvl_t ovl, ggi_visual_t vis,
                        int x, int y, unsigned char *alpha);


/* To control the effects of the overlay, like transparency,
 * setting a hardware source for the image etc.
 */
int ggiOvlSetOption(ggiOvl_t ovl,enum OverlayOptiontype op,void *arg);


/* moves the ovl-area to (x,y), where (x,y) is the top-left corner
 * of the ovl-area.
 */
int ggiOvlMove(ggiOvl_t ovl, int x, int y);


/* shows/hides the ovl-area
 */
int ggiOvlShow(ggiOvl_t ovl);
int ggiOvlHide(ggiOvl_t ovl);
int ggiOvlIsHidden(ggiOvl_t ovl);


__END_DECLS

#endif /* _GGI_OVL_H */
/*
******************************************************************************

   LibOVL: extension internals

   Copyright (C) 2001 Christoph Egger   [[EMAIL PROTECTED]]

   Permission is hereby granted, free of charge, to any person obtaining a
   copy of this software and associated documentation files (the "Software"),
   to deal in the Software without restriction, including without limitation
   the rights to use, copy, modify, merge, publish, distribute, sublicense,
   and/or sell copies of the Software, and to permit persons to whom the
   Software is furnished to do so, subject to the following conditions:

   The above copyright notice and this permission notice shall be included in
   all copies or substantial portions of the Software.

   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
   THE AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
   IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
   CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

******************************************************************************
*/

#ifndef _GGI_OVL_INT_H
#define _GGI_OVL_INT_H

#include <ggi/internal/internal.h>

#define HAVE_STRUCT_OVL
#include <ggi/ovl.h>

__BEGIN_DECLS

/* Exported variables */
#ifdef BUILDING_LIBOVL
extern ggi_extid    _ovlID;
#else
IMPORTVAR ggi_extid _ovlID;
#endif

__END_DECLS



/* Internal data types */

struct Common {
        /* pointer to a directbuffer.
         * Note, that this may be shared with other sprites.
         * If direct access to the sprite has to be emulated,
         * these functions do _not_ have to use the read and
         * write members of this db-struct.
         */
        ggi_directbuffer *db;

        /* Pointers to the VRAM adress, if the sprite data
         * can be accessed directly. Otherwise, they point
         * to some RAM allocated from system memory.
         */
        void *read;
        void *write;

        /* Pointer to set/get functions.  These functions will
         * transfer the contents of a system RAM buffer to/from the
         * sprite.  If you are writing to VRAM directly, the function
         * will do nothing, but returning something like
         * -E(INFO_DOESNOTHING).
         */
        int (*set)(int x, int y, const void *data, int size);
        int (*get)(int x, int y, void *data, int size);
};


struct Sprite {

};

struct Video {

};

struct Window {

};


struct ggiOvl {
        enum OverlayFeaturetype ftype;
        ggi_visual_t vis;
        int x,y,w,h;
        int hidecount;

        struct Common common;
        union {
                struct Sprite sprite;
                struct Video  video;
                struct Window window;
        } Ovltype;
};



/* Data types for the API functions */
typedef ggiOvl_t (OvlAllocate)(ggi_visual_t vis, enum OverlayFeaturetype type,
                        void *properties, int width, int height);

typedef int (OvlCheck)(ggi_visual_t vis, enum OverlayFeaturetype type,
                void *properties, int width, int height);

typedef int (OvlFree)(ggiOvl_t ovl);

typedef int (OvlSetImage)(ggiOvl_t ovl, ggi_visual_t vis,
                        int x, int y, unsigned char *alpha);
typedef int (OvlSetOption)(ggiOvl_t ovl,
                        enum OverlayOptiontype op, void *arg);

typedef int (OvlMove)(ggiOvl_t ovl, int x, int y);      

typedef int (OvlShow)(ggiOvl_t ovl);
typedef int (OvlHide)(ggiOvl_t ovl);
typedef int (OvlIsHidden)(ggiOvl_t ovl);


typedef struct ovlpriv {
        OvlAllocate     *alloc;
        OvlCheck        *check;
        OvlFree         *free;

        OvlSetImage     *setimage;
        OvlSetOption    *setoption;

        OvlMove         *move;

        OvlShow         *show;
        OvlHide         *hide;
        OvlIsHidden     *ishidden;
        
        

        void *priv;     /* Here sublibs can store visual specific private data.
                           If you have more than one sublib (for each visual)
                           that needs private data, just add more pointers or
                           add the data fields directly in this structure. */
} ovlpriv;

/* Used to access the ovlpriv structure for a particular visual. */
#define LIBGGI_OVLEXT(vis) ((ovlpriv *)LIBGGI_EXT((vis),_ovlID))


#endif /* _GGI_OVL_INT_H */

Reply via email to