本文整理汇总了C++中JRect::shrinkBy方法的典型用法代码示例。如果您正苦于以下问题:C++ JRect::shrinkBy方法的具体用法?C++ JRect::shrinkBy怎么用?C++ JRect::shrinkBy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JRect
的用法示例。
在下文中一共展示了JRect::shrinkBy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update
void JBtnObj::update(JGraphics g, double dx, double dy, JRegion& rgn, double scale) {
JRect rect = getIExtent(dx, dy, scale), thumb;
JRegion frgn(rect.shrinkBy(depth, depth));
if ((rect.width > 0) && (rect.height > 0)) {
g.setJColor(bkgnd);
g.fillJRect(rect);
thumb = rect.shrink(depth, depth);
if ((thumb.width > 0) && (thumb.height > 0)) {
switch (type) {
case TYPE_RECT:
g.draw3DJRect(thumb, ((value) ? -depth : depth));
break;
case TYPE_LEFT:
case TYPE_RIGHT:
case TYPE_UP:
case TYPE_DOWN:
g.draw3DJTriangle(thumb,
((value) ? -depth : depth), type-1);
break;
}
if (label.length()) {
g.setJColor(color);
drawText(g, label, thumb.shrink(depth, depth));
}
}
}
}
示例2: getIExtent
void J1DMObj::paint(JGraphics g, double dx, double dy, JRegion& rgn, double scale) {
JRect rect = getIExtent(dx, dy, scale);
g.setJColor(moduleColor);
if ((rect.width > depth2) && (rect.height > depth2)) {
g.draw3DJRect(rect, depth);
g.fillJRect(rect.shrinkBy(depth, depth));
// g.draw3DJRect(rect.shrink(depth, depth), -1);
} else g.fillJRect(rect);
update(g, dx, dy, rgn, scale);
}
示例3: frgn
void J1DSliderObj::update(JGraphics g, double dx, double dy, JRegion& rgn, double scale) {
int dt = depth2+2;
JRect rect = getIExtent(dx, dy, scale);
if ((rect.width > dt) && (rect.height > dt)) {
int oldv = value;
JRect clip = rect, thumb;
JRegion frgn(clip.shrinkBy(depth+1, depth+1));
if (type == HORIZONTAL) {
int len = rect.width-dt-dt;
if (oldf != factor) {
oldf = factor;
fraction = (factor*rect.width-dt)/len;
fraction = max(0.0, min(1.0, fraction));
}
int pos = (int)JMath::round(fraction*len);
thumb = JRect(clip.x+pos, clip.y, dt, clip.height);
} else {
int len = rect.height-dt-dt;
if (oldf != factor) {
oldf = factor;
fraction = (factor*rect.height-dt)/len;
fraction = max(0.0, min(1.0, fraction));
}
int pos = (int)JMath::round((1.0-fraction)*len);
thumb = JRect(clip.x, clip.y+pos, clip.width, dt);
}
int vmin = getMin();
value = (int)JMath::round(fraction*(getMax()-vmin)+vmin);
if (value != oldv) broadcast(0);
g.setJColor(color);
g.fill3DJRect(thumb, depth);
g.setJRegion((frgn & rgn)-JRegion(thumb));
g.setJColor(bkgnd);
g.fillJRect(clip);
g.setJRegion(rgn);
}
}