예제 #1
0
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
0
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
0
static void sReadImageData(const ZStreamR& iStream,
	bool iInterlaced, const ZRect& iBounds, ZRef<ZDCPixmapRaster> ioRaster)
	{
	uint8 initialCodeSize = iStream.ReadUInt8();

	StreamR_Chunk theSIC(iStream);
	ZStreamR_LZWDecode theSILZW(initialCodeSize, theSIC);

	ZDCPixmapNS::PixvalDesc sourcePixvalDesc(8, true);

	void* destBaseAddress = ioRaster->GetBaseAddress();

	ZDCPixmapNS::RasterDesc destRasterDesc = ioRaster->GetRasterDesc();

	vector<uint8> theRowBufferVector(iBounds.Width());
	void* theRowBuffer = &theRowBufferVector[0];

	if (iInterlaced)
		{
		for (int pass = 0; pass < 4; ++pass)
			{
			for (ZCoord currentY = iBounds.top + sInterlaceStart[pass];
				currentY < iBounds.bottom; currentY += sInterlaceIncrement[pass])
				{
				theSILZW.Read(theRowBuffer, iBounds.Width());
				void* destRowAddress = destRasterDesc.CalcRowAddress(destBaseAddress, currentY);

				ZDCPixmapNS::sBlitRowPixvals(theRowBuffer, sourcePixvalDesc, 0,
					destRowAddress, destRasterDesc.fPixvalDesc, iBounds.left,
					iBounds.Width());
				}
			}
		}
	else
		{
		for (ZCoord currentY = iBounds.top; currentY < iBounds.bottom; ++currentY)
			{
			theSILZW.Read(theRowBuffer, iBounds.Width());
			void* destRowAddress = destRasterDesc.CalcRowAddress(destBaseAddress, currentY);

			ZDCPixmapNS::sBlitRowPixvals(theRowBuffer, sourcePixvalDesc, 0,
				destRowAddress, destRasterDesc.fPixvalDesc, iBounds.left,
				iBounds.Width());
			}
		}
	}
예제 #4
0
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());
		}
	}
예제 #5
0
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());
		}
	}
예제 #6
0
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());
	}
예제 #7
0
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
						= iRasterDesc.CalcRowAddress(iBaseAddress, currentY);

					ZDCPixmapNS::sBlitRowPixvals(
						sourceRowAddress, iRasterDesc.fPixvalDesc, iBounds.left,
						theRowBuffer, destPixvalDesc, 0,
						iBounds.Width());

					theStream->Write(theRowBuffer, iBounds.Width());
					}
				}
			}
		else
			{
			for (ZCoord currentY = iBounds.top; currentY < iBounds.bottom; ++currentY)
				{
				const void* sourceRowAddress
					= iRasterDesc.CalcRowAddress(iBaseAddress, currentY);

				ZDCPixmapNS::sBlitRowPixvals(
					sourceRowAddress, iRasterDesc.fPixvalDesc, iBounds.left,
					theRowBuffer, destPixvalDesc, 0,
					iBounds.Width());
				theStream->Write(theRowBuffer, iBounds.Width());
				}
			}
		}
	catch (...)
		{
		delete theSLZW;
		delete theSLZWNP;
		throw;
		}

	delete theSLZW;
	delete theSLZWNP;
	}

	iStream.WriteUInt8(';'); // Trailer.
	}
예제 #8
0
void ZDCPixmapEncoder_JPEGLib::Imp_Write(const ZStreamW& iStream,
	const void* iBaseAddress,
	const ZDCPixmapNS::RasterDesc& iRasterDesc,
	const ZDCPixmapNS::PixelDesc& iPixelDesc,
	const ZRect& iBounds)
	{
	jpeg_compress_struct theJCS;
	JPEGErrorMgr theEM;
	theJCS.err = &theEM;
	::jpeg_create_compress(&theJCS);

	theJCS.image_width = iBounds.Width();
	theJCS.image_height = iBounds.Height();

	JPEGWriter theJW(iStream);
	theJCS.dest = &theJW;

	vector<uint8> rowBufferVector;
	try
		{
		ZDCPixmapNS::PixvalDesc destPixvalDesc;
		ZDCPixmapNS::PixelDesc destPixelDesc;

		ZRef<ZDCPixmapNS::PixelDescRep> thePixelDescRep = iPixelDesc.GetRep();

		if (ZDCPixmapNS::PixelDescRep_Gray* thePixelDescRep_Gray
			= ZRefDynamicCast<ZDCPixmapNS::PixelDescRep_Gray>(thePixelDescRep))
			{
			theJCS.input_components = 1;
			theJCS.in_color_space = JCS_GRAYSCALE;
			rowBufferVector.resize(iBounds.Width());

			destPixelDesc = ZDCPixmapNS::PixelDesc(ZDCPixmapNS::eFormatStandard_Gray_8);
			destPixvalDesc.fDepth = 8;
			destPixvalDesc.fBigEndian = true;
			}
		else
			{
			theJCS.input_components = 3;
			theJCS.in_color_space = JCS_RGB;
			rowBufferVector.resize(3 * iBounds.Width());

			destPixelDesc = ZDCPixmapNS::PixelDesc(ZDCPixmapNS::eFormatStandard_RGB_24);
			destPixvalDesc.fDepth = 24;
			destPixvalDesc.fBigEndian = true;
			}

		::jpeg_set_defaults(&theJCS);
		::jpeg_set_quality(&theJCS, fQuality, TRUE);
		theJCS.dct_method = JDCT_FASTEST;

		::jpeg_start_compress(&theJCS, TRUE);

		JSAMPROW rowPtr[1];
		rowPtr[0] = &rowBufferVector[0];
		for (size_t y = iBounds.top; y < iBounds.bottom; ++y)
			{
			const void* sourceRowAddress = iRasterDesc.CalcRowAddress(iBaseAddress, y);

			ZDCPixmapNS::sBlitRow(
				sourceRowAddress, iRasterDesc.fPixvalDesc, iPixelDesc, iBounds.left,
				rowPtr[0], destPixvalDesc, destPixelDesc, 0,
				iBounds.Width());

			::jpeg_write_scanlines(&theJCS, rowPtr, 1);
			}

		::jpeg_finish_compress(&theJCS);
		}
	catch (...)
		{
		::jpeg_destroy(reinterpret_cast<j_common_ptr>(&theJCS));
		throw;
		}

	::jpeg_destroy(reinterpret_cast<j_common_ptr>(&theJCS));
	}
예제 #9
0
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;
	}
예제 #10
0
ZRect::ZRect(const ZRect &rhs) :
    rEngine(ZEngine::GetInstance()),
    rX(rhs.X()),rY(rhs.Y()),rWidth(rhs.Width()),rHeight(rhs.Height())
{
}
예제 #11
0
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);
		}
	}
예제 #12
0
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);
	}
예제 #13
0
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);
	}
예제 #14
0
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());
	}
예제 #15
0
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());
	}
예제 #16
0
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);
		}
	}