Home | History | Annotate | Line # | Download | only in rasops
rasops.h revision 1.3
      1  1.3  ad /* $NetBSD: rasops.h,v 1.3 1999/04/13 03:02:40 ad Exp $ */
      2  1.1  ad 
      3  1.2  ad /*
      4  1.2  ad  * Copyright (c) 1999 Andy Doran <ad (at) NetBSD.org>
      5  1.1  ad  * All rights reserved.
      6  1.1  ad  *
      7  1.1  ad  * Redistribution and use in source and binary forms, with or without
      8  1.1  ad  * modification, are permitted provided that the following conditions
      9  1.1  ad  * are met:
     10  1.1  ad  * 1. Redistributions of source code must retain the above copyright
     11  1.1  ad  *    notice, this list of conditions and the following disclaimer.
     12  1.1  ad  * 2. Redistributions in binary form must reproduce the above copyright
     13  1.1  ad  *    notice, this list of conditions and the following disclaimer in the
     14  1.1  ad  *    documentation and/or other materials provided with the distribution.
     15  1.1  ad  *
     16  1.2  ad  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
     17  1.2  ad  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     18  1.2  ad  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     19  1.2  ad  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
     20  1.2  ad  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     21  1.2  ad  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     22  1.2  ad  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     23  1.2  ad  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     24  1.2  ad  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     25  1.2  ad  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     26  1.2  ad  * SUCH DAMAGE.
     27  1.2  ad  *
     28  1.1  ad  */
     29  1.2  ad 
     30  1.1  ad #ifndef _RASOPS_H_
     31  1.1  ad #define _RASOPS_H_ 1
     32  1.1  ad 
     33  1.1  ad /* Avoid dragging in dev/wscons/wsconsio.h */
     34  1.1  ad struct wsdisplay_font;
     35  1.1  ad 
     36  1.1  ad struct rasops_info {
     37  1.1  ad 	/* These must be filled in by the caller */
     38  1.1  ad 	int	ri_depth;	/* depth in bits */
     39  1.1  ad 	u_char	*ri_bits;	/* ptr to bits */
     40  1.1  ad 	int	ri_width;	/* width (pels) */
     41  1.1  ad 	int	ri_height;	/* height (pels) */
     42  1.1  ad 	int	ri_stride;	/* stride in bytes */
     43  1.1  ad 
     44  1.3  ad 	/* These can optionally be left empty */
     45  1.3  ad 	struct	wsdisplay_font *ri_font;
     46  1.3  ad 	void	*ri_priv;	/* driver private data */
     47  1.3  ad 	u_char	ri_forcemono;	/* force monochrome operation */
     48  1.3  ad 	u_char	ri_swab;	/* swap bytes for 15/16/32 bit depths? */
     49  1.1  ad 
     50  1.1  ad 	/*
     51  1.1  ad 	 * These are optional and will default if zero. Meaningless
     52  1.1  ad 	 * on depths other than 15, 16, 24 and 32 bits per pel. On
     53  1.1  ad 	 * 24 bit displays, ri_{r,g,b}num must be 8.
     54  1.1  ad 	 */
     55  1.1  ad 	u_char	ri_rnum;	/* number of bits for red */
     56  1.1  ad 	u_char	ri_gnum;	/* number of bits for green */
     57  1.1  ad 	u_char	ri_bnum;	/* number of bits for blue */
     58  1.1  ad 	u_char	ri_rpos;	/* which bit red starts at */
     59  1.1  ad 	u_char	ri_gpos;	/* which bit green starts at */
     60  1.1  ad 	u_char	ri_bpos;	/* which bit blue starts at */
     61  1.1  ad 
     62  1.1  ad 	/* These are filled in by rasops_init() */
     63  1.1  ad 	int	ri_emuwidth;	/* width we actually care about */
     64  1.1  ad 	int	ri_emuheight;	/* height we actually care about */
     65  1.1  ad 	int	ri_emustride;	/* bytes per row we actually care about */
     66  1.1  ad 	int	ri_rows;	/* number of rows (characters, not pels) */
     67  1.1  ad 	int	ri_cols;	/* number of columns (characters, not pels) */
     68  1.1  ad 	int	ri_delta;	/* row delta in bytes */
     69  1.1  ad 	int	ri_flg;		/* flags */
     70  1.1  ad 	int	ri_crow;	/* cursor row */
     71  1.1  ad 	int	ri_ccol;	/* cursor column */
     72  1.1  ad 	int	ri_pelbytes;	/* bytes per pel */
     73  1.1  ad 	int	ri_fontscale;	/* fontheight * fontstride */
     74  1.1  ad 	int	ri_xscale;	/* fontwidth * pelbytes */
     75  1.1  ad 	int	ri_yscale;	/* fontheight * stride */
     76  1.1  ad 	u_char  *ri_origbits;	/* where screen bits actually start */
     77  1.1  ad 
     78  1.1  ad 	/* For 15, 16, 24, 32 bits */
     79  1.1  ad 	int32_t	ri_devcmap[16]; /* device colormap (WSCOL_*) */
     80  1.1  ad 
     81  1.1  ad 	/* The emulops you need to use */
     82  1.1  ad 	struct	wsdisplay_emulops ri_ops;
     83  1.1  ad 
     84  1.1  ad 	/* Callbacks so we can share some code */
     85  1.1  ad 	void	(*ri_do_cursor)(struct rasops_info *);
     86  1.1  ad };
     87  1.1  ad 
     88  1.1  ad #define RASOPS_CURSOR		(0x01)	/* cursor is on */
     89  1.1  ad #define RASOPS_INITTED		(0x02)	/* struct is initialized */
     90  1.1  ad #define RASOPS_CURSOR_CLIPPED	(0x04)	/* cursor is clipped */
     91  1.1  ad 
     92  1.1  ad #define DELTA(p, d, cast) ((p) = (cast)((caddr_t)(p) + (d)))
     93  1.1  ad 
     94  1.1  ad /*
     95  1.1  ad  * rasops_init().
     96  1.1  ad  *
     97  1.1  ad  * Integer parameters are: number of rows we'd like, number of columns we'd
     98  1.1  ad  * like, whether we should clear the display and whether we should center
     99  1.1  ad  * the output. Remember that what you'd like is always not what you get.
    100  1.1  ad  *
    101  1.1  ad  * In terms of optimization, fonts that are a multiple of 8 pixels wide
    102  1.1  ad  * work the best: this is important, and will cost you if you don't use 'em.
    103  1.1  ad  */
    104  1.1  ad 
    105  1.1  ad /* rasops.c */
    106  1.1  ad int	rasops_init __P((struct rasops_info *, int, int, int, int));
    107  1.1  ad void	rasops_unpack_attr __P((long, int *, int *, int *));
    108  1.1  ad 
    109  1.1  ad /* This should not be called outside rasops */
    110  1.1  ad void	rasops_init_devcmap __P((struct rasops_info *));
    111  1.1  ad 
    112  1.1  ad extern u_char rasops_isgray[16];
    113  1.1  ad extern u_char rasops_cmap[256*3];
    114  1.1  ad 
    115  1.1  ad #endif /* _RASOPS_H_ */
    116