本文整理汇总了C++中ZRect::Height方法的典型用法代码示例。如果您正苦于以下问题:C++ ZRect::Height方法的具体用法?C++ ZRect::Height怎么用?C++ ZRect::Height使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZRect
的用法示例。
在下文中一共展示了ZRect::Height方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
bool ZRect::operator<(const ZRect &rhs) const
{
//< is the one that is closer to top corner (as a whole)//
if(rY < rhs.Y()) //check Ys
return true;
else if(rY > rhs.Y())
return false;
else
{
if(rX < rhs.X()) //check Xs
return true;
else if(rX > rhs.X())
return false;
else
{
if(rHeight < rhs.Height()) //check heights
return true;
else if(rHeight > rhs.Height())
return false;
else
{
if(rWidth < rhs.Width()) //check widths
return true;
else if(rWidth > rhs.Width())
return false;
else
return false; //nothing left to check, they are ==
}
}
}
}
示例2: CopyFrom
void ZDCCanvas_X_NonWindow::CopyFrom(ZDCState& ioState, const ZPoint& inDestLocation, ZRef<ZDCCanvas> inSourceCanvas, const ZDCState& inSourceState, const ZRect& inSourceRect)
{
ZRef<ZDCCanvas_X> sourceCanvasX = ZRefDynamicCast<ZDCCanvas_X>(inSourceCanvas);
ZAssertStop(kDebug_X, sourceCanvasX != nil);
if (!fDrawable || !sourceCanvasX->Internal_GetDrawable())
return;
SetupLock theSetupLock(this);
// We can (currently) only copy from one drawable to another if they're on the same display
// ZAssertStop(kDebug_X, fXServer == sourceCanvasX->fXServer);
ZRect destRect = inSourceRect + (ioState.fOrigin + inDestLocation - inSourceRect.TopLeft());
ZRect sourceRect = inSourceRect + inSourceState.fOrigin;
ZDCRgn realClip = this->Internal_CalcClipRgn(ioState);
fXServer->SetRegion(fGC, realClip.GetRegion());
++fChangeCount_Clip;
fXServer->SetFunction(fGC, GXcopy);
++fChangeCount_Mode;
fXServer->CopyArea(sourceCanvasX->Internal_GetDrawable(), fDrawable, fGC,
sourceRect.Left(), sourceRect.Top(),
sourceRect.Width(), sourceRect.Height(),
destRect.Left(), destRect.Top());
}
示例3: Scroll
void ZDCCanvas_X_NonWindow::Scroll(ZDCState& ioState, const ZRect& inRect, ZCoord hDelta, ZCoord vDelta)
{
if (!fDrawable)
return;
SetupLock theSetupLock(this);
++fChangeCount_Clip;
ZPoint offset(hDelta, vDelta);
// destRgn is the pixels we want and are able to draw to.
ZDCRgn destRgn = ((ioState.fClip + ioState.fClipOrigin) & (inRect + ioState.fOrigin));
// srcRgn is the set of pixels we're want and are able to copy from.
ZDCRgn srcRgn = ((destRgn - offset) & (inRect + ioState.fOrigin));
// drawnRgn is the destination pixels that will be drawn by the CopyBits call, it's the srcRgn
// shifted back to the destination.
ZDCRgn drawnRgn = srcRgn + offset;
// invalidRgn is the destination pixels we wanted to draw but could not because they were
// outside the visRgn, or were in the excludeRgn
ZDCRgn invalidRgn = destRgn - drawnRgn;
// And set the clip (drawnRgn)
fXServer->SetRegion(fGC, drawnRgn.GetRegion());
++fChangeCount_Clip;
fXServer->SetFunction(fGC, GXcopy);
++fChangeCount_Mode;
ZRect drawnBounds = drawnRgn.Bounds();
fXServer->CopyArea(fDrawable, fDrawable, fGC,
drawnBounds.Left() - offset.h, drawnBounds.Top() - offset.v,
drawnBounds.Width(), drawnBounds.Height(),
drawnBounds.Left(), drawnBounds.Top());
}
示例4: Imp_Write
void ZDCPixmapEncoder_GIF::Imp_Write(const ZStreamW& iStream,
const void* iBaseAddress,
const ZDCPixmapNS::RasterDesc& iRasterDesc,
const ZDCPixmapNS::PixelDesc& iPixelDesc,
const ZRect& iBounds)
{
ZRef<ZDCPixmapNS::PixelDescRep_Indexed> thePixelDescRep_Indexed
= ZRefDynamicCast<ZDCPixmapNS::PixelDescRep_Indexed>(iPixelDesc.GetRep());
ZAssertStop(2, thePixelDescRep_Indexed);
if (fTransparent)
iStream.WriteString("GIF89a");
else
iStream.WriteString("GIF87a");
iStream.WriteUInt16LE(iBounds.Width());
iStream.WriteUInt16LE(iBounds.Height());
uint8 globalStrmFlags = 0;
globalStrmFlags |= 0x80; // hasGlobalColorTable
globalStrmFlags |= 0x70; // colorResolution (8 bits per component)
// globalStrmFlags |= 0x08; // set this if the color table is sorted in priority order
ZAssertStop(2, iRasterDesc.fPixvalDesc.fDepth > 0 && iRasterDesc.fPixvalDesc.fDepth <= 8);
globalStrmFlags |= iRasterDesc.fPixvalDesc.fDepth - 1; // globalColorTableSize & depth
iStream.WriteUInt8(globalStrmFlags);
iStream.WriteUInt8(0); // backgroundColorIndex
iStream.WriteUInt8(0); // Pixel aspect ratio -- 0 == none specified.
const ZRGBColorPOD* theColors;
size_t theColorsCount;
thePixelDescRep_Indexed->GetColors(theColors, theColorsCount);
sWriteColorTable(iStream, theColors, theColorsCount, 1 << iRasterDesc.fPixvalDesc.fDepth);
if (fTransparent)
{
iStream.WriteUInt8('!'); // Extension block
iStream.WriteUInt8(0xF9); // Graphic Control Extension
iStream.WriteUInt8(4); // Block size
// The next byte encodes four fields:
// 3 bits, Reserved == 0
// 3 bits, Disposal Method == none (0),
// 1 bit, User Input Flag == none (0)
// 1 bit, Transparent Color Flag = yes (1)
iStream.WriteUInt8(1);
iStream.WriteUInt16LE(0); // Delay time
iStream.WriteUInt8(fTransparentPixval);
iStream.WriteUInt8(0); // Block terminator
}
iStream.WriteUInt8(','); // Start of image
iStream.WriteUInt16LE(0); // Origin h
iStream.WriteUInt16LE(0); // Origin v
iStream.WriteUInt16LE(iBounds.Width());
iStream.WriteUInt16LE(iBounds.Height());
uint8 localStrmFlags = 0;
// localStrmFlags |= 0x80; // hasLocalColorTable
if (fInterlace)
localStrmFlags |= 0x40; // interlaced
// localStrmFlags |= 0x20; // sorted
// localStrmFlags |= 0x70; // localColorTableSize
iStream.WriteUInt8(localStrmFlags);
iStream.WriteUInt8(iRasterDesc.fPixvalDesc.fDepth); // Initial code size.
{ // Scope theSC.
StreamW_Chunk theSC(iStream);
ZStreamW_LZWEncode* theSLZW = nil;
ZStreamW_LZWEncodeNoPatent* theSLZWNP = nil;
ZStreamW* theStream;
if (fNoPatent)
{
theSLZWNP = new ZStreamW_LZWEncodeNoPatent(iRasterDesc.fPixvalDesc.fDepth, theSC);
theStream = theSLZWNP;
}
else
{
theSLZW = new ZStreamW_LZWEncode(iRasterDesc.fPixvalDesc.fDepth, theSC);
theStream = theSLZW;
}
ZDCPixmapNS::PixvalDesc destPixvalDesc(8, true);
vector<uint8> theRowBufferVector(iBounds.Width());
void* theRowBuffer = &theRowBufferVector[0];
try
{
if (fInterlace)
{
for (int pass = 0; pass < 4; ++pass)
{
for (ZCoord currentY = iBounds.top + sInterlaceStart[pass];
currentY < iBounds.bottom; currentY += sInterlaceIncrement[pass])
{
const void* sourceRowAddress
//.........这里部分代码省略.........
示例5: 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;
}
示例6: rEngine
ZRect::ZRect(const ZRect &rhs) :
rEngine(ZEngine::GetInstance()),
rX(rhs.X()),rY(rhs.Y()),rWidth(rhs.Width()),rHeight(rhs.Height())
{
}
示例7: 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);
}
}
示例8: FillEllipse
void ZDCCanvas_X::FillEllipse(ZDCState& ioState, const ZRect& inBounds)
{
if (!fDrawable)
return;
if (!ioState.fInk)
return;
if (inBounds.IsEmpty())
return;
SetupLock theSetupLock(this);
SetupClip theSetupClip(this, ioState);
if (theSetupClip.IsEmpty())
return;
SetupInk theSetupInk(this, ioState);
fXServer->FillArc(fDrawable, fGC, inBounds.left + ioState.fOrigin.h, inBounds.top + ioState.fOrigin.v, inBounds.Width(), inBounds.Height(), 0, 360*64);
}
示例9: InvertEllipse
void ZDCCanvas_X::InvertEllipse(ZDCState& ioState, const ZRect& inBounds)
{
if (!fDrawable)
return;
if (inBounds.IsEmpty())
return;
SetupLock theSetupLock(this);
SetupClip theSetupClip(this, ioState);
if (theSetupClip.IsEmpty())
return;
fXServer->SetFunction(fGC, GXinvert);
++fChangeCount_Mode;
fXServer->FillArc(fDrawable, fGC, inBounds.left + ioState.fOrigin.h, inBounds.top + ioState.fOrigin.v, inBounds.Width(), inBounds.Height(), 0, 360*64);
}
示例10: InvertRegion
void ZDCCanvas_X::InvertRegion(ZDCState& ioState, const ZDCRgn& inRgn)
{
if (!fDrawable)
return;
SetupLock theSetupLock(this);
if (ZDCRgn localRgn = this->Internal_CalcClipRgn(ioState) & (inRgn + ioState.fOrigin))
{
ZRect localBounds = localRgn.Bounds();
fXServer->SetRegion(fGC, localRgn.GetRegion());
++fChangeCount_Clip;
fXServer->SetFunction(fGC, GXinvert);
++fChangeCount_Mode;
fXServer->FillRectangle(fDrawable, fGC, localBounds.left, localBounds.top, localBounds.Width(), localBounds.Height());
}
}
示例11: FrameRegion
void ZDCCanvas_X::FrameRegion(ZDCState& ioState, const ZDCRgn& inRgn)
{
if (!fDrawable)
return;
if (!ioState.fInk)
return;
if (ioState.fPenWidth <= 0)
return;
SetupLock theSetupLock(this);
if (ZDCRgn localRgn = this->Internal_CalcClipRgn(ioState) & ((inRgn - inRgn.Inset(ioState.fPenWidth, ioState.fPenWidth)) + ioState.fOrigin))
{
SetupInk theSetupInk(this, ioState);
ZRect localBounds = localRgn.Bounds();
fXServer->SetRegion(fGC, localRgn.GetRegion());
++fChangeCount_Clip;
fXServer->FillRectangle(fDrawable, fGC, localBounds.left, localBounds.top, localBounds.Width(), localBounds.Height());
}
}
示例12: InvertRect
void ZDCCanvas_X::InvertRect(ZDCState& ioState, const ZRect& inRect)
{
if (!fDrawable)
return;
if (inRect.IsEmpty())
return;
SetupLock theSetupLock(this);
SetupClip theSetupClip(this, ioState);
if (theSetupClip.IsEmpty())
return;
fXServer->SetFunction(fGC, GXinvert);
++fChangeCount_Mode;
fXServer->FillRectangle(fDrawable, fGC, inRect.left + ioState.fOrigin.h, inRect.top + ioState.fOrigin.v, inRect.Width(), inRect.Height());
}
示例13: FillRect
void ZDCCanvas_X::FillRect(ZDCState& ioState, const ZRect& inRect)
{
if (!fDrawable)
return;
if (!ioState.fInk)
return;
if (inRect.IsEmpty())
return;
SetupLock theSetupLock(this);
SetupClip theSetupClip(this, ioState);
if (theSetupClip.IsEmpty())
return;
SetupInk theSetupInk(this, ioState);
fXServer->FillRectangle(fDrawable, fGC, inRect.left + ioState.fOrigin.h, inRect.top + ioState.fOrigin.v, inRect.Width(), inRect.Height());
}
示例14: FrameRect
void ZDCCanvas_X::FrameRect(ZDCState& ioState, const ZRect& inRect)
{
if (!fDrawable)
return;
if (!ioState.fInk)
return;
if (ioState.fPenWidth <= 0)
return;
if (inRect.IsEmpty())
return;
if (ioState.fPenWidth == 1)
{
SetupLock theSetupLock(this);
SetupClip theSetupClip(this, ioState);
if (theSetupClip.IsEmpty())
return;
SetupInk theSetupInk(this, ioState);
ZRect realRect = inRect + ioState.fOrigin;
fXServer->DrawRectangle(fDrawable, fGC, inRect.left + ioState.fOrigin.h, inRect.top + ioState.fOrigin.v, inRect.Width() - 1, inRect.Height() - 1);
}
else
{
this->Line(ioState, inRect.left, inRect.top, inRect.right - ioState.fPenWidth, inRect.top);
this->Line(ioState, inRect.right - ioState.fPenWidth, inRect.top, inRect.right - ioState.fPenWidth, inRect.bottom - ioState.fPenWidth);
this->Line(ioState, inRect.right - ioState.fPenWidth, inRect.bottom - ioState.fPenWidth, inRect.left, inRect.bottom - ioState.fPenWidth);
this->Line(ioState, inRect.left, inRect.bottom - ioState.fPenWidth, inRect.left, inRect.top);
}
}