unit X11_Drawables; {$MODE OBJFPC} interface uses X11_Objects, X11, type_fixes; type TDrawable = class(X11_Objects.TObject, IDrawable, X11_Objects.IObject, IInterface) // TODO draw line, rectangle, ... procedure DrawString(const aGC : IDeviceContext; aX, aY : TInteger; const aText : ANSIString; aTextLength : TInteger = -1); procedure SHMPutImage(const aGC : IDeviceContext; const aImage : IXImage; aSrcX, aSrcY, aDestX, aDestY : TInteger; aWidth, aHeight : TCardinal; aBSendCompletionEvent : Boolean); procedure PutImage(const aGC : IDeviceContext; const aImage : IXImage; aSrcX, aSrcY, aDestX, aDestY : TInteger; aWidth, aHeight : TCardinal); end; implementation uses xlib, xshm; procedure TDrawable.DrawString(const aGC : IDeviceContext; aX, aY : TInteger; const aText : ANSIString; aTextLength : TInteger = -1); begin if aTextLength = -1 then aTextLength := Length(aText); ensureOK(XDrawString(Display, fHandle, aGC.Handle, aX, aY, PChar(aText), aTextLength)); end; procedure TDrawable.SHMPutImage(const aGC : IDeviceContext; const aImage : IXImage; aSrcX, aSrcY, aDestX, aDestY : TInteger; aWidth, aHeight : TCardinal; aBSendCompletionEvent : Boolean); begin ensureOK(XShmPutImage(Display, fHandle, aGC.Handle, aImage.Handle, aSrcX, aSrcY, aDestX, aDestY, aWidth, aHeight, LongInt(aBSendCompletionEvent))); end; procedure TDrawable.PutImage(const aGC : IDeviceContext; const aImage : IXImage; aSrcX, aSrcY, aDestX, aDestY : TInteger; aWidth, aHeight : TCardinal); begin ensureOK(XPutImage(Display, fHandle, aGC.Handle, aImage.Handle, aSrcX, aSrcY, aDestX, aDestY, aWidth, aHeight)); end; // XPutImage(display, drawable, gc, image, src_x, src_y, dest_x, dest_y, width, height) end.