⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 iface.c

📁 unix vnc 协议源码. VNC是一款远程控制工具软件.
💻 C
📖 第 1 页 / 共 2 页
字号:
/* $XConsortium: iface.c,v 1.3 94/04/17 20:17:44 rws Exp $ *//*Copyright 1989-1991, Bitstream Inc., Cambridge, MA.You are hereby granted permission under all Bitstream propriety rights touse, copy, modify, sublicense, sell, and redistribute the Bitstream Speedosoftware and the Bitstream Charter outline font for any purpose and withoutrestrictions; provided, that this notice is left intact on all copies of suchsoftware or font and that Bitstream's trademark is acknowledged as shown belowon all unmodified copies of such font.BITSTREAM CHARTER is a registered trademark of Bitstream Inc.BITSTREAM INC. DISCLAIMS ANY AND ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDINGWITHOUT LIMITATION THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR APARTICULAR PURPOSE.  BITSTREAM SHALL NOT BE LIABLE FOR ANY DIRECT OR INDIRECTDAMAGES, INCLUDING BUT NOT LIMITED TO LOST PROFITS, LOST DATA, OR ANY OTHERINCIDENTAL OR CONSEQUENTIAL DAMAGES, ARISING OUT OF OR IN ANY WAY CONNECTEDWITH THE SPEEDO SOFTWARE OR THE BITSTREAM CHARTER OUTLINE FONT.*//***************************** I F A C E . C ********************************* *                                                                           * * This module provides a layer to make Speedo function calls to and         * * from it compatible with Fontware 2.X function calls.                      * *                                                                           * ****************************************************************************/#include "speedo.h"               /* General definitions for Speedo */#include <math.h>#define   DEBUG      0#if DEBUG#include <stdio.h>#define SHOW(X) printf("X = %d\n", X)#else#define SHOW(X)#endif#define  PI     3.1415926536       /* pi */#define  PTPERINCH   72.2892       /* nbr points per inch, exactly! */#define  BIT8           0x0100#define  BIT9           0x0200#define  BIT10          0x0400#define  BIT11          0x0800#define  BIT12          0x1000#define  BIT13          0x2000#define  BIT14          0x4000#define  BIT15          0x8000#define   READ      0typedef   short     bool16;typedef   int       bool;typedefstruct    {    bool16  left;    bool16  right;    bool16  top;    bool16  bottom;    }   lrtb;typedefstruct    {    buff_t *pfont;              /* Pointer to font data                    */    ufix16  mode;               /* what mode is the font generator in      */    real    point_size_x;       /* Point size in X dimension               */    real    point_size_y;       /* Point size in Y dimension               */    real    res_hor;            /* Horizontal resolution of output device  */    real    res_ver;            /* Vertical resolution of output device    */    real    rot_angle;          /* Rotation angle in degrees (clockwise)   */    real    obl_angle;          /* Obliquing angle in degrees (clockwise)  */    bool16  whitewrite;         /* if T, generate bitmaps for whitewriters */    fix15   thresh;             /* Scan conversion threshold               *                                 * Thickens characters on each edge by     *                                 * <thresh> sub-pixels                     */      bool16  import_widths;      /* Use imported width table                */    lrtb    clip;               /* Clip to standard character cell         */    lrtb    squeeze;            /* Squeeze to standard character cell      */    bool16  bogus_mode;         /* if T, ignore plaid data                 */    }   comp_char_desc;         /* character attributes for scan conv      *//***** GLOBAL VARIABLES *****//*****  GLOBAL FUNCTIONS *****/     fw_reset();                /* Fontware 2.X reset call                 */     fw_set_specs();            /* Fontware 2.X set specs call             */bool fw_make_char();            /* Fontware 2.X make character call        */       /***** EXTERNAL VARIABLES *****//***** EXTERNAL FUNCTIONS *****/void    _open_bitmap();void    _close_bitmap();void    _set_bitmap_bits();void    _open_outline();void    _open_outline();void    _start_new_char();void    _start_curve();void    _line_to();void    _close_curve();void    _close_outline();/***** STATIC VARIABLES *****/static specs_t *pspecs;static buff_t  *pfont;static buff_t   char_data;static fix15    set_width_x;static specs_t  specsarg;/***** STATIC FUNCTIONS *****/static fix31 make_mult();FUNCTION fw_reset(){sp_reset();}FUNCTION fw_set_specs(pspecs)comp_char_desc  *pspecs;  /* Pointer to scan conversion parameters structure *//*  Fontware 2.X character generator call to set font specifications *  compc -- pointer to structure containing scan conversion parameters. *   ->compf -- compressed font data structure *   ->point_size_x -- x pointsize *   ->point_size_y -- y pointsize *   ->res_hor -- horizontal pixels per inch *   ->res_ver -- vertical pixels per inch *   ->rot_angle -- rotation angle in degrees (clockwise) *   ->obl_angle -- obliquing angle in degrees (clockwise) *   ->whitewrite -- if true, generate bitmaps for whitewriters *   ->thresh -- scan-conversion threshold *   ->import_widths -- if true, use external width table *   ->clip.left -- clips min x at left of emsquare *   ->clip.right -- clips max x at right of emsquare *   ->clip.bottom -- clips min x at bottom of emsquare *   ->clip.top -- clips max x at top of emsquare *   ->squeeze.left -- squeezes min x at left of emsquare *   ->squeeze.right, .top, .bottom  &c *   ->sw_fixed -- if TRUE, match pixel widths to scaled outline widths *   ->bogus_mode -- ignore plaid data if TRUE */{fix15   irot;fix15   iobl;fix15   x_trans_type;fix15   y_trans_type;fix31   xx_mult;fix31   xy_mult;fix31   yx_mult;fix31   yy_mult;real    sinrot, cosrot, tanobl;real    x_distortion;real    pixperem_h;real    pixperem_v;real    point_size_x;real    point_size_y;real    res_hor;real    res_ver;fix15   mode;specsarg.pfont = pspecs->pfont;irot = floor(pspecs->rot_angle + 0.5);iobl = floor(pspecs->obl_angle + 0.5);if (iobl > 85)    iobl = 85;if (iobl < -85)    iobl = -85;if ((irot % 90) == 0)    {    x_trans_type = y_trans_type = irot / 90 & 0x0003;    if (iobl != 0)        {        if (x_trans_type & 0x01)            y_trans_type = 4;        else            x_trans_type = 4;        }    }else if (((irot + iobl) % 90) == 0)    {    x_trans_type = y_trans_type = (irot + iobl) / 90 & 0x0003;    if (iobl != 0)        {        if (x_trans_type & 0x01)            x_trans_type = 4;        else            y_trans_type = 4;        }    }else    {    x_trans_type = y_trans_type = 4;    }point_size_x = pspecs->point_size_x;point_size_y = pspecs->point_size_y;res_hor = pspecs->res_hor;res_ver = pspecs->res_ver;switch (x_trans_type)    {case 0:     xx_mult = make_mult(point_size_x, res_hor);    xy_mult = 0;    break;case 1:    xx_mult = 0;    xy_mult = make_mult(point_size_y, res_hor);    break;case 2:     xx_mult = -make_mult(point_size_x, res_hor);    xy_mult = 0;    break;case 3:    xx_mult = 0;    xy_mult = -make_mult(point_size_y, res_hor);    break;default:    sinrot = sin((real)irot * PI / 180.);    cosrot = cos((real)irot * PI / 180.);    tanobl = tan((real)iobl * PI / 180.);    x_distortion = point_size_x / point_size_y;    pixperem_h = point_size_y * res_hor / (real)PTPERINCH;   /* this is NOT a bug */    xx_mult = floor(cosrot * x_distortion * pixperem_h * 65536.0 + 0.5);    xy_mult = floor((sinrot + cosrot * tanobl) * pixperem_h * 65536.0 + 0.5);    break;    }switch (y_trans_type)    {case 0:     yx_mult = 0;    yy_mult = make_mult(point_size_y, res_ver);    break;case 1:    yx_mult = -make_mult(point_size_x, res_hor);    yy_mult = 0;    break;case 2:     yx_mult = 0;    yy_mult = -make_mult(point_size_y, res_ver);    break;case 3:    yx_mult = make_mult(point_size_x, res_ver);    yy_mult = 0;    break;default:    sinrot = sin((real)irot * PI / 180.);    cosrot = cos((real)irot * PI / 180.);    tanobl = tan((real)iobl * PI / 180.);    x_distortion = point_size_x / point_size_y;    pixperem_v = point_size_y * res_ver / (real)PTPERINCH;    yx_mult = floor(-sinrot * x_distortion * pixperem_v * 65536.0 + 0.5);    yy_mult = floor((cosrot - sinrot * tanobl) * pixperem_v * 65536.0 + 0.5);    break;    }specsarg.xxmult = xx_mult;specsarg.xymult = xy_mult;specsarg.xoffset = 0;specsarg.yxmult = yx_mult;specsarg.yymult = yy_mult;specsarg.yoffset = 0;specsarg.out_info = 0;/* Select processing mode */switch (pspecs->mode)    {case 1:    if (pspecs->whitewrite)           /* White-write requested? */        {        mode = 1;        }    else        {        mode = 0;        }    break;    case 2:    mode = 2;    break;default:    mode = pspecs->mode;    break;    }if (pspecs->bogus_mode)        /* Linear transformation requested? */    {    mode |= BIT4;              /* Set linear tranformation flag */    }if (pspecs->import_widths)     /* Imported widths requested? */    {    mode |= BIT6;              /* Set imported width flag */    }if (pspecs->clip.left)         /* Clip left requested? */    {    mode |= BIT8;              /* Set clip left flag */    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -