本文整理汇总了C++中JRect::IsEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ JRect::IsEmpty方法的具体用法?C++ JRect::IsEmpty怎么用?C++ JRect::IsEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JRect
的用法示例。
在下文中一共展示了JRect::IsEmpty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: r
//.........这里部分代码省略.........
{
if (itsFirstDrawIndex == 1 && i == count && r.right <= ap.right)
{
break;
}
itsCanScrollDownFlag = JI2B( itsFirstDrawIndex < count );
itsLastDrawIndex = i;
if (r.right > ap.right - scrollArrowWidth && i > itsFirstDrawIndex)
{
itsLastDrawIndex--;
}
break;
}
r.left = r.right;
}
}
else if (itsEdge == kRight)
{
JRect r(ap.top + kSelMargin, ap.right - kSelMargin - tabHeight,
ap.top + kSelMargin, ap.right - kSelMargin);
for (JIndex i=itsFirstDrawIndex; i<=count; i++)
{
const JString* title = itsTitles->NthElement(i);
const JBoolean isSel = JI2B(hasSelection && i == selIndex);
const TabInfo info = itsTabInfoList->GetElement(i);
r.bottom += 2*kBorderWidth + info.preMargin + info.postMargin + p.GetStringWidth(*title);
if (info.closable)
{
r.bottom += kCloseMarginWidth + itsCloseImage->GetWidth();
}
JPoint titlePt(r.right - kBorderWidth - kTextMargin,
r.top + kBorderWidth + info.preMargin);
if (isSel)
{
// titlePt.x += kSelMargin;
r.right += kSelMargin;
r.Expand(0, kSelMargin);
selRect = r;
}
if (isSel)
{
p.SetPenColor(cmap->GetGrayColor(kSelGrayPercentage));
p.SetFilling(kJTrue);
p.JPainter::Rect(r);
p.SetFilling(kJFalse);
}
else
{
DrawTabBorder(p, r, kJFalse);
}
p.JPainter::String(-90, titlePt, *title);
itsTabRects->AppendElement(r);
if (isSel)
{
r.right -= kSelMargin;
r.Shrink(0, kSelMargin);
}
r.Shrink(kBorderWidth, kBorderWidth);
DrawTab(i, p, r, itsEdge);
DrawCloseButton(i, p, r);
r.Expand(kBorderWidth, kBorderWidth);
if (r.bottom >= ap.bottom - scrollArrowWidth)
{
if (itsFirstDrawIndex == 1 && i == count && r.bottom <= ap.bottom)
{
break;
}
itsCanScrollDownFlag = JI2B( itsFirstDrawIndex < count );
itsLastDrawIndex = i;
if (r.bottom > ap.bottom - scrollArrowWidth && i > itsFirstDrawIndex)
{
itsLastDrawIndex--;
}
break;
}
r.top = r.bottom;
}
}
JRect r = itsCardFile->GetFrame();
r.Expand(kBorderWidth, kBorderWidth);
JXDrawUpFrame(p, r, kBorderWidth);
if (!selRect.IsEmpty())
{
DrawTabBorder(p, selRect, kJTrue);
}
DrawScrollButtons(p, lineHeight);
}
示例2: if
void
JXImage::JXImageFromDrawable
(
JXDisplay* display,
JXColormap* colormap,
Drawable source,
const JRect& origRect
)
{
JXImageX(display, colormap);
JRect rect = origRect;
{
Window rootWindow;
int x,y;
unsigned int w,h, bw, depth;
XGetGeometry(*itsDisplay, source, &rootWindow, &x, &y, &w, &h, &bw, &depth);
itsDepth = depth;
if (rect.IsEmpty())
{
SetDimensions(w,h);
rect = GetBounds();
}
}
itsPixmap = XCreatePixmap(*itsDisplay, itsDisplay->GetRootWindow(),
GetWidth(), GetHeight(), itsDepth);
assert( itsPixmap != None );
if (itsDepth != itsDisplay->GetDepth())
{
itsGC = new JXGC(itsDisplay, itsColormap, itsPixmap);
assert( itsGC != NULL );
}
(GetGC())->CopyPixels(source, rect.left, rect.top,
rect.width(), rect.height(), itsPixmap, 0,0);
// register the colors that are used in the drawable
const JBoolean needRegister =
JConvertToBoolean( itsDepth > 1 && !itsColormap->AllColorsPreallocated() );
if (needRegister && itsColormap->GetVisualClass() == DirectColor)
{
// With DirectColor, there could be just as many colors as pixels,
// so we actually waste time (and memory!) by building a list of
// X pixel values before converting them to JColorIndices.
ConvertToImage();
const JCoordinate w = GetWidth();
const JCoordinate h = GetHeight();
for (JCoordinate y=0; y<=h; y++)
{
for (JCoordinate x=0; x<=w; x++)
{
JColorIndex color;
const unsigned long xPixel = XGetPixel(itsImage, x,y);
itsColormap->AllocateStaticColor(xPixel, &color);
RegisterColor(color, kJFalse);
}
}
}
else if (needRegister) // using PseudoColor => small # of X pixels
{
// By building a list of unique X pixel values and then converting
// each once, we reduce O(W H (alloc)) to O(W H) + O(P (alloc)),
// where W=width, H=height, P=# of distinct pixels in Drawable.
// Typically, W*H is much larger than P. Alloc usually requires
// a server call.
JIndex i;
// build boolean array telling which X pixel values are used
ConvertToImage();
const JSize maxColorCount = itsColormap->GetMaxColorCount();
char* pixelUsed = new char [ maxColorCount ];
assert( pixelUsed != NULL );
for (i=0; i<maxColorCount; i++)
{
pixelUsed[i] = 0;
}
const JCoordinate w = GetWidth();
const JCoordinate h = GetHeight();
for (JCoordinate y=0; y<=h; y++)
{
for (JCoordinate x=0; x<=w; x++)
{
const unsigned long xPixel = XGetPixel(itsImage, x,y);
assert( xPixel < maxColorCount );
pixelUsed [ xPixel ] = 1;
}
}
// register each X pixel value that is used
//.........这里部分代码省略.........