📄 bits8.c
字号:
/*************************************************************************/
/* */
/* Copyright (c) 1997 - 1999 Accelerated Technology, Inc. */
/* */
/* PROPRIETARY RIGHTS of Accelerated Technology are involved in the */
/* subject matter of this material. All manufacturing, reproduction, */
/* use, and sales rights pertaining to this subject matter are governed */
/* by the license agreement. The recipient of this software implicitly */
/* accepts the terms of the license. */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* FILE NAME VERSION */
/* */
/* BITS8.c 1.9 */
/* */
/* COMPONENT */
/* */
/* All */
/* */
/* DESCRIPTION */
/* */
/* This file contains the SCROLLRECT function. */
/* */
/* AUTHOR */
/* */
/* Robert G. Burrill, Accelerated Technology, Inc. */
/* */
/* DATA STRUCTURES */
/* */
/* None */
/* */
/* FUNCTIONS */
/* */
/* None */
/* */
/* DEPENDENCIES */
/* */
/* None */
/* */
/* HISTORY */
/* */
/* NAME DATE REMARKS */
/* */
/* BobB 5/5/98 Corrected to get rid of compiler */
/* warnings */
/* */
/*************************************************************************/
#include "meta_wnd.h"
#include "metconst.h" /* MetaWINDOW Constant & Stucture Definitions */
#include "metports.h" /* MetaWINDOW Port & Bitmap Definitions */
#include "metaproc.h"
#include "grafdata.h"
#include "metmacs3.h"
/* Function ScrollRect moves the images bits contained in rectangle "R" a
distance (DX,DY) within the current port. Bits that are shifted beyond the
current clipping limits are lost. The port's background pattern (.bkPat) is
used to fill the area voided by the rectangle move.
The blit is peformed by calling the self 2 self blitter, the background
rect(s) are likewise filled by direct primitive calls. */
void ScrollRect( rect *areaR, short valDX, short valDY )
{
/* BobB 5/5/98 - added following two lines to get rid of warnings */
int InceptRect( rect * R1 , rect * R2 , rect * dstR );
int ShiftRect( rect *R , int dltX, int dltY, rect *R1, rect *R2);
short ddx; /* DX */
short ddy; /* DY */
rect cR; /* Clipping rectangle */
rect tempAreaR;
int voids; /* number of background fills required */
struct _rectlist1 /* source/dest rectangles */
{
rect srcR;
rect dR;
} srcdstRect;
struct _rectlist2 /* void rectangles */
{
rect R1;
rect R2;
} voidRect;
tempAreaR = *areaR;
cR = ViewClip; /* cR := viewRect */
if (globalLevel > 0)
{
/* convert from user to global */
U2GR(tempAreaR, &srcdstRect.srcR, 0);
}
else
{
srcdstRect.srcR = tempAreaR; /* update global rectangle */
}
/* Check to see how much is off the bitmap. If it's all off, leave */
if (!(InceptRect(&srcdstRect.srcR, &cR, &srcdstRect.dR))) return;
srcdstRect.srcR = srcdstRect.dR; /* srcR = dR */
ddx = valDX; /* Convert deltas to global */
ddy = valDY;
if (!(grafPort.portFlags & pfUpper)) ddy = -ddy; /* if lower origin,
direction is reversed */
if (grafPort.portFlags & pfVirtual)
{
V2GSIZE(ddx, ddy, &ddx, &ddy); /* Virtual To Global size */
}
voids = ShiftRect(&srcdstRect.dR, ddx, ddy, &voidRect.R1, &voidRect.R2);
if (voids == 0) return; /* its a no-op, leave */
/* Set up for blit */
grafBlit.blitFore = 1; /* on monochrome - so no color xlate */
grafBlit.blitBack = 0; /* occurs, set pen and back to identity */
grafBlit.blitRop = 0; /* grafBlit.blitRop = zREPz */
grafBlit.blitList = (long) &srcdstRect; /*blitRec.blitList = &blitData */
/* Do the blit. By definition, uses the current grafPort & self2self blit */
grafBlit.blitSmap = grafBlit.blitDmap;
(grafBlit.blitSmap->prBlitSS)(&grafBlit);
/* Set up blitRcd for background fills */
grafBlit.blitFore = grafPort.pnColor; /* due to mono case - */
grafBlit.blitBack = grafPort.bkColor; /* restore pen and back */
grafBlit.blitPat = grafPort.bkPat; /* doing background pattern */
grafBlit.blitList = (long) &voidRect; /* blitRec.blitList = &blitData */
grafBlit.blitCnt = voids; /* fill the void(s) */
(grafBlit.blitDmap->prFill)(&grafBlit);
/* restore blitrcd */
grafBlit.blitRop = grafPort.pnMode;
grafBlit.blitPat = grafPort.pnPat;
grafBlit.blitList = (long) &grafBlist;
grafBlit.blitCnt = 1;
return;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -