unit graphics_2D_implementations; // TODO rename to "graphics" ? or however something that draws on "pixmaps" and uses pixmap units mostly is called anyway. // TODO just rename "pixmap" to "Image". {$MODE OBJFPC} {$M+} interface uses graphics_2D, framebuffers, images, colors, type_fixes, fonts, rectangles; type T2DGraphics = class(TInterfacedObject, I2DGraphics, IInterface) private fFramebuffer : TFramebufferInfo; fPen : IPen; protected function GetPen : IPen; procedure SetPen(const aPen : IPen); public destructor Destroy; override; published constructor Create(const aFramebuffer : TFramebufferInfo); procedure DrawLine(aX1, aY1, aX2, aY2 : TCoordinate); procedure DrawRectangle(aX1, aY1, aX2, aY2 : TCoordinate); procedure DrawEllipse(aX1, aY1, aX2, aY2 : TCoordinate); procedure DrawArc(aX1, aY1, aX2, aY2 : TCoordinate; aBeginning : TAngle; aEnd : TAngle); procedure DrawCubicBezier(const aPoints : TPointArray); // depending on pen, doesn't always actually draw something. function DrawGlyph(const aFont : IFont; aDesiredHeight : TCoordinate; aXLeft, aYBaseline : TCoordinate; aCode : TCardinal{Unicode}) : TRectangle; // FIXME RTL, up-down, context dependency. procedure ClearBox(aX1, aY1, aX2, aY2 : TCoordinate; const aColor : IColor); procedure BLIT(const aImage : IImage; aX1, aY1, aX2, aY2 : TCoordinate; aDestinationX1, aDestinationY1 : Integer; aMode : TBLITMode); { TODO text, bezier curves (quadratic, cubic) (not B-Spline). } { TODO more obscure things like flood fill } property Pen : IPen read GetPen write SetPen; function GetBuiltinPen(aID : TBuiltInPenID; aWidth, aHeight : Cardinal) : IPen; end; implementation function T2DGraphics.GetPen : IPen; begin Result := fPen; end; procedure T2DGraphics.SetPen(const aPen : IPen); begin fPen := aPen; end; destructor T2DGraphics.Destroy; begin inherited Destroy; end; constructor T2DGraphics.Create(const aFramebuffer : TFramebufferInfo); begin end; procedure T2DGraphics.DrawLine(aX1, aY1, aX2, aY2 : TCoordinate); begin end; procedure T2DGraphics.DrawRectangle(aX1, aY1, aX2, aY2 : TCoordinate); begin end; procedure T2DGraphics.DrawEllipse(aX1, aY1, aX2, aY2 : TCoordinate); begin end; procedure T2DGraphics.DrawArc(aX1, aY1, aX2, aY2 : TCoordinate; aBeginning : TAngle; aEnd : TAngle); begin end; procedure T2DGraphics.DrawCubicBezier(const aPoints : TPointArray); begin end; procedure T2DGraphics.ClearBox(aX1, aY1, aX2, aY2 : TCoordinate; const aColor : IColor); begin end; procedure T2DGraphics.BLIT(const aImage : IImage; aX1, aY1, aX2, aY2 : TCoordinate; aDestinationX1, aDestinationY1 : Integer; aMode : TBLITMode); begin end; function T2DGraphics.GetBuiltinPen(aID : TBuiltInPenID; aWidth, aHeight : Cardinal) : IPen; begin Result := nil; // FIXME. end; function T2DGraphics.DrawGlyph(const aFont : IFont; aDesiredHeight : TCoordinate; aXLeft, aYBaseline : TCoordinate; aCode : TCardinal{Unicode}) : TRectangle; // FIXME RTL, up-down, context dependency. begin Result.LeftTop.X := 0; Result.LeftTop.Y := 0; Result.RightBottom.X := 0; Result.RightBottom.Y := 0; // FIXME. end; end.