/*======================================================
FILE: wutil.c
SERVICES: Utility functions for example widgets
GENERAL DESCRIPTION:
Reproduction and/or distribution of this file without the
written consent of QUALCOMM, Incorporated. is prohibited.
Copyright ?1999-2005 QUALCOMM Incorporated.
All Rights Reserved.
QUALCOMM Proprietary/GTDR
=====================================================*/
#include "wutil.h"
#include "AEEStdLib.h"
#include "AEEShell.h"
#include "AEEImage.h"
#include "modres.h"
// RCCOORD without the subtracting one
#define GETCORNERS(prc,l,t,r,b) (l)=(prc)->x,(t)=(prc)->y,(r)=(l)+(prc)->dx,(b)=(t)+(prc)->dy
// extract coordinates of an AEERect
#define RCRIGHT(prc) (((prc)->x) + ((prc)->dx) - 1)
#define RCBOTTOM(prc) (((prc)->y) + ((prc)->dy) - 1)
#define RCCOORD(prc,l,t,r,b) (l)=(prc)->x,(t)=(prc)->y,(r)=RCRIGHT(prc),(b)=RCBOTTOM(prc)
// calculate the intersection of two rectangles
boolean IntersectRectEx(AEERect *prcDest, const AEERect *prcSrc1, const AEERect *prcSrc2)
{
int aleft, atop, aright, abottom; // coordinates of prcSrc1
int bleft, btop, bright, bbottom; // coordinates of prcSrc2
// get the left, top, right, bottom coordinates of each source rect
RCCOORD(prcSrc1, aleft, atop, aright, abottom);
RCCOORD(prcSrc2, bleft, btop, bright, bbottom);
// early rejection test
if (aleft > bright || atop > bbottom || bleft > aright || btop > abottom) {
if (prcDest) {
SETAEERECT(prcDest, 0, 0, 0, 0);
}
return 0; // empty intersection
}
if (prcDest) {
prcDest->x = MAX(aleft, bleft);
prcDest->y = MAX(atop, btop);
prcDest->dx = MIN(aright, bright) - prcDest->x + 1;
prcDest->dy = MIN(abottom, bbottom) - prcDest->y + 1;
}
return 1;
}
/*
|| SubtractRect
||
|| subtraction can only succeed if the result will be a rectangular
|| region. for example, subtracting rectangle 1 from rectangle 2
|| will not result in a rectangular region so the result will be
|| all of rectangle 2. In contrast, subtracting rectangle 3 from
|| rectangle 4 will result in a rectangular result so the result
|| will be rectangle 4 reduced in size, and with the origin
|| offset in the y direction..
||
|| 1 3
|| +---+ +----------+
|| | | 2 | +----+ |
|| | +-|-+ | | | |
|| | | | | - NO +----------+ - YES
|| +---+ | | |
|| | | +----+ 4
|| +---+
||
||
|| returns TRUE if subtraction succeeded
|| with result placed in prcResult
*/
boolean SubtractRect(AEERect *prcResult, const AEERect *prcBase, const AEERect *prcSub)
{
int nEdges = 0;
boolean bLeftEdge = 0;
boolean bRightEdge = 0;
boolean bTopEdge = 0;
boolean bBottomEdge = 0;
int bleft, btop, bright, bbottom; // prcBase coordinates
int sleft, stop, sright, sbottom; // prcSub coordinates
GETCORNERS(prcBase, bleft, btop, bright, bbottom);
GETCORNERS(prcSub, sleft, stop, sright, sbottom);
// count which base rect edges fall between the sub rect edges
if (BETWEEN(bleft, sleft, sright+1)) {
bLeftEdge = 1;
nEdges++;
}
if (BETWEEN(bright, sleft, sright+1)) {
bRightEdge = 1;
nEdges++;
}
if (BETWEEN(btop, stop, sbottom+1)) {
bTopEdge = 1;
nEdges++;
}
if (BETWEEN(bbottom, stop, sbottom+1)) {
bBottomEdge = 1;
nEdges++;
}
// empty rect result
if (nEdges == 4) {
// set result to empty rect
bleft = bright = btop = bbottom = 0;
} else if (nEdges == 3) {
if (!bTopEdge) {
bbottom = stop;
}
if (!bBottomEdge) {
btop = sbottom;
}
if (!bLeftEdge) {
bright = sleft;
}
if (!bRightEdge) {
bleft = sright;
}
}
SETAEERECT(prcResult, bleft, btop, bright-bleft, bbottom-btop);
return (boolean)(nEdges > 2);
}
/* returns FALSE if either source rectangle is empty */
void UnionRect(AEERect *prcResult, const AEERect *prcSrc1, const AEERect *prcSrc2)
{
int aleft, atop, aright, abottom; // coordinates of prcSrc1
int bleft, btop, bright, bbottom; // coordinates of prcSrc2
// get the left, top, right, bottom coordinates of each source rect
GETCORNERS(prcSrc1, aleft, atop, aright, abottom);
GETCORNERS(prcSrc2, bleft, btop, bright, bbottom);
prcResult->x = MIN(aleft, bleft);
prcResult->dx = MAX(aright, bright) - prcResult->x;
prcResult->y = MIN(atop, btop);
prcResult->dy = MAX(abottom, bbottom) - prcResult->y;
}
// origin constants for DrawStairStep
#define DSSO_LEFT 0
#define DSSO_RIGHT 1
#define DSSO_TOP 0
#define DSSO_BOTTOM 2
#define DSSO_BOTTOM_LEFT (DSSO_BOTTOM|DSSO_LEFT) // origin in bottom/left of rectangle
#define DSSO_BOTTOM_RIGHT (DSSO_BOTTOM|DSSO_RIGHT) // origin in bottom/right...
#define DSSO_TOP_LEFT (DSSO_TOP|DSSO_LEFT) // ...
#define DSSO_TOP_RIGHT (DSSO_TOP|DSSO_RIGHT) // ...
/* fill a rectangle with a stairstep pattern starting from origin
and working to opposite corner with step height always increasing
x x
DSSO_BOTTOM_LEFT xx xx DSSO_BOTTOM_RIGHT
(origin) --> xxx xxx <-- (origin)
(origin) --> xxx xxx <-- (origin)
DSSO_TOP_LEFT xx xx DSSO_TOP_RIGHT
x x
*/
static
void DrawStairStep(IDisplay *piDisplay, AEERect *prc, int nDSSOrigin, RGBVAL rgb, uint8 nAlpha)
{
int xOrigin, yOrigin;
AEERect rc;
int i;
xOrigin = prc->x;
if (nDSSOrigin & DSSO_RIGHT) {
xOrigin += prc->dx-1;
}
yOrigin = prc->y;
if (nDSSOrigin & DSSO_BOTTOM) {
yOrigin += prc->dy-1;
}
SETAEERECT(&rc, xOrigin, yOrigin, 1, 1);
for (i=0; i < prc->dx; i++) {
// IDISPLAY_DrawRect(piDisplay, &rc, RGB_NONE, rgb, IDF_RECT_FILL);
BlendRect(piDisplay, &rc, RGBA_STRIPALPHA(rgb), nAlpha);
rc.dy++;
if (nDSSOrigin & DSSO_RIGHT) {
rc.x--;
} else {
rc.x++;
}
if (nDSSOrigin & DSSO_BOTTOM) {
rc.y--;
}
}
}
void DrawAndInsetBorderEx(IDisplay *piDisplay, AEERect *prc, int nInset, int nThick, RGBVAL rgb, uint8 nAlpha, boolean bBeveled)
{
AEERect rc;
AEERect rco = *prc; // outer rectangle
nThick = MIN(nThick, nInset); // dont' allow nThick to exceed nInset
INFLATERECT(prc, -nInset, -nInset);
nInset -= nThick;
INFLATERECT(&rco, -nInset, -nInset);
rc.x = bBeveled ? prc->x : rco.x;
rc.y = rco.y;
rc.dx = bBeveled ? prc->dx : rco.dx;
rc.dy = nThick;
BlendRect(piDisplay, &rc, rgb, nAlpha);
rc.y += prc->dy + nThick;
BlendRect(piDisplay, &rc, rgb, nAlpha);
rc.x = rco.x;
// rc.y = bBeveled ? prc->y : rco.y;
rc.y = prc->y;
rc.dx = nThick;
// rc.dy = bBeveled ? prc->dy : rco.dy;
rc.dy = prc->dy;
BlendRect(piDisplay, &rc, rgb, nAlpha);
rc.x += prc->dx + nThick;
BlendRect(piDisplay, &rc, rgb, nAlpha);
///////////////////////////
// draw beveled corners
///////////////////////////
if (bBeveled) {
SETAEERECT(&rc, rco.x+1, rco.y+1, nThick-1, nThick-1);
DrawStairStep(piDisplay, &rc, DSSO_BOTTOM_LEFT, rgb, nAlpha);
rc.x += (prc->dx + rc.dx);
DrawStairStep(piDisplay, &rc, DSSO_BOTTOM_RIGHT, rgb, nAlpha);
rc.x = rco.x+1;
rc.y += (prc->dy + rc.dy);
DrawStairStep(piDisplay, &rc, DSSO_TOP_LEFT, rgb, nAlpha);
rc.x += (prc->dx + rc.dx);
DrawStairStep(piDisplay, &rc, DSSO_TOP_RIGHT, rgb, nAlpha);
}
}
/* Rounded Corners
To perform the SIN operation to dra
没有合适的资源?快使用搜索试试~ 我知道了~
buiw.rar_buiw
共267个文件
h:110个
bid:94个
c:60个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 8 浏览量
2022-09-19
15:37:14
上传
评论
收藏 675KB RAR 举报
温馨提示
BUIW 的代码,包括基础widget的实现
资源推荐
资源详情
资源评论
收起资源包目录
buiw.rar_buiw (267个子文件)
gencfg.bat 158B
AEECLSID_ROOTCONTAINER.bid 300B
AEECLSID_PROPCONTAINER.bid 299B
AEEIID_PROPCONTAINER.bid 293B
AEEIID_ROOTCONTAINER.bid 286B
AEECLSID_RESFILE.bid 234B
AEEIID_RESFILE.bid 217B
AEECLSID_SCROLLINDICATORWIDGET.bid 192B
AEECLSID_POPUPMENUFORM_SCROLL.bid 186B
AEECLSID_CONSTRAINTCONTAINER.bid 184B
AEECLSID_DRAWDECORATORWIDGET.bid 184B
AEECLSID_IMAGESTATICWIDGET.bid 176B
AEEIID_CONSTRAINTCONTAINER.bid 176B
AEECLSID_SCROLLBARWIDGET.bid 168B
AEECLSID_LISTFORM_SCROLL.bid 166B
AEECLSID_VIEWPORTWIDGET.bid 164B
AEECLSID_TEXTCONTROLLER.bid 164B
AEECLSID_INTERFACEMODEL.bid 164B
AEECLSID_PROGRESSWIDGET.bid 164B
AEECLSID_PROGRESSDIALOG.bid 162B
AEECLSID_SOFTKEYWIDGET.bid 160B
AEECLSID_CARDCONTAINER.bid 160B
AEECLSID_DISPLAYCANVAS.bid 160B
AEECLSID_CURRENTLOCALE.bid 159B
AEECLSID_POPUPMENUFORM.bid 158B
AEECLSID_HFONT_OUTLINE.BID 158B
AEECLSID_FONTBIDIUTIL.bid 156B
AEECLSID_CURSORWIDGET.bid 156B
AEEIID_INTERFACEMODEL.bid 156B
AEECLSID_SLIDERWIDGET.bid 156B
AEECLSID_STATICWIDGET.bid 156B
AEECLSID_BITMAPWIDGET.bid 156B
AEECLSID_BORDERWIDGET.bid 156B
AEECLSID_CARETWIDGET.bid 152B
AEECLSID_RADIOWIDGET.bid 152B
AEEIID_CARDCONTAINER.bid 152B
AEECLSID_XYCONTAINER.bid 152B
AEECLSID_CHECKWIDGET.bid 152B
AEECLSID_VECTORMODEL.bid 152B
AEEIID_DISPLAYCANVAS.bid 152B
AEECLSID_BLENDWIDGET.bid 152B
AEECLSID_TITLEWIDGET.bid 152B
AEEIID_GRIDCONTAINER.bid 152B
AEECLSID_IMAGEWIDGET.bid 152B
AEECLSID_ERRORDIALOG.bid 150B
AEEIID_POPUPMENUFORM.bid 150B
AEEIID_TEXTFORMATTER.BID 150B
AEECLSID_PICKWIDGET.bid 148B
AEECLSID_GRIDWIDGET.bid 148B
AEECLSID_VALUEMODEL.bid 148B
AEECLSID_DATEWIDGET.bid 148B
AEECLSID_ARRAYMODEL.bid 148B
AEECLSID_LISTWIDGET.bid 148B
AEECLSID_TEXTWIDGET.bid 148B
AEECLSID_INFODIALOG.bid 146B
AEECLSID_DIALOGFORM.bid 146B
AEECLSID_WARNDIALOG.bid 146B
AEECLSID_LOCALEENUS.BID 146B
AEEIID_DRAWHANDLER.BID 145B
AEEIID_XYCONTAINER.bid 144B
AEECLSID_TABWIDGET.bid 144B
AEECLSID_TEXTMODEL.bid 144B
AEEIID_VECTORMODEL.bid 144B
AEECLSID_MENUMODEL.bid 144B
AEECLSID_JULIANTIMEWIDGET.BID 143B
AEECLSID_JULIANDATEWIDGET.bid 143B
AEECLSID_POPUPFORM.bid 142B
AEECLSID_OEMLOCALE.bid 141B
AEEIID_VALUEMODEL.bid 140B
AEEIID_CONTROLLER.bid 140B
AEEIID_TRANSITION.bid 140B
AEEIID_ARRAYMODEL.bid 140B
AEECLSID_ROOTFORM.bid 138B
AEECLSID_LISTFORM.bid 138B
AEEIID_DECORATOR.bid 136B
AEEIID_CONTAINER.bid 136B
AEEIID_TEXTMODEL.bid 136B
AEEIID_LISTMODEL.bid 136B
AEEIID_MENUMODEL.bid 136B
AEECLSID_GRIDCONTAINER.bid 133B
AEECLSID_TEXTFORMATTER.bid 133B
AEECLSID_CANVAS.bid 132B
AEEIID_ROOTFORM.bid 130B
AEEIID_HANDLER.bid 128B
AEECLSID_MOVER.bid 128B
AEECLSID_MODEL.bid 128B
AEECLSID_FADER.bid 128B
AEEIID_WIDGET.bid 124B
AEEIID_CANVAS.bid 124B
AEECLSID_FORM.bid 122B
AEEIID_LOCALE.BID 122B
AEECLSID_TIMEWIDGET.bid 121B
AEEIID_MODEL.bid 120B
AEEIID_HFONT.BID 118B
AEEIID_FORM.bid 114B
wutil.c 72KB
ListWidget.c 58KB
TextFormatter.c 52KB
Border.c 46KB
ScrollWidget.c 46KB
共 267 条
- 1
- 2
- 3
资源评论
林当时
- 粉丝: 97
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功