graphics.h

00001 /***************************************************************************
00002                           graphics.h  -  description
00003                              -------------------
00004 
00005     begin                : Mon Feb 16 2004
00006     copyright            : (C) 2004 by Dynacube Team
00007     email                : 
00008  ***************************************************************************/
00009 
00010 /***************************************************************************
00011  *                                                                         *
00012  *   This program is free software; you can redistribute it and/or modify  *
00013  *   it under the terms of the GNU General Public License as published by  *
00014  *   the Free Software Foundation; either version 2 of the License, or     *
00015  *   (at your option) any later version.                                   *
00016  *                                                                         *
00017  ***************************************************************************/
00018 
00019 
00020  #ifndef __GRAPHICS_H
00021  #define __GRAPHICS_H
00022 
00023  #include "common/stdlib.h"
00024  #include "common/ktypes.h"
00025  #include "gui/components/font.h"
00026  #include "gui/server/gui.h"
00027  #include "dev/mouse/mouse.h"
00028 
00029  #define LIGHT_COLOR  0xFFFF //WHITE
00030  #define DARK_COLOR   0xABCD
00031 
00032  #define DEFAULT_EMBOSS_SIZE  2
00033  #define TOP    1<<0
00034  #define LEFT   1<<1
00035  #define BOTTOM 1<<2
00036  #define RIGHT  1<<3
00037  
00038  #define chkGraphicsInited()  (graphics)
00039  #define normalize(x,y) x=abs(x); y=abs(y); x %= xRes; x *= (bpp/8); y %= yRes; y *= (bpp/8);
00040   
00041   extern DW xRes, yRes, bpp; //bpp = Bits Per Pixel
00042   extern boolean graphics;
00043   
00044   extern DW svga_buf[] __attribute__((aligned (_4KB)));   //600*800
00045   extern DD svgabuf;  //DBLBUffer
00046   extern DD physvgabuf; //pointer to mode_info.PhyAddrBase
00047 
00048   typedef DW COLOR;
00049   extern COLOR mouseimg[16][16];
00050     
00051   void initgraphics(DW _xRes, DW _yRes, DW _bpp, DD _svgabuf);
00052   void setScreen(COLOR c);
00053   void drawChar(DW x, DW y, DW index);
00054   
00055   //Generic Dynacube Drawing routines
00056   void setPixel(DW x, DW y, COLOR c);
00057   COLOR getPixel(DW x, DW y);
00058 
00059   void drawChar(DW x, DW y, DW index);
00060   void drawstring(DW x,DW y,char *title);
00061   void drawMousePtr(DW x,DW y);
00062   
00063   void rect(DW x, DW y, DW width, DW height);
00064   void charrect(DW x,DW y,DW width,DW height,DB ch);
00065   void fillrect(DW x,DW y,DW width,DW height,COLOR fill);
00066   
00067   void restoreImage(DW x, DW y);
00068   void getimage(DW x, DW y,DW width, DW height, COLOR *buffer);
00069   void putimage(DW x, DW y,DW width, DW height, COLOR *buffer);
00070 
00071   void mvBuf2Svga();
00072   void mvMini2Svga(DW _x, DW _y, DW _width, DW _height);
00073    
00074   void line(SDW x0, SDW y0, SDW x1, SDW y1, COLOR color);
00075   void push3D(DW x, DW y, DW width, DW height);
00076   void emboss3D(DW x, DW y, DW width, DW height,DB flags,boolean in_or_out, DB emboss_size);
00077 
00078   boolean iswithin(DW x,DW y,DW stx,DW sty,DW width,DW height);
00079   void cprint(DW x,DW y,char *title,COLOR c);
00080  
00081  #endif

Generated on Thu Jul 27 23:52:26 2006 for Dynacube by  doxygen 1.4.7