本文整理汇总了C++中ZRect::Size方法的典型用法代码示例。如果您正苦于以下问题:C++ ZRect::Size方法的具体用法?C++ ZRect::Size怎么用?C++ ZRect::Size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZRect
的用法示例。
在下文中一共展示了ZRect::Size方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: theSetupLock
ZRef<ZDCCanvas> ZDCCanvas_X::CreateOffScreen(const ZRect& inCanvasRect)
{
using namespace ZDCPixmapNS;
SetupLock theSetupLock(this);
return new ZDCCanvas_X_OffScreen(fXServer, inCanvasRect.Size(), eFormatEfficient_Color_32);
}
示例2: FrameEllipse
void ZDCCanvas_X::FrameEllipse(ZDCState& ioState, const ZRect& inBounds)
{
if (!fDrawable)
return;
if (!ioState.fInk)
return;
if (ioState.fPenWidth <= 0)
return;
if (inBounds.IsEmpty())
return;
SetupLock theSetupLock(this);
SetupClip theSetupClip(this, ioState);
if (theSetupClip.IsEmpty())
return;
SetupInk theSetupInk(this, ioState);
ZPoint ellipseSize = inBounds.Size();
ZCoord twicePenWidth = ioState.fPenWidth * 2;
if (twicePenWidth >= ellipseSize.h || twicePenWidth >= ellipseSize.v)
{
fXServer->FillArc(fDrawable, fGC,
inBounds.left + ioState.fOrigin.h,
inBounds.top + ioState.fOrigin.v,
ellipseSize.h,
ellipseSize.v,
0, 360*64);
}
else
{
ZCoord halfPenWidth = ioState.fPenWidth / 2;
fXServer->DrawArc(fDrawable, fGC,
inBounds.left + ioState.fOrigin.h + halfPenWidth,
inBounds.top + ioState.fOrigin.v + halfPenWidth,
ellipseSize.h - 2 * halfPenWidth,
ellipseSize.v - 2 * halfPenWidth,
0, 360 * 64);
}
}
示例3: sReadPixmap
static void sReadPixmap(const ZStreamR& inStream, ZDCPixmap& outPixmap)
{
uint16 rowBytes = inStream.ReadUInt16();
if (!(rowBytes & 0x8000))
::sThrowBadFormat();
rowBytes &= 0x7FFF;
ZRect bounds;
bounds.top = inStream.ReadInt16();
bounds.left = inStream.ReadInt16();
bounds.bottom = inStream.ReadInt16();
bounds.right = inStream.ReadInt16();
inStream.ReadInt16(); // version
inStream.ReadInt16(); // packType
inStream.ReadInt32(); // packSize
inStream.ReadInt32(); // hRes
inStream.ReadInt32(); //vRes
short pixelType = inStream.ReadInt16(); // pixelType
short pixelSize = inStream.ReadInt16(); // pixelSize
short cmpCount = inStream.ReadInt16(); // cmpCount
short cmpSize = inStream.ReadInt16(); // cmpSize
inStream.ReadInt32(); // planeBytes
inStream.ReadInt32(); // pmTable
inStream.ReadInt32(); // pmReserved
// We only deal with pixel type of 0 (indexed pixels)
if (pixelType != 0)
::sThrowUnsupportedFormat();
// indexed pixels have a cmpCount of 1
if (cmpCount != 1)
::sThrowBadFormat();
// pixelSize and cmpSize should be equal for indexed pixels
if (pixelSize != cmpSize)
::sThrowBadFormat();
// Next on the stream is the color table
vector<ZRGBColor> theColorTable;
inStream.ReadInt32(); // ctSeed
inStream.ReadInt16(); // ctFlags
short ctSize = inStream.ReadInt16();
for (int i = 0; i <= ctSize; ++i)
{
inStream.ReadInt16(); // colorSpecIndex
ZRGBColor theColor;
theColor.red = inStream.ReadUInt16();
theColor.green = inStream.ReadUInt16();
theColor.blue = inStream.ReadUInt16();
theColorTable.push_back(theColor);
}
// Now we have the source rect
inStream.Skip(8);
// and the destination rect
inStream.Skip(8);
// Penultimately we have the mode
inStream.ReadUInt16();
// The remaining data is the packed pixels. Allocate our ZDCPixmap
// using the size we read in, but with no initialized data.
ZDCPixmap thePixmap(bounds.Size(), ZDCPixmapNS::eFormatEfficient_Color_32);
void* baseAddress = thePixmap.GetBaseAddress();
ZDCPixmapNS::RasterDesc theRasterDesc = thePixmap.GetRasterDesc();
ZDCPixmapNS::PixelDesc thePixelDesc = thePixmap.GetPixelDesc();
::sUnpackFromStream(inStream,
bounds.Width(), bounds.Height(),
rowBytes, pixelSize,
&theColorTable[0], theColorTable.size(),
baseAddress, theRasterDesc, thePixelDesc);
outPixmap = thePixmap;
}
示例4: DrawPixmap
void ZDCCanvas_X::DrawPixmap(ZDCState& ioState, const ZPoint& inLocation, const ZDCPixmap& inSourcePixmap, const ZDCPixmap* inMaskPixmap)
{
if (!fDrawable)
return;
if (!inSourcePixmap)
return;
ZRect realSourceBounds = inSourcePixmap.Size();
ZPoint realLocation = inLocation + ioState.fOrigin;
if (inMaskPixmap)
{
if (!*inMaskPixmap)
return;
SetupLock theSetupLock(this);
ZDCRgn sourceBoundsRgn = ZRect(realSourceBounds.Size());
ZDCRgn realClip = (this->Internal_CalcClipRgn(ioState) - realLocation) & sourceBoundsRgn;
if (realClip.IsEmpty())
return;
// Take a one bit copy of the mask
Pixmap monoPixmap = fXServer->CreateBitmapFromDCPixmap(fDrawable, *inMaskPixmap, realSourceBounds, false);
ZAssert(monoPixmap != None);
// Paint with zeroes the area of the mask that's not part of the clip, if any
if (ZDCRgn inverseClip = sourceBoundsRgn - realClip)
{
XGCValues values;
values.graphics_exposures = 0;
GC monoGC = fXServer->CreateGC(monoPixmap, GCGraphicsExposures, &values);
fXServer->SetRegion(monoGC, inverseClip.GetRegion());
fXServer->SetForeground(monoGC, 0);
fXServer->FillRectangle(monoPixmap, monoGC, 0, 0, realSourceBounds.Width(), realSourceBounds.Height());
fXServer->FreeGC(monoGC);
}
fXServer->SetFunction(fGC, GXcopy);
++fChangeCount_Mode;
fXServer->SetClipMask(fGC, monoPixmap);
fXServer->SetClipOrigin(fGC, realLocation.h, realLocation.v);
++fChangeCount_Clip;
fXServer->DrawDCPixmap(fDrawable, fGC, realLocation, inSourcePixmap, realSourceBounds);
fXServer->SetClipMask(fGC, None);
fXServer->SetClipOrigin(fGC, 0, 0);
fXServer->FreePixmap(monoPixmap);
}
else
{
SetupLock theSetupLock(this);
SetupClip theSetupClip(this, ioState);
if (theSetupClip.IsEmpty())
return;
fXServer->SetFunction(fGC, GXcopy);
++fChangeCount_Mode;
fXServer->DrawDCPixmap(fDrawable, fGC, realLocation, inSourcePixmap, realSourceBounds);
}
}