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

📄 xp_pw.c

📁 speech signal process tools
💻 C
📖 第 1 页 / 共 2 页
字号:
/* * This material contains unpublished, proprietary software of  * Entropic Research Laboratory, Inc. Any reproduction, distribution,  * or publication of this work must be authorized in writing by Entropic  * Research Laboratory, Inc., and must bear the notice:  * *    "Copyright (c) 1990-1993 Entropic Research Laboratory, Inc.  *                   All rights reserved" * * The copyright notice above does not evidence any actual or intended  * publication of this source code.      * * Written by:   * Checked by: * Revised by: * * Brief description: * selected pw (xv) calls with hook for xprinter * */static char *sccs_id = "@(#)xp_pw.c	1.1	6/21/93	ERL";#include <xview_private/pw_impl.h>#include <X11/Xlib.h>#include <X11/Xutil.h>#define _NO_PROTO#include <Xp.h>#include <XpMacros.h>Display *global_display = (Display *)NULL;Pkg_private     GC Xp_xv_find_proper_gc();Xv_private int Xp_xv_rop_mpr_internal();Xv_private void Xp_xv_set_gc_op();voidset_pw_display(display)Display *display;{	global_display = display;}Xp_xv_vector(window, x0, y0, x1, y1, op, cms_index)    Xv_opaque       window;    int             op;    register int    x0, y0, x1, y1;    int             cms_index;{    Xv_Drawable_info *info;    Display        *display;    Drawable        d;    GC              gc;    XGCValues	    gcv;    if(global_display == (Display *)NULL) /* call real xv_vector function */       return(xv_vector(window, x0, y0, x1, y1, op, cms_index));    DRAWABLE_INFO_MACRO(window, info);    display = global_display;    d = 0;    gc = XpCreateGC(display, 0, 0, &gcv);    if (op == PIX_NOT(PIX_DST)) {	Xp_xv_set_gc_op(display, info, gc, op, XV_USE_CMS_FG, XV_DEFAULT_FG_BG);    } else {	if (!PIX_OPCOLOR(op)) {	    op |= PIX_COLOR(cms_index);	}	Xp_xv_set_gc_op(display, info, gc, op, XV_USE_OP_FG, XV_DEFAULT_FG_BG);    }    XDrawLine(display, d, gc, x0, y0, x1, y1);    XpFreeGC(display, gc);}#include <xview/window.h>#include <pixrect/pixfont.h>PIXFONT        *xv_pf_sys;extern          xv_pf_ttext(), xv_pf_text();extern struct pr_size xv_pf_textwidth();Xp_xv_ttext(window, xbasew, ybasew, op, pixfont, str)    Xv_opaque       window;    int             op;    register int    xbasew, ybasew;    Xv_opaque       pixfont;    char           *str;{    Xv_Drawable_info *info;    Display        *display;    Drawable        d;    GC              gc;    XID             font;    int             len;    XGCValues	    gcv;fprintf(stderr,"called Xp_xv_ttext\n");exit(1);    if ((len = strlen(str)) == 0) {	return;    }    DRAWABLE_INFO_MACRO(window, info);    if(global_display == (Display *)NULL) {       display = xv_display(info);       d = xv_xid(info);       gc = Xp_xv_find_proper_gc(display, info, PW_TEXT);    } else {       display = global_display;       d = 0;       gc = XpCreateGC(display, 0, 0, &gcv);    }    /* SunView1.X incompatibility: NULL pixfont meant use system_font. */    if (pixfont == 0) {	pixfont = xv_get(window, WIN_FONT);    }    /*     * Since this is transparent text, we always paint it with the background     * color.     */    Xp_xv_set_gc_op(display, info, gc, op, XV_USE_CMS_FG,		 XV_INVERTED_FG_BG);    font = (XID) xv_get(pixfont, XV_XID);    XSetFont(display, gc, font);    XDrawString(display, d, gc, xbasew, ybasew, str, len);    XpFreeGC(display, gc);}Xp_xv_text(window, xbasew, ybasew, op, pixfont, str)    Xv_opaque       window;    int             op;    register int    xbasew, ybasew;    Xv_opaque       pixfont;    char           *str;{    Xv_Drawable_info *info;    Display        *display;    Drawable        d;    GC              gc;    XID             font;    int             len;    XGCValues	    gcv;    XFontStruct     *Xpxfs=NULL;    if(global_display == (Display *)NULL) /* call real xv_text function */       return(xv_text(window, xbasew, ybasew, op, pixfont, str));    DRAWABLE_INFO_MACRO(window, info);    display = global_display;    d = 0;    gc = XpCreateGC(display, 0, 0, &gcv);    Xpxfs = XpLoadQueryFont(display,            "-adobe-helvetica-medium-r-normal--*-0-300-300-p-*-iso8859-1");    if(Xpxfs)             XpSetFont(display,gc,Xpxfs->fid);     else             fprintf(stderr,"cannot get font for graphic export\n");    if ((len = strlen(str)) == 0) {	return;    }    /* SunView1.X incompatibility: NULL pixfont meant use system_font. */    if (pixfont == 0) {	pixfont = xv_get(window, WIN_FONT);    }    if (PIX_OP(op) == PIX_NOT(PIX_SRC)) {	Xp_xv_set_gc_op(display, info, gc, op, 		     PIX_OPCOLOR(op) ? XV_USE_OP_FG : XV_USE_CMS_FG,		     XV_INVERTED_FG_BG);    } else {	Xp_xv_set_gc_op(display, info, gc, op, 		     PIX_OPCOLOR(op) ? XV_USE_OP_FG : XV_USE_CMS_FG,		     XV_DEFAULT_FG_BG);    }    XDrawString(display, d, gc, xbasew, ybasew, str, len);    XpFreeGC(display, gc);}Xv_publicXp_xv_rop(window, x, y, width, height, op, pr, xr, yr)    Xv_opaque       window;    int             op, x, y, width, height;    Pixrect        *pr;    int             xr, yr;{    register Xv_Drawable_info *info;    Display        *display;    Drawable        d;    GC 		    gc;    XGCValues       gcv;    if(global_display == (Display *)NULL) /* call real xv_rop function */       return(xv_rop(window, x, y, width, height, op, pr, xr, yr));    DRAWABLE_INFO_MACRO(window, info);    display = global_display;    d = 0;    gc = XpCreateGC(display, 0, 0, &gcv);    if (pr == NULL) {	Xp_xv_set_gc_op(display, info, gc, op, XV_USE_OP_FG,		     XV_DEFAULT_FG_BG);	XFillRectangle(display, d, gc, x, y, width, height);    } else {	Xp_xv_set_gc_op(display, info, gc, op,		     PIX_OPCOLOR(op) ? XV_USE_OP_FG : XV_USE_CMS_FG,		     XV_DEFAULT_FG_BG);	if (Xp_xv_rop_internal(display, d, gc, x, y, width, height,			    (Xv_opaque) pr, xr, yr, info) == XV_ERROR) {	    xv_error(NULL,		     ERROR_STRING, 		     "xv_rop: xv_rop_internal failed",		     0);	}    }    XpFreeGC(display, gc);}#ifdef __STDC__ #ifndef CAT#define CAT(a,b)        a ## b #endif #endif#include <pixrect/memvar.h>#include <xview_private/cms_impl.h>#include <xview_private/svrim_impl.h>#include <xview_private/i18n_impl.h>int   GC_CHAIN_KEY;#include <xview/xv_xrect.h>#define INVALID_XID		0extern Xv_xrectlist *screen_get_clip_rects();Xv_private voidXp_xv_set_gc_op(display, info, gc, op, fg_mode, fg_bg)    Display        *display;    Xv_Drawable_info *info;    GC              gc;    int             op;    short           fg_mode;    int             fg_bg;{    unsigned long   	value_mask;    XGCValues       	val;    Cms_info         	*cms = CMS_PRIVATE(xv_cms(info));    val.function = XV_TO_XOP(op);    value_mask = GCForeground | GCBackground | GCFunction | GCPlaneMask;    val.plane_mask = xv_plane_mask(info);    if (info->is_bitmap) {		/* restrict bitmap colors to 1 and 0 */	val.foreground = (fg_bg == XV_DEFAULT_FG_BG) ? 1 : 0;	val.background = (fg_bg == XV_DEFAULT_FG_BG) ? 0 : 1;    } else if (fg_mode == XV_USE_OP_FG) {	if (fg_bg == XV_DEFAULT_FG_BG) {	    val.foreground = XV_TO_X_PIXEL(PIX_OPCOLOR(op), cms);	    val.background = xv_bg(info);	} else {	    val.background = XV_TO_X_PIXEL(PIX_OPCOLOR(op), cms);	    val.foreground = xv_bg(info);	}    } else {	if (fg_bg == XV_DEFAULT_FG_BG) {	    val.foreground = xv_fg(info);	    val.background = xv_bg(info);	} else {	    val.background = xv_fg(info);	    val.foreground = xv_bg(info);	}    }    switch (val.function) {      case GXclear:	val.foreground = val.background;	val.function = GXcopy;	break;      case GXset:	val.foreground = xv_fg(info);	val.function = GXcopy;	break;      case GXxor:	val.foreground = val.foreground ^ val.background;	val.background = 0;	break;      case GXinvert:	if (val.foreground == val.background) {	    val.foreground = xv_fg(info);	    val.background = xv_bg(info);	}	val.plane_mask = val.foreground ^ val.background;	break;    }    XChangeGC(display, gc, value_mask, &val);}Xv_private intXp_xv_rop_internal(display, d, gc, x, y, width, height, src, xr, yr, dest_info)    Display        *display;    Drawable        d;    GC              gc;    int             x, y, width, height;    Xv_opaque       src;    int             xr, yr;    Xv_Drawable_info *dest_info;{    Xv_Drawable_info *src_info;    Drawable        src_d;    XGCValues       changes;    unsigned long   changes_mask = 0;    if (width == 0 || height == 0 || !src) {	return (XV_ERROR);    }    /*     * If src is not a client pixrect, it can either be a window or a     * server_image.     */    if (PR_NOT_MPR(((Pixrect *) src))) {	DRAWABLE_INFO_MACRO(src, src_info);	src_d = (Drawable) xv_xid(src_info);

⌨️ 快捷键说明

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