public MyMiniAggCanvasRenderElement(RootGraphic rootgfx, int width, int height) : base(rootgfx, width, height) { this.actualImage = new ActualImage(width, height, PixelFarm.Agg.PixelFormat.ARGB32); this.gfx2d = Graphics2D.CreateFromImage(actualImage); needUpdate = true; }
public RenderElementBridgeCssBox(BoxSpec spec, RenderElement containerElement, RootGraphic rootgfx) : base(spec, rootgfx) { this.containerElement = containerElement; }
public EditableTextRun(RootGraphic gfx, char[] copyBuffer, TextSpanStyle style) : base(gfx) { //check line break? this.spanStyle = style; this.mybuffer = copyBuffer; UpdateRunWidth(); }
public override RenderElement GetPrimaryRenderElement(RootGraphic rootgfx) { if (primElement == null) { var renderE = new CustomRenderBox(rootgfx, this.Width, this.Height); renderE.HasSpecificHeight = this.HasSpecificHeight; renderE.HasSpecificWidth = this.HasSpecificWidth; renderE.SetController(this); renderE.SetVisible(this.Visible); #if DEBUG //if (dbugBreakMe) //{ // renderE.dbugBreak = true; //} #endif renderE.SetLocation(this.Left, this.Top); renderE.BackColor = backColor; renderE.HasSpecificSize = true; renderE.SetViewport(this.ViewportX, this.ViewportY); //------------------------------------------------ //create visual layer int childCount = this.ChildCount; for (int m = 0; m < childCount; ++m) { renderE.AddChild(this.GetChild(m)); } //set primary render element //--------------------------------- this.primElement = renderE; } return primElement; }
public override RenderElement GetPrimaryRenderElement(RootGraphic rootgfx) { if (!this.HasReadyRenderElement) { //first time RenderElement baseRenderElement = base.GetPrimaryRenderElement(rootgfx); imageBox = new ImageBox(16, 16); if (this.isChecked) { imageBox.ImageBinder = ResImageList.GetImageBinder(ImageName.CheckBoxChecked); } else { imageBox.ImageBinder = ResImageList.GetImageBinder(ImageName.CheckBoxUnChecked); } imageBox.MouseDown += (s, e) => { //toggle checked/unchecked this.Checked = !this.Checked; }; this.AddChild(imageBox); return baseRenderElement; } else { return base.GetPrimaryRenderElement(rootgfx); } }
public override RenderElement GetPrimaryRenderElement(RootGraphic rootgfx) { if (!this.HasReadyRenderElement) { //first time RenderElement baseRenderElement = base.GetPrimaryRenderElement(rootgfx); //1. add place holder first placeHolder = new CustomTextRun(rootgfx, this.Width - 4, this.Height - 4); placeHolder.Text = placeHolderText; placeHolder.SetLocation(1, 1); placeHolder.TextColor = Color.FromArgb(180, Color.LightGray); baseRenderElement.AddChild(placeHolder); //2. textbox myTextBox = new TextBox(this.Width - 4, this.Height - 4, multiline); myTextBox.BackgroundColor = Color.Transparent; myTextBox.SetLocation(2, 2); textEvListener = new Text.TextSurfaceEventListener(); myTextBox.TextEventListener = textEvListener; textEvListener.KeyDown += new EventHandler<Text.TextDomEventArgs>(textEvListener_KeyDown); baseRenderElement.AddChild(myTextBox); return baseRenderElement; } else { return base.GetPrimaryRenderElement(rootgfx); } }
public override RenderElement GetPrimaryRenderElement(RootGraphic rootgfx) { if (primElement == null) { var renderE = new CustomRenderBox(rootgfx, this.Width, this.Height); this.SetLocation(this.Left, this.Top); renderE.BackColor = backColor; renderE.SetController(this); renderE.HasSpecificSize = true; //------------------------------------------------ //create visual layer if (this.landPart != null) { renderE.AddChild(this.landPart); } if (this.floatPart != null) { } //--------------------------------- primElement = renderE; } return primElement; }
public TextEditRenderBox(RootGraphic rootgfx, int width, int height, bool isMultiLine) : base(rootgfx, width, height) { GlobalCaretController.RegisterCaretBlink(rootgfx); myCaret = new CaretRenderElement(rootgfx, 2, 17); myCaret.TransparentForAllEvents = true; this.MayHasViewport = true; this.BackgroundColor = Color.White;// Color.Transparent; this.currentSpanStyle = new TextSpanStyle(); this.currentSpanStyle.FontInfo = rootgfx.DefaultTextEditFontInfo; textLayer = new EditableTextFlowLayer(this); internalTextLayerController = new InternalTextLayerController(this, textLayer); this.isMultiLine = isMultiLine; if (isMultiLine) { textLayer.SetUseDoubleCanvas(false, true); } else { textLayer.SetUseDoubleCanvas(true, false); } this.IsBlockElement = false; }
public GdiPlusCanvasViewport(RootGraphic rootgfx, Size viewportSize, int cachedPageNum) : base(rootgfx, viewportSize, cachedPageNum) { quadPages = new QuadPages( cachedPageNum, viewportSize.Width, viewportSize.Height * 2); this.CalculateCanvasPages(); }
public WrapperCssBoxBase(object controller, BoxSpec spec, RootGraphic root, CssDisplay display) : base(spec, root, display) { this.SetController(controller); }
public CssBoxSvgRoot(Css.BoxSpec spec, RootGraphic rootgfx, SvgElement svgElem) : base(spec, rootgfx, Css.CssDisplay.Block) { SetAsCustomCssBox(this); //create svg node this.SvgSpec = svgElem; ChangeDisplayType(this, Css.CssDisplay.Block); }
public GraphicsTimerTaskManager(RootGraphic rootgfx, UIPlatform platform) { this.rootgfx = rootgfx; this.uiTimer1 = platform.CreateUITimer(); //-------------------------------------- uiTimer1.Interval = fastPlanInterval; //fast task plan uiTimer1.Tick += new EventHandler(graphicTimer1_Tick); uiTimer1.Enabled = true; //-------------------------------------- }
public MiniAggCanvasRenderElement(RootGraphic rootgfx, int width, int height) : base(rootgfx, width, height) { this.actualImage = new ActualImage(width, height, PixelFarm.Agg.PixelFormat.ARGB32); this.gfx2d = Graphics2D.CreateFromImage(actualImage); this.painter = new AggCanvasPainter((ImageGraphics2D)gfx2d); needUpdate = true; this.BackColor = Color.White; }
public void InitRootGraphics( RootGraphic rootgfx, ITopWindowEventRoot topWinEventRoot, InnerViewportKind innerViewportKind) { //1. this.rootgfx = rootgfx; this.topWinEventRoot = topWinEventRoot; this.innerViewportKind = innerViewportKind; switch (innerViewportKind) { case InnerViewportKind.GL: { //temp not suppport throw new NotSupportedException(); //PixelFarm.Drawing.DrawingGL.CanvasGLPortal.Start(); //var bridge = new OpenGL.MyTopWindowBridgeOpenGL(rootgfx, topWinEventRoot); //var view = new OpenGL.GpuOpenGLSurfaceView(); //view.Width = 800; //view.Height = 600; ////view.Dock = DockStyle.Fill; //this.Controls.Add(view); ////--------------------------------------- //view.Bind(bridge); //this.winBridge = bridge; } break; case InnerViewportKind.Skia: { //skiasharp *** var bridge = new Skia.MyTopWindowBridgeSkia(rootgfx, topWinEventRoot); var view = new CpuSurfaceView(); view.Dock = DockStyle.Fill; this.Controls.Add(view); //--------------------------------------- view.Bind(bridge); this.winBridge = bridge; } break; case InnerViewportKind.GdiPlus: default: { var bridge = new GdiPlus.MyTopWindowBridgeGdiPlus(rootgfx, topWinEventRoot); var view = new CpuSurfaceView(); view.Dock = DockStyle.Fill; this.Controls.Add(view); //--------------------------------------- view.Bind(bridge); this.winBridge = bridge; } break; } }
/// <summary> /// Init. /// </summary> /// <param name="parent">the parent box of this box</param> /// <param name="controller">the html tag data of this box</param> public CssBoxImage(Css.BoxSpec boxSpec, RootGraphic rootgfx, ImageBinder binder) : base(boxSpec, rootgfx) { this._imgRun = new CssImageRun(); this._imgRun.ImageBinder = binder; this._imgRun.SetOwner(this); var runlist = new List<CssRun>(1); runlist.Add(_imgRun); CssBox.UnsafeSetContentRuns(this, runlist, false); }
bool isClosed;//is this viewport closed public CanvasViewport(RootGraphic rootgfx, Size viewportSize, int cachedPageNum) { this.rootGraphics = rootgfx; this.topWindowBox = rootgfx.TopWindowRenderBox; this.viewportWidth = viewportSize.Width; this.viewportHeight = viewportSize.Height; canvasSizeChangedHandler = Canvas_SizeChanged; viewportX = 0; viewportY = 0; }
public override RenderElement GetPrimaryRenderElement(RootGraphic rootgfx) { if (renderShape == null) { renderShape = new GraphicShapeRenderElement(rootgfx, this.Width, this.Height); renderShape.SetLocation(this.Left, this.Top); renderShape.SetController(this); this.SetPrimaryRenderElement(renderShape); } return this.renderShape; }
public SolidTextRun(RootGraphic gfx, char c, TextSpanStyle style) : base(gfx) { mybuffer = new char[] { c }; if (c == '\n') { this.IsLineBreak = true; } //check line break? UpdateRunWidth(); }
internal static void RegisterCaretBlink(RootGraphic root) { if (!root.CaretHandleRegistered) { root.CaretHandleRegistered = true; task = root.SubscribeGraphicsIntervalTask( caretBlinkTask, TaskIntervalPlan.CaretBlink, 20, tickHandler); } }
public GraphicsTimerTask(RootGraphic rootgfx, TaskIntervalPlan planName, object uniqueName, int internvalMs, EventHandler<GraphicsTimerTaskEventArgs> tickHandler) { this.PlanName = planName; this.uniqueName = uniqueName; this.enable = false; this.rootgfx = rootgfx; this.tickHandler = tickHandler; }
public override RenderElement GetPrimaryRenderElement(RootGraphic rootgfx) { if (this.myTextRun == null) { var trun = new CustomTextRun(rootgfx, this.Width, this.Height); trun.SetLocation(this.Left, this.Top); trun.TextColor = this.textColor; trun.Text = this.Text; this.myTextRun = trun; } //----------- return myTextRun; }
public override RenderElement GetPrimaryRenderElement(RootGraphic rootgfx) { if (imgRenderBox == null) { var renderBox = new CustomImageRenderBox(rootgfx, this.Width, this.Height); renderBox.SetLocation(this.Left, this.Top); renderBox.ImageBinder = imageBinder; renderBox.SetController(this); renderBox.BackColor = this.BackColor; SetPrimaryRenderElement(renderBox); this.imgRenderBox = renderBox; } return this.imgRenderBox; }
public override RenderElement GetPrimaryRenderElement(RootGraphic rootgfx) { if (canvasRenderElement == null) { var canvas = new MiniAggCanvasRenderElement(rootgfx, this.Width, this.Height); canvas.HasSpecificHeight = this.HasSpecificHeight; canvas.HasSpecificWidth = this.HasSpecificWidth; canvas.SetLocation(this.Left, this.Top); canvas.Painter.StrokeWidth = 1; canvas.Painter.StrokeColor = PixelFarm.Drawing.Color.Black; this.canvasRenderElement = canvas; canvas.SetController(this); } return canvasRenderElement; }
public SkiaCanvasViewport(RootGraphic rootgfx, Size viewportSize, int cachedPageNum) : base(rootgfx, viewportSize, cachedPageNum) { this.CalculateCanvasPages(); mySkCanvas = new PixelFarm.Drawing.Skia.MySkiaCanvas(0, 0, 0, 0, internalSizeW, internalSizwH); //TODO: review performance here //review how to move data from unmanged(skia) to unmanaged(hdc's bitmap) tmpBmp = new System.Drawing.Bitmap(internalSizeW, internalSizwH); var bmpdata = tmpBmp.LockBits( new System.Drawing.Rectangle(0, 0, internalSizeW, internalSizwH), System.Drawing.Imaging.ImageLockMode.ReadOnly, tmpBmp.PixelFormat); tmpBuffer = new byte[bmpdata.Stride * bmpdata.Height]; tmpBmp.UnlockBits(bmpdata); }
public SolidTextRun(RootGraphic gfx, string str, TextSpanStyle style) : base(gfx) { if (str != null && str.Length > 0) { mybuffer = str.ToCharArray(); if (mybuffer.Length == 1 && mybuffer[0] == '\n') { this.IsLineBreak = true; } UpdateRunWidth(); } else { throw new Exception("string must be null or zero length"); } }
public override RenderElement GetPrimaryRenderElement(RootGraphic rootgfx) { if (mainBox == null) { switch (this.ScrollBarType) { case ScrollBarType.Horizontal: { CreateHScrollbarContent(rootgfx); } break; default: { CreateVScrollbarContent(rootgfx); } break; } } return mainBox; }
public override RenderElement GetPrimaryRenderElement(RootGraphic rootgfx) { if (!this.HasReadyRenderElement) { var renderE = base.GetPrimaryRenderElement(rootgfx); if (contentBox != null) { renderE.AddChild(contentBox); } //------------------------------------------------------ renderE.AddChild(boxLeftTop); renderE.AddChild(boxRightTop); renderE.AddChild(boxLeftBottom); renderE.AddChild(boxRightBottom); //------------------------------------------------------ } return base.GetPrimaryRenderElement(rootgfx); }
public CssBox(BoxSpec spec, RootGraphic rootgfx) { this.rootgfx = rootgfx; this._aa_boxes = new CssBoxCollection(); #if DEBUG //if (this.__aa_dbugId == 6) //{ //} if (!spec.IsFreezed) { //must be freezed throw new NotSupportedException(); } #endif //assign spec this._myspec = spec; EvaluateSpec(spec); ChangeDisplayType(this, _myspec.CssDisplay); }
public override RenderElement GetPrimaryRenderElement(RootGraphic rootgfx) { if (primElement == null) { var renderE = new CustomRenderBox(rootgfx, this.Width, this.Height); renderE.SetLocation(this.Left, this.Top); renderE.BackColor = backColor; renderE.SetController(this); renderE.HasSpecificSize = true; //------------------------------------------------ //create visual layer int n = this.uiList.Count; for (int m = 0; m < n; ++m) { renderE.AddChild(uiList.GetElement(m)); } //--------------------------------- primElement = renderE; } return primElement; }
public CssBox(BoxSpec spec, RootGraphic rootgfx, CssDisplay displayType) { this.rootgfx = rootgfx; this._aa_boxes = new CssBoxCollection(); #if DEBUG //if (this.__aa_dbugId == 6) //{ //} if (!spec.IsFreezed) { //must be freezed throw new NotSupportedException(); } #endif //assign spec this._boxCompactFlags |= BoxFlags.DONT_CHANGE_DISPLAY_TYPE; this._cssDisplay = displayType; this._myspec = spec; //---------------------------- EvaluateSpec(spec); ChangeDisplayType(this, _myspec.CssDisplay); }
public void InitRootGraphics( RootGraphic rootgfx, ITopWindowEventRoot topWinEventRoot, InnerViewportKind innerViewportKind) { //create a proper bridge**** this.rootgfx = rootgfx; this.topWinEventRoot = topWinEventRoot; this.innerViewportKind = innerViewportKind; switch (innerViewportKind) { case InnerViewportKind.GL: { #if GL_ENABLE //temp not suppport //TODO: review here //PixelFarm.Drawing.DrawingGL.CanvasGLPortal.Start(); var bridge = new OpenGL.MyTopWindowBridgeOpenGL(rootgfx, topWinEventRoot); var view = new OpenGL.GpuOpenGLSurfaceView(); view.Width = 1200; view.Height = 1200; openGLSurfaceView = view; //view.Dock = DockStyle.Fill; //this.Controls.Add(view); this.panel1.Visible = true; this.panel1.Controls.Add(view); //--------------------------------------- view.Bind(bridge); this.winBridge = bridge; //--------------------------------------- view.SetGLPaintHandler(null); hh1 = view.Handle; //force real window handle creation view.MakeCurrent(); int max = Math.Max(view.Width, view.Height); _glsx = PixelFarm.Drawing.GLES2.GLES2Platform.CreateGLRenderSurface(max, max, view.Width, view.Height); //--------------- //canvas2d.FlipY = true;// //--------------- canvasPainter = new GLPainter(_glsx); //canvasPainter.SmoothingMode = PixelFarm.Drawing.SmoothingMode.HighQuality; //---------------------- //1. win gdi based //var printer = new WinGdiFontPrinter(canvas2d, view.Width, view.Height); //canvasPainter.TextPrinter = printer; //---------------------- //2. raw vxs //var printer = new PixelFarm.Drawing.Fonts.VxsTextPrinter(canvasPainter); //canvasPainter.TextPrinter = printer; //---------------------- //3. agg texture based font texture //var printer = new AggTextSpanPrinter(canvasPainter, 400, 50); //printer.HintTechnique = Typography.Rendering.HintTechnique.TrueTypeInstruction_VerticalOnly; //printer.UseSubPixelRendering = true; //canvasPainter.TextPrinter = printer; //3 var printer = new GLBitmapGlyphTextPrinter(canvasPainter, PixelFarm.Drawing.GLES2.GLES2Platform.TextService); canvasPainter.TextPrinter = printer; // var myGLCanvas1 = new PixelFarm.Drawing.GLES2.MyGLDrawBoard(canvasPainter, _glsx.CanvasWidth, _glsx.CanvasHeight); bridge.SetCanvas(myGLCanvas1); #endif } break; #if __SKIA__ case InnerViewportKind.Skia: { //skiasharp *** var bridge = new Skia.MyTopWindowBridgeSkia(rootgfx, topWinEventRoot); var view = new CpuSurfaceView(); view.Dock = DockStyle.Fill; this.Controls.Add(view); //--------------------------------------- view.Bind(bridge); this.winBridge = bridge; } break; #endif case InnerViewportKind.GdiPlus: default: { var bridge = new GdiPlus.MyTopWindowBridgeGdiPlus(rootgfx, topWinEventRoot); var view = new CpuSurfaceView(); view.Dock = DockStyle.Fill; this.Controls.Add(view); //--------------------------------------- view.Bind(bridge); this.winBridge = bridge; } break; } }
public override RenderElement GetPrimaryRenderElement(RootGraphic rootgfx) { throw new NotImplementedException(); }
//---------- //for test #if DEBUG //void dbugTest01() //{ // //canvas.Orientation = CanvasOrientation.LeftTop; // canvas.ClearSurface(Color.White); // canvas.FillRectangle(Color.Red, 50, 50, 100, 100); // dbugGLOffsetCanvasOrigin(50, 50); // //simulate draw content // canvas.FillRectangle(Color.Gray, 10, 10, 80, 80); // dbugGLOffsetCanvasOrigin(-50, -50); //} //void dbugGLSetCanvasOrigin(int x, int y) //{ // canvas.SetCanvasOrigin(x, y); // //int properW = Math.Min(canvas.Width, canvas.Height); // ////int max = 600; // ////init // ////--------------------------------- // ////-1 temp fix split scanline in some screen // ////OpenTK.Graphics.OpenGL.GL.Viewport(x, y, properW, properW - 1); // //////--------------------------------- // //OpenTK.Graphics.OpenGL.GL.MatrixMode(OpenTK.Graphics.OpenGL.MatrixMode.Projection); // //OpenTK.Graphics.OpenGL.GL.LoadIdentity(); // //OpenTK.Graphics.OpenGL.GL.Ortho(0, properW, properW, 0, 0.0, 100); // ////switch (this.orientation) // ////{ // //// case Drawing.CanvasOrientation.LeftTop: // //// { // //// OpenTK.Graphics.OpenGL.GL.Ortho(0, properW, properW, 0, 0.0, 100); // //// } break; // //// default: // //// { // //// OpenTK.Graphics.OpenGL.GL.Ortho(0, properW, 0, properW, 0.0, 100); // //// } break; // ////} // //OpenTK.Graphics.OpenGL.GL.MatrixMode(OpenTK.Graphics.OpenGL.MatrixMode.Modelview); // //OpenTK.Graphics.OpenGL.GL.LoadIdentity(); // //OpenTK.Graphics.OpenGL.GL.Translate(x, y, 0); //} //void dbugGLOffsetCanvasOrigin(int dx, int dy) //{ // dbugGLSetCanvasOrigin(canvas.CanvasOriginX + dx, canvas.CanvasOriginY + dy); //} #endif //------- public void PaintMe() { if (isClosed) { return; } //--------------------------------------------- //canvas.Orientation = CanvasOrientation.LeftTop; //Test01(); //return; //Test01(); //return; //canvas.ClearSurface(Color.White); //canvas.FillRectangle(Color.Red, 20, 20, 200, 400); // return; //---------------------------------- //gl paint here if (canvas == null) { return; } canvas.Clear(Color.White); ////test draw rect //canvas.StrokeColor = PixelFarm.Drawing.Color.Blue; //canvas.DrawRectangle(Color.Blue, 20, 20, 200, 200); ////------------------------ if (this.IsClosed) { return; } //------------------------------------ this.rootGraphics.PrepareRender(); //--------------- this.rootGraphics.IsInRenderPhase = true; #if DEBUG this.rootGraphics.dbug_rootDrawingMsg.Clear(); this.rootGraphics.dbug_drawLevel = 0; #endif UpdateAllArea(this.canvas, this.topWindowBox); this.rootGraphics.IsInRenderPhase = false; #if DEBUG RootGraphic visualroot = RootGraphic.dbugCurrentGlobalVRoot; if (visualroot.dbug_RecordDrawingChain) { List <dbugLayoutMsg> outputMsgs = dbugOutputWindow.dbug_rootDocDebugMsgs; outputMsgs.Clear(); outputMsgs.Add(new dbugLayoutMsg(null as RenderElement, "[" + debug_render_to_output_count + "]")); visualroot.dbug_DumpRootDrawingMsg(outputMsgs); dbugOutputWindow.dbug_InvokeVisualRootDrawMsg(); debug_render_to_output_count++; } if (dbugHelper01.dbugVE_HighlightMe != null) { dbugOutputWindow.dbug_HighlightMeNow(dbugHelper01.dbugVE_HighlightMe.dbugGetGlobalRect()); } #endif }
public VgBridgeRenderElement(RootGraphic rootGfx, int width, int height) : base(rootGfx, width, height) { this.MayHasChild = true; }
public void SetRootGraphics(RootGraphic rootgfx) { this.rootgfx = rootgfx; }
public MyTopWindowBridgeGdiPlus(RootGraphic root, ITopWindowEventRoot topWinEventRoot) : base(root, topWinEventRoot) { }
Stack <UIFocusEventArgs> _focusEventStack = new Stack <UIFocusEventArgs>(); //resuable public TopWindowBridgeWinNeutral(RootGraphic rootGraphic, ITopWindowEventRoot topWinEventRoot) { _topWinEventRoot = topWinEventRoot; _rootGraphic = rootGraphic; }
public CssIsolateBox(BoxSpec spec, RootGraphic rootgfx) : base(spec, new CssBoxRootGfxBridge(rootgfx)) { }
public GraphicShapeRenderElement(RootGraphic root, int w, int h) : base(root, w, h) { }
public MyTopWindowBridgeOpenGL(RootGraphic root, ITopWindowEventRoot topWinEventRoot) : base(root, topWinEventRoot) { }
public OpenGLCanvasViewport(RootGraphic root, Size viewportSize, int cachedPageNum) : base(root, viewportSize, cachedPageNum) { }
void IEventPortal.PortalMouseDown(UIMouseEventArgs e) { #if DEBUG if (this.dbugRootGraphics.dbugEnableGraphicInvalidateTrace) { this.dbugRootGraphics.dbugGraphicInvalidateTracer.WriteInfo("================"); this.dbugRootGraphics.dbugGraphicInvalidateTracer.WriteInfo("MOUSEDOWN"); this.dbugRootGraphics.dbugGraphicInvalidateTracer.WriteInfo("================"); } dbugMsgChainVersion = 1; int local_msgVersion = 1; #endif HitChain hitPointChain = GetFreeHitChain(); #if DEBUG _dbugHitChainPhase = dbugHitChainPhase.MouseDown; #endif HitTestCoreWithPrevChainHint(hitPointChain, _previousChain, e.X, e.Y); if (hitPointChain.Count > 0) { //------------------------------ //1. origin object SetEventOrigin(e, hitPointChain); //------------------------------ var prevMouseDownElement = e.PreviousMouseDown; IUIEventListener currentMouseDown = null; //portal ForEachOnlyEventPortalBubbleUp(e, hitPointChain, (portal) => { portal.PortalMouseDown(e); //***** currentMouseDown = e.CurrentContextElement; return(true); }); //------------------------------ //use events if (!e.CancelBubbling) { e.CurrentContextElement = currentMouseDown = null; //clear ForEachEventListenerBubbleUp(e, hitPointChain, listener => { if (listener.BypassAllMouseEvents) { return(false); } currentMouseDown = listener; listener.ListenMouseDown(e); //------------------------------------------------------- bool cancelMouseBubbling = e.CancelBubbling; if (prevMouseDownElement != null && prevMouseDownElement != listener) { prevMouseDownElement.ListenLostMouseFocus(e); prevMouseDownElement = null;//clear } //------------------------------------------------------- //retrun true to stop this loop (no further bubble up) //return false to bubble this to upper control return(e.CancelBubbling || !listener.BypassAllMouseEvents); }); } if (prevMouseDownElement != currentMouseDown && prevMouseDownElement != null) { prevMouseDownElement.ListenLostMouseFocus(e); prevMouseDownElement = null; } } //--------------------------------------------------------------- #if DEBUG RootGraphic visualroot = this.dbugRootGraphics; if (visualroot.dbug_RecordHitChain) { visualroot.dbug_rootHitChainMsg.Clear(); HitInfo hitInfo; for (int tt = hitPointChain.Count - 1; tt >= 0; --tt) { hitInfo = hitPointChain.GetHitInfo(tt); RenderElement ve = hitInfo.HitElemAsRenderElement; if (ve != null) { ve.dbug_WriteOwnerLayerInfo(visualroot, tt); ve.dbug_WriteOwnerLineInfo(visualroot, tt); string hit_info = new string('.', tt) + " [" + tt + "] " + "(" + hitInfo.point.X + "," + hitInfo.point.Y + ") " + ve.dbug_FullElementDescription(); visualroot.dbug_rootHitChainMsg.AddLast(new dbugLayoutMsg(ve, hit_info)); } } } #endif SwapHitChain(hitPointChain); e.StopPropagation(); #if DEBUG if (local_msgVersion != dbugMsgChainVersion) { return; } visualroot.dbugHitTracker.Write("stop-mousedown"); visualroot.dbugHitTracker.Play = false; #endif }
public override void ResetRootGraphics(RootGraphic rootgfx) { DirectSetRootGraphics(this, rootgfx); }
public override void ResetRootGraphics(RootGraphic rootgfx) { }
public LineRenderElement(RootGraphic rootGfx, int width, int height) : base(rootGfx, width, height) { }
public HtmlRenderBox(RootGraphic rootgfx, int width, int height) : base(rootgfx, width, height) { }
public EditableRun(RootGraphic gfx) : base(gfx, 10, 10) { }
public TopWindowBridge(RootGraphic rootGraphic, ITopWindowEventRoot topWinEventRoot) { this.topWinEventRoot = topWinEventRoot; this.rootGraphic = rootGraphic; }
// public override RenderElement GetPrimaryRenderElement(RootGraphic rootgfx) { _hasPrimRenderE = true; return(_groundBox.GetPrimaryRenderElement(rootgfx)); }
internal static CssBox CreateBridgeBox(IFonts iFonts, LayoutFarm.RenderElement containerElement, RootGraphic rootgfx) { var spec = new BoxSpec(); spec.CssDisplay = CssDisplay.Block; spec.Freeze(); var box = new RenderElementBridgeCssBox(spec, containerElement, rootgfx); //------------------------------------ box.ReEvaluateFont(iFonts, 10); //------------------------------------ return(box); }
public override void ResetRootGraphics(RootGraphic rootgfx) { //change root graphics after create DirectSetRootGraphics(this, rootgfx); }
protected override void OnRequestScrollView(CssBox box) { RootGraphic rootgfx = (RootGraphic)box.RootGfx; rootgfx.AddToElementUpdateQueue(box); }
public void InitRootGraphics( RootGraphic rootgfx, ITopWindowEventRoot topWinEventRoot, InnerViewportKind innerViewportKind) { //create a proper bridge**** _rootgfx = rootgfx; _topWinEventRoot = topWinEventRoot; _innerViewportKind = innerViewportKind; switch (innerViewportKind) { case InnerViewportKind.GdiPlusOnGLES: case InnerViewportKind.AggOnGLES: case InnerViewportKind.GLES: { //temp not suppport var bridge = new OpenGL.MyTopWindowBridgeOpenGL(rootgfx, topWinEventRoot); var view = new OpenGL.GpuOpenGLSurfaceView(); view.Width = rootgfx.Width; view.Height = rootgfx.Height; _gpuSurfaceViewUserControl = view; this.Controls.Add(view); //--------------------------------------- view.Bind(bridge); _winBridge = bridge; //--------------------------------------- IntPtr hh1 = view.Handle; //force real window handle creation try { view.MakeCurrent(); } catch (Exception ex) { } int max = Math.Max(view.Width, view.Height); _pcx = GLPainterContext.Create(max, max, view.Width, view.Height, true); _glPainter = new GLPainter(); _glPainter.BindToPainterContext(_pcx); _glPainter.TextPrinter = new GLBitmapGlyphTextPrinter(_glPainter, PixelFarm.Drawing.GLES2.GLES2Platform.TextService); //canvasPainter.SmoothingMode = PixelFarm.Drawing.SmoothingMode.HighQuality; //---------------------- //1. win gdi based //var printer = new WinGdiFontPrinter(canvas2d, view.Width, view.Height); //canvasPainter.TextPrinter = printer; //---------------------- //2. raw vxs //var printer = new PixelFarm.Drawing.Fonts.VxsTextPrinter(canvasPainter); //canvasPainter.TextPrinter = printer; //---------------------- //3. agg texture based font texture //_glPainter.TextPrinter = new CpuBlitTextSpanPrinter2(_glPainter, 400, 50, PixelFarm.Drawing.GLES2.GLES2Platform.TextService); //3 var myGLCanvas1 = new PixelFarm.Drawing.GLES2.MyGLDrawBoard(_glPainter); //{ //in mixed mode //GDI+ on GLES, Agg on GLES we provide a software rendering layer too PixelFarm.Drawing.DrawBoard cpuDrawBoard = null; // CreateSoftwareDrawBoard(view.Width, view.Height, innerViewportKind); myGLCanvas1.SetCpuBlitDrawBoardCreator(() => cpuDrawBoard ?? (cpuDrawBoard = CreateSoftwareDrawBoard(view.Width, view.Height, innerViewportKind))); //} bridge.SetCanvas(myGLCanvas1); } break; case InnerViewportKind.PureAgg: { var bridge = new GdiPlus.MyTopWindowBridgeAgg(rootgfx, topWinEventRoot); //bridge to agg var view = new CpuSurfaceView(); view.Dock = DockStyle.Fill; this.Controls.Add(view); //--------------------------------------- view.Bind(bridge); _winBridge = bridge; } break; case InnerViewportKind.GdiPlus: default: { var bridge = new GdiPlus.MyTopWindowBridgeGdiPlus(rootgfx, topWinEventRoot); //bridge with GDI+ var view = new CpuSurfaceView(); view.Size = new System.Drawing.Size(rootgfx.Width, rootgfx.Height); this.Controls.Add(view); //--------------------------------------- view.Bind(bridge); _winBridge = bridge; } break; #if __SKIA__ //case InnerViewportKind.Skia: // { // //skiasharp *** // var bridge = new Skia.MyTopWindowBridgeSkia(rootgfx, topWinEventRoot); // var view = new CpuSurfaceView(); // view.Dock = DockStyle.Fill; // this.Controls.Add(view); // //--------------------------------------- // view.Bind(bridge); // _winBridge = bridge; // } // break; #endif } }
//------- public void PaintMe() { if (_isClosed || _drawboard == null) { return; } RootGraphic backup = GlobalRootGraphic.CurrentRootGfx; GlobalRootGraphic.CurrentRootGfx = _rootgfx; _rootgfx.PrepareRender(); //--------------- _rootgfx.BeginRenderPhase(); #if DEBUG _rootgfx.dbug_rootDrawingMsg.Clear(); _rootgfx.dbug_drawLevel = 0; #endif if (_rootgfx.HasAccumInvalidateRect) { //evaluate _gfxUpdatePlan.SetUpdatePlanForFlushAccum(); int j = _gfxUpdatePlan.UpdateListCount; if (j > 0) { //special mode UpdateArea u = GetFreeUpdateArea(); for (int i = 0; i < j; ++i) { _gfxUpdatePlan.SetCurrentUpdate(i); u.CurrentRect = _gfxUpdatePlan.AccumUpdateArea; _drawboard.SetClipRect(u.CurrentRect); //** UpdateInvalidateArea(_drawboard, _topWindowBox, u); _gfxUpdatePlan.ClearCurrentUpdate(); #if DEBUG if (RenderElement.WaitForStartRenderElement) { //should not occur throw new System.NotSupportedException(); } #endif } _gfxUpdatePlan.ResetUpdatePlan(); ReleaseUpdateArea(u); } else { //default mode _drawboard.SetClipRect(_rootgfx.AccumInvalidateRect); UpdateArea u = GetFreeUpdateArea(); //TODO: review clear bg again _drawboard.Clear(Color.White); u.CurrentRect = _rootgfx.AccumInvalidateRect; UpdateInvalidateArea(_drawboard, _topWindowBox, u); _gfxUpdatePlan.ResetUpdatePlan(); ReleaseUpdateArea(u); } //----------- } _rootgfx.EndRenderPhase(); GlobalRootGraphic.CurrentRootGfx = backup; #if DEBUG RootGraphic visualroot = RootGraphic.dbugCurrentGlobalVRoot; if (visualroot.dbug_RecordDrawingChain) { List <dbugLayoutMsg> outputMsgs = dbugOutputWindow.dbug_rootDocDebugMsgs; outputMsgs.Clear(); outputMsgs.Add(new dbugLayoutMsg(null as RenderElement, "[" + debug_render_to_output_count + "]")); visualroot.dbug_DumpRootDrawingMsg(outputMsgs); dbugOutputWindow.dbug_InvokeVisualRootDrawMsg(); debug_render_to_output_count++; } if (dbugHelper01.dbugVE_HighlightMe != null) { dbugOutputWindow.dbug_HighlightMeNow(dbugHelper01.dbugVE_HighlightMe.dbugGetGlobalRect()); } #endif }
public CssIsolateBox(BoxSpec spec, RootGraphic rootgfx) : base(spec, rootgfx) { }
public CustomRenderBox(RootGraphic rootgfx, int width, int height) : base(rootgfx, width, height) { this.BackColor = Color.LightGray; }
public BackBoardRenderElement(RootGraphic rootgfx, int width, int height) : base(rootgfx, width, height) { }
public OpenGLCanvasViewport(RootGraphic root, Size viewportSize) : base(root, viewportSize) { _gfxUpdatePlan = new GfxUpdatePlan(root); }
public CustomTextRun(RootGraphic rootgfx, int width, int height) : base(rootgfx, width, height) { _font = rootgfx.DefaultTextEditFontInfo; }
public abstract RenderElement GetPrimaryRenderElement(RootGraphic rootgfx);