protected override void RenderClientContent(DrawBoard d, UpdateArea updateArea) { //draw line //we can use vxs/path to render a complex line part //this render element dose not have child node, so //if WaitForStartRenderElement == true, //then we skip rendering its content //else if this renderElement has more child, we need to walk down) if (WaitForStartRenderElement) { return; } if (_stroke != null) { using (d.SetSmoothMode(SmoothingMode.AntiAlias)) { d.DrawRenderVx(_stroke, X0, Y0);//? } } else { using (d.SaveStroke()) using (d.SetSmoothMode(SmoothingMode.AntiAlias)) { d.StrokeWidth = 3; d.DrawLine(X0, Y0, X1, Y1); } } }
public void Render(DrawBoard d, UpdateArea updateArea) { LinkedListNode <RenderElement> node = _linkList.First; Rectangle backup = updateArea.CurrentRect; int enter_canvas_x = d.OriginX; int enter_canvas_y = d.OriginY; while (node != null) { //--------------------------- //TODO: review here again RenderElement renderE = node.Value; if (renderE.IntersectsWith(updateArea)) { int x = renderE.X; int y = renderE.Y; d.SetCanvasOrigin(enter_canvas_x + x, enter_canvas_y + y); updateArea.Offset(-x, -y); RenderElement.Render(renderE, d, updateArea); updateArea.Offset(x, y); } node = node.Next; } updateArea.CurrentRect = backup; //restore d.SetCanvasOrigin(enter_canvas_x, enter_canvas_y); //restore }
public void dbugShowRenderPart(DrawBoard d, UpdateArea updateArea) { RootGraphic visualroot = this.dbugVRoot; if (visualroot.dbug_ShowRootUpdateArea) { d.FillRectangle(Color.FromArgb(50, Color.Black), updateArea.Left, updateArea.Top, updateArea.Width - 1, updateArea.Height - 1); d.FillRectangle(Color.White, updateArea.Left, updateArea.Top, 5, 5); d.DrawRectangle(Color.Yellow, updateArea.Left, updateArea.Top, updateArea.Width - 1, updateArea.Height - 1); Color c_color = d.CurrentTextColor; d.CurrentTextColor = Color.White; d.DrawText(visualroot.dbug_RootUpdateCounter.ToString().ToCharArray(), updateArea.Left, updateArea.Top); if (updateArea.Height > 25) { d.DrawText(visualroot.dbug_RootUpdateCounter.ToString().ToCharArray(), updateArea.Left, updateArea.Top + (updateArea.Height - 20)); } d.CurrentTextColor = c_color; visualroot.dbug_RootUpdateCounter++; } }
static void UpdateInvalidArea(GdiPlusDrawBoard d, IRenderElement rootElement) { int enter_canvasX = d.OriginX; int enter_canvasY = d.OriginY; d.SetCanvasOrigin(enter_canvasX - d.Left, enter_canvasY - d.Top); UpdateArea u = GetFreeUpdateArea(); u.CurrentRect = d.InvalidateArea; if (u.Width > 0 && u.Height > 0) { rootElement.Render(d, u); #if DEBUG rootElement.dbugShowRenderPart(d, u); #endif } else { } d.IsContentReady = true; d.SetCanvasOrigin(enter_canvasX, enter_canvasY);//restore ReleaseUpdateArea(u); }
protected override void RenderClientContent(DrawBoard d, UpdateArea updateArea) { if (_needUpdate) { //default bg => transparent !, //gfx2d.Clear(ColorRGBA.White);//if want opaque bg //ReleaseUnmanagedResources(); //if (bmp != null) //{ // bmp.Dispose(); //} _bmp = _memBmp;// new Bitmap(this.Width, this.Height, this.actualImage.GetBuffer(), false); // canvas.Platform.CreatePlatformBitmap(this.Width, this.Height, this.actualImage.GetBuffer(), false); Image.ClearCache(_bmp); _needUpdate = false; } //canvas.FillRectangle(this.BackColor, 0, 0, this.Width, this.Height); if (_bmp != null) { d.DrawImage(_bmp, new RectangleF(0, 0, this.Width, this.Height)); } //--------------------- #if DEBUG //canvasPage.dbug_DrawCrossRect(PixelFarm.Drawing.Color.Black, // new Rectangle(0, 0, this.Width, this.Height)); #endif }
protected override void RenderClientContent(DrawBoard d, UpdateArea updateArea) { using (Tools.More.BorrowVgPaintArgs(d.GetPainter(), out var paintArgs)) { _renderVx.Paint(paintArgs); } //d.FillRectangle(Color.Blue, 0, 0, 50, 50); }
public void UpdateArea(UpdateArea update) { Area area = _areaRepo.GetAll().Where(a => a.AreaNumber == update.AreaNumber).FirstOrDefault(); area.Amount = update.Amount; _areaRepo.Update(area); _areaRepo.SaveChanges(); }
protected override void RenderClientContent(DrawBoard d, UpdateArea updateArea) { //**** //because our demo may run the 'manual GL code', //(out of state-control of the shader share resource/ current program/ render tree/ //*** _painter.DetachCurrentShader(); _demo.Draw(_painter); }
protected override void RenderClientContent(DrawBoard d, UpdateArea updateArea) { //this render element dose not have child node, so //if WaitForStartRenderElement == true, //then we skip rendering its content //else if this renderElement has more child, we need to walk down) if (WaitForStartRenderElement) { return; } if (ImageBinder == null) { return; } //---------------------------------- switch (ImageBinder.State) { case BinderState.Loaded: { d.FillRectangle(this.BackColor, 0, 0, this.Width, this.Height); d.DrawImage(ImageBinder, new RectangleF( ContentLeft, ContentTop, ContentWidth, ContentHeight)); } break; case BinderState.Unload: { //wait next round ... if (ImageBinder.HasLazyFunc) { ImageBinder.LazyLoadImage(); } else if (ImageBinder is AtlasImageBinder) { //resolve this and draw d.DrawImage(ImageBinder, new RectangleF( ContentLeft, ContentTop, ContentWidth, ContentHeight)); } } break; } #if DEBUG //canvasPage.dbug_DrawCrossRect(PixelFarm.Drawing.Color.Black, // new Rectangle(0, 0, this.Width, this.Height)); #endif }
public override void Draw(DrawBoard d, UpdateArea updateArea) { int bWidth = this.Width; int bHeight = this.Height; #if DEBUG //canvas.dbug_DrawCrossRect(Color.Red, new Rectangle(0, 0, bWidth, bHeight)); //canvas.DrawRectangle(Color.Red, 0, 0, bWidth, bHeight); #endif RunStyle style = this.RunStyle;//must //set style to the canvas switch (EvaluateFontAndTextColor(d, style)) { case DIFF_FONT_DIFF_TEXT_COLOR: { RequestFont prevFont = d.CurrentFont; Color prevColor = d.CurrentTextColor; d.CurrentFont = style.ReqFont; d.CurrentTextColor = style.FontColor; DrawText(d); d.CurrentFont = prevFont; d.CurrentTextColor = prevColor; } break; case DIFF_FONT_SAME_TEXT_COLOR: { RequestFont prevFont = d.CurrentFont; d.CurrentFont = style.ReqFont; DrawText(d); d.CurrentFont = prevFont; } break; case SAME_FONT_DIFF_TEXT_COLOR: { Color prevColor = d.CurrentTextColor; d.CurrentTextColor = style.FontColor; DrawText(d); d.CurrentTextColor = prevColor; } break; default: { DrawText(d); } break; } }
public object Put(UpdateArea request) { var entity = request.ConvertTo <Area>(); return(InTransaction(db => { Logic.Update(entity); return new CommonResponse(Logic.GetById(entity.Id)); })); }
protected override void RenderClientContent(DrawBoard d, UpdateArea updateArea) { //1. save canvas origin, (don't forget to restore this) int enter_canvas_x = d.OriginX; int enter_canvas_y = d.OriginY; //d.FillRectangle(Color.FromArgb(100, Color.Yellow), // _approxRectBounds.Left, // _approxRectBounds.Top, // _approxRectBounds.Width, // _approxRectBounds.Height); foreach (CustomRenderBox renderE in _controlPoints) { int x = renderE.X; int y = renderE.Y; //2. set canvas origin d.SetCanvasOrigin(enter_canvas_x + x, enter_canvas_y + y); //3. offset update area (see opposite direction) updateArea.Offset(-x, -y); //4. RenderElement.Render(renderE, d, updateArea); //5. restore only update area back updateArea.Offset(x, y); } //restore enter canvas x, y d.SetCanvasOrigin(enter_canvas_x, enter_canvas_y); ////lets draw lines that link control points int j = _controlPoints.Count; float strokeW = d.StrokeWidth; Color strokeColor = d.StrokeColor; d.StrokeWidth = 2; d.StrokeColor = Color.Black; for (int i = 1; i < j; ++i) { CustomRenderBox b_0 = _controlPoints[i - 1]; CustomRenderBox b_1 = _controlPoints[i]; d.DrawLine(b_0.X, b_0.Y, b_1.X, b_1.Y); } { CustomRenderBox b_0 = _controlPoints[j - 1]; CustomRenderBox b_1 = _controlPoints[0]; d.DrawLine(b_0.X, b_0.Y, b_1.X, b_1.Y); } //and the last one d.StrokeColor = strokeColor; d.StrokeWidth = strokeW; }
protected override RootGraphic Root => _rootGfx; //*** protected override void RenderClientContent(DrawBoard d, UpdateArea updateArea) { //TODO: implement FillRect() with no blending ... , or FastClear() if (!WaitForStartRenderElement) { //just clear with white? d.FillRectangle(Color.White, 0, 0, this.Width, this.Height); d.TextBackgroundColorHint = Color.White; } base.RenderClientContent(d, updateArea); }
protected override void RenderClientContent(DrawBoard d, UpdateArea updateArea) { base.RenderClientContent(d, updateArea); //4. caret if (RenderCaret && _stateShowCaret && _isEditable) { d.SetClipRect(new Rectangle(0, 0, this.Width, this.Height)); Point textManCaretPos = _editSession.CaretPos; _myCaret.DrawCaret(d, textManCaretPos.X, textManCaretPos.Y); } }
/// <summary> /// Draw the background image of the given box in the given rectangle.<br/> /// Handle background-repeat and background-position values. /// </summary> /// <param name="drawboard">the device to draw into</param> /// <param name="box">the box to draw its background image</param> /// <param name="imageLoadHandler">the handler that loads image to draw</param> /// <param name="rectangle">the rectangle to draw image in</param> public static void DrawBackgroundImage(DrawBoard drawboard, CssBox box, ImageBinder imageBinder, RectangleF rectangle) { Image image = imageBinder.LocalImage; //temporary comment image scale code Size imgSize = new Size(image.Width, image.Height); //new Size(imageLoadHandler.Rectangle == Rectangle.Empty ? imageLoadHandler.Image.Width : imageLoadHandler.Rectangle.Width, // imageLoadHandler.Rectangle == Rectangle.Empty ? imageLoadHandler.Image.Height : imageLoadHandler.Rectangle.Height); // get the location by BackgroundPosition value Point location = GetLocation(box.BackgroundPositionX, box.BackgroundPositionY, rectangle, imgSize); //var srcRect = imageLoadHandler.Rectangle == Rectangle.Empty // ? new Rectangle(0, 0, imgSize.Width, imgSize.Height) // : new Rectangle(imageLoadHandler.Rectangle.Left, imageLoadHandler.Rectangle.Top, imgSize.Width, imgSize.Height); var srcRect = new Rectangle(0, 0, image.Width, image.Height); // initial image destination rectangle var destRect = new Rectangle(location, imgSize); // need to clip so repeated image will be cut on rectangle //Rectangle prevClip = drawboard.CurrentClipRect; //TODO: use u1 from pool UpdateArea u1 = new UpdateArea(); u1.CurrentRect = drawboard.CurrentClipRect; if (drawboard.PushClipAreaRect((int)rectangle.Left, (int)rectangle.Top, (int)rectangle.Width, (int)rectangle.Height, u1)) { switch (box.BackgroundRepeat) { case CssBackgroundRepeat.NoRepeat: drawboard.DrawImage(image, new RectangleF(location, imgSize), new RectangleF(0, 0, image.Width, image.Height)); break; case CssBackgroundRepeat.RepeatX: DrawRepeatX(drawboard, image, rectangle, srcRect, destRect, imgSize); break; case CssBackgroundRepeat.RepeatY: DrawRepeatY(drawboard, image, rectangle, srcRect, destRect, imgSize); break; default: DrawRepeat(drawboard, image, rectangle, srcRect, destRect, imgSize); break; } drawboard.PopClipAreaRect(); } }
private void barUpdate_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { GridView gridView = grcArea.FocusedView as GridView; // ép Gridcontrol về GridView AreaDTO area = new AreaDTO(); area.iMaKV = (string)gridView.GetRowCellValue(gridView.FocusedRowHandle, "iMaKV"); // lấy dữ liêuj area.iTenKV = (string)gridView.GetRowCellValue(gridView.FocusedRowHandle, "iTenKV"); area.iGhiChu = (string)gridView.GetRowCellValue(gridView.FocusedRowHandle, "iGhiChu"); area.iActive = (bool)gridView.GetRowCellValue(gridView.FocusedRowHandle, "iActive"); var frmUpdate = new UpdateArea(area); frmUpdate.ShowDialog(); loadArea(); }
protected override void RenderClientContent(DrawBoard d, UpdateArea updateArea) { // //TODO: review here again //in pure agg, we could bypass the cache/resolve process //and render directly to the target canvas // //if img changed then clear cache and render again MemBitmap.ClearCache(_memBmp); MemBitmap.SetCacheInnerImage(_memBmp, _nativeWin32DC, false);//** set to false because the (life-time) owner of the dc is this class (not the memBmp) _demo.Draw(_painter); //copy from actual image and paint to canvas d.DrawImage(_memBmp, 0, 0); }
public async Task <IActionResult> SaveUpdateArea(UpdateArea updateArea) { try { if (ModelState.IsValid) { await _areaRepository.UpdateArea(_mapper.Map <Area>(updateArea)); return(RedirectToAction(nameof(Index))); } } catch (Exception) { return(BadRequest()); } return(View("EditArea", updateArea)); }
protected override void RenderClientContent(DrawBoard d, UpdateArea updateArea) { //canvas here should be glcanvas //TODO: //1. if the content of glBmp is not changed //we should not render again //2. if we only update some part of texture //may can transfer only that part to the glBmp //------------------------------------------------------------------------- if (GlobalRootGraphic.CurrentRootGfx.HasRenderTreeInvalidateAccumRect) { //update cpu surface part*** DrawBoard board = _glesUIElem.GetDrawBoard(); if (board != null) { board.SetClipRect(updateArea.CurrentRect); board.Clear(Color.White); //clear background, clear with white solid #if DEBUG //_ui.dbugSaveAggBmp("a001.png"); #endif } if (_glesUIElem.HasCpuBlitUpdateSurfaceDel) { _glesUIElem.UpdateCpuBlitSurface(updateArea.CurrentRect); } } _glBmp.UpdateTexture(updateArea.CurrentRect); //------------------------------------------------------------------------- d.DrawImage(_glBmp, 0, 0); //test print text from our GLTextPrinter //_glPainter.FillColor = PixelFarm.Drawing.Color.Black; //_glPainter.DrawString("Hello2", 0, 400); //------------------------------------------------------------------------- }
public IApiResult Update(UpdateArea operation) { var result = operation.ExecuteAsync().Result; if (result is ValidationsOutput) { return(new ApiResult <List <ValidationItem> >() { Data = ((ValidationsOutput)result).Errors }); } else { return(new ApiResult <object>() { Status = ApiResult <object> .ApiStatus.Success }); } }
protected override void RenderClientContent(DrawBoard d, UpdateArea updateArea) { if (_elements != null) { #if DEBUG if (!debugBreaK1) { debugBreaK1 = true; } #endif //*** RenderElemHelper.DrawChildContent( ContentHitTestHint, _elements.GetDrawingIter(), d, updateArea); } }
//------- static void UpdateAllArea(GdiPlusDrawBoard d, IRenderElement topWindowRenderBox) { int enter_canvasX = d.OriginX; int enter_canvasY = d.OriginY; d.SetCanvasOrigin(enter_canvasX - d.Left, enter_canvasY - d.Top); UpdateArea u = GetFreeUpdateArea(); u.CurrentRect = d.Rect; topWindowRenderBox.Render(d, u); #if DEBUG topWindowRenderBox.dbugShowRenderPart(d, u); #endif d.IsContentReady = true; d.SetCanvasOrigin(enter_canvasX, enter_canvasY);//restore ReleaseUpdateArea(u); }
public override bool PushClipAreaRect(int width, int height, UpdateArea updateArea) { //TODO: review here Rectangle intersectRect = Rectangle.Intersect(updateArea.CurrentRect, new Rectangle(0, 0, width, height)); if (intersectRect.Width <= 0 || intersectRect.Height <= 0) { return(false); } else { _clipRectStack.Push(_currentClipRect); _currentClipRect = intersectRect; updateArea.MakeBackup(); updateArea.CurrentRect = intersectRect; //*** update area is changed _gpuPainter.SetClipBox(intersectRect.Left, intersectRect.Top, intersectRect.Right, intersectRect.Bottom); return(true); } }
public static void DrawChildContent(HitTestHint hitTestHint, IEnumerable <RenderElement> drawingIter, DrawBoard d, UpdateArea updateArea) { int enter_canvas_x = d.OriginX; int enter_canvas_y = d.OriginY; switch (hitTestHint) { default: { foreach (RenderElement child in drawingIter) { if (child.IntersectsWith(updateArea) || !child.NeedClipArea) { //if the child not need clip //its children (if exist) may intersect int x = child.X; int y = child.Y; d.SetCanvasOrigin(enter_canvas_x + x, enter_canvas_y + y); updateArea.Offset(-x, -y); RenderElement.Render(child, d, updateArea); updateArea.Offset(x, y); } } //restore d.SetCanvasOrigin(enter_canvas_x, enter_canvas_y); } break; case HitTestHint.HorizontalRowNonOverlap: { bool found = false; foreach (RenderElement child in drawingIter) { if (child.IntersectsWith(updateArea)) { found = true; //if the child not need clip //its children (if exist) may intersect int x = child.X; int y = child.Y; d.SetCanvasOrigin(enter_canvas_x + x, enter_canvas_y + y); updateArea.Offset(-x, -y); RenderElement.Render(child, d, updateArea); updateArea.Offset(x, y); } else if (found) { break; } } //restore d.SetCanvasOrigin(enter_canvas_x, enter_canvas_y); } break; case HitTestHint.VerticalColumnNonOverlap: { bool found = false; foreach (RenderElement child in drawingIter) { if (child.IntersectsWith(updateArea)) { found = true; //if the child not need clip //its children (if exist) may intersect int x = child.X; int y = child.Y; d.SetCanvasOrigin(enter_canvas_x + x, enter_canvas_y + y); updateArea.Offset(-x, -y); RenderElement.Render(child, d, updateArea); updateArea.Offset(x, y); } else if (found) { break; } } d.SetCanvasOrigin(enter_canvas_x, enter_canvas_y); } break; } }
protected override void RenderClientContent(DrawBoard d, UpdateArea updateArea) { //TODO: review here, if (_myHtmlVisualRoot == null) { return; } bool useBackbuffer = d.IsGpuDrawBoard; //useBackbuffer = false; //... TODO: review here, check doc update here? _myHtmlVisualRoot.CheckDocUpdate(); if (useBackbuffer) { PaintVisitor painter = PaintVisitorStock.GetSharedPaintVisitor(_myHtmlVisualRoot, d); if (_builtInBackBuffer == null) { _builtInBackBuffer = painter.CreateOffscreenDrawBoard(this.Width, this.Height); } #if DEBUG painter.dbugDrawDiagonalBox(Color.Blue, this.X, this.Y, this.Width, this.Height); #endif if (!_builtInBackBuffer.IsValid) { //painter.FillRectangle(Color.Red, 0, 0, 100, 100);//debug //painter.DrawText(i.ToString().ToCharArray(), 0, 1, new PointF(0, 0), new SizeF(100, 100)); //debug float backupViewportW = painter.ViewportWidth; //backup float backupViewportH = painter.ViewportHeight; //backup painter.EnterNewDrawboardBuffer(_builtInBackBuffer); //*** switch to builtInBackbuffer painter.SetViewportSize(this.Width, this.Height); if (!_hasAccumRect) { _invalidateRect = new Rectangle(0, 0, Width, Height); } #if DEBUG //System.Diagnostics.Debug.WriteLine("inv_rect:" + _invalidateRect + "," + painter.ToString()); #endif if (painter.PushLocalClipArea( _invalidateRect.Left, _invalidateRect.Top, _invalidateRect.Width, _invalidateRect.Height)) { #if DEBUG //for debug , test clear with random color //another useful technique to see latest clear area frame-by-frame => use random color //painter.Clear(ColorEx.dbugGetRandomColor()); painter.Clear(Color.White); #else painter.Clear(Color.White); #endif _myHtmlVisualRoot.PerformPaint(painter); painter.PopLocalClipArea(); } // _builtInBackBuffer.IsValid = true; _hasAccumRect = false; painter.ExitCurrentDrawboardBuffer(); //*** switch back painter.SetViewportSize(backupViewportW, backupViewportH); //restore viewport size } painter.DrawImage(_builtInBackBuffer.GetImage(), 0, 0, this.Width, this.Height); PaintVisitorStock.ReleaseSharedPaintVisitor(painter); } #if DEBUG else if (dbugPreferSoftwareRenderer && d.IsGpuDrawBoard) { //TODO: review this again *** //test built-in 'shared' software rendering surface DrawBoard cpuDrawBoard = null; if ((cpuDrawBoard = d.GetCpuBlitDrawBoard()) != null) { cpuDrawBoard.Clear(Color.White); PaintVisitor painter = PaintVisitorStock.GetSharedPaintVisitor(_myHtmlVisualRoot, cpuDrawBoard); painter.SetViewportSize(this.Width, this.Height); #if DEBUG painter.dbugDrawDiagonalBox(Color.Blue, this.X, this.Y, this.Width, this.Height); #endif _myHtmlVisualRoot.PerformPaint(painter); PaintVisitorStock.ReleaseSharedPaintVisitor(painter); //then copy from cpu to gpu d.BlitFrom(cpuDrawBoard, X, Y, this.Width, this.Height, 0, 0); } } #endif else { PaintVisitor painter = PaintVisitorStock.GetSharedPaintVisitor(_myHtmlVisualRoot, d); painter.SetViewportSize(this.Width, this.Height); #if DEBUG //System.Diagnostics.Debug.WriteLine(">> 500x500"); painter.dbugDrawDiagonalBox(Color.Blue, this.X, this.Y, this.Width, this.Height); //for debug , test clear with random color //another useful technique to see latest clear area frame-by-frame => use random color //painter.Clear(Color.FromArgb(255, dbugRandom.Next(0, 255), dbugRandom.Next(0, 255), dbugRandom.Next(0, 255))); #endif #if DEBUG //System.Diagnostics.Debug.WriteLine("inv_rect:" + _invalidateRect + "," + painter.ToString()); #endif //painter.SetClipRect(new Rectangle(0, 0, 200, 200)); _myHtmlVisualRoot.PerformPaint(painter); #if DEBUG //System.Diagnostics.Debug.WriteLine("<< 500x500"); //painter.dbugDrawDiagonalBox(Color.Blue, this.X, this.Y, this.Width, this.Height); #endif PaintVisitorStock.ReleaseSharedPaintVisitor(painter); } }
internal void DrawChildContentLcdEffectText(DrawBoard d, UpdateArea updateArea, VisualSelectionRange selRange) { List <TextLineBox> lines = _lines; int renderAreaTop = updateArea.Top; int renderAreaBottom = updateArea.Bottom; bool foundFirstLine = false; int j = lines.Count; int enter_canvasX = d.OriginX; int enter_canvasY = d.OriginY; Rectangle currentClip = d.CurrentClipRect; Color prev_colorHint = d.TextBackgroundColorHint; for (int i = 0; i < j; ++i) { //draw textline, along with visual selection range TextLineBox line = lines[i]; int linetop = line.Top; if (!foundFirstLine) { if (linetop + line.ActualLineHeight < renderAreaTop) { continue; } else { foundFirstLine = true; } } else { if (linetop > renderAreaBottom) { if (VisualLineOverlapped) { //more check if (i < j - 1) { //check next line TextLineBox lowerLine = lines[i + 1]; if (lowerLine.Top - lowerLine.OverlappedTop > linetop) { break; } } } else { break; } } } updateArea.OffsetY(-linetop); //offset switch (selRange.GetLineClip(i, out int clipLeft, out int clipWidth)) {
protected override void RenderClientContent(DrawBoard d, UpdateArea updateArea) { _d = d; base.RenderClientContent(d, updateArea); }
public abstract bool PushClipAreaRect(int left, int top, int width, int height, UpdateArea updateArea);
protected override void RenderClientContent(DrawBoard d, UpdateArea updateArea) { if (ContentBox == null) { return; } // if (EnableDoubleBuffer) { var painter = new PixelFarm.Drawing.Internal.MicroPainter(d); if (_builtInBackBuffer == null) { _builtInBackBuffer = painter.CreateOffscreenDrawBoard(this.Width, this.Height); } if (!_builtInBackBuffer.IsValid) { #if DEBUG System.Diagnostics.Debug.WriteLine("double_buffer_update:" + this.dbug_obj_id + "," + _invalidateRect.ToString()); #endif float backupViewportW = painter.ViewportWidth; //backup float backupViewportH = painter.ViewportHeight; //backup painter.AttachTo(_builtInBackBuffer); //*** switch to builtInBackbuffer painter.SetViewportSize(this.Width, this.Height); if (!_hasAccumRect) { _invalidateRect = new Rectangle(0, 0, Width, Height); } #if DEBUG if (_invalidateRect.Width == 15) { } #endif // if (painter.PushLocalClipArea( // _invalidateRect.Left, _invalidateRect.Top, // _invalidateRect.Width, _invalidateRect.Height)) // { //#if DEBUG // //for debug , test clear with random color // //another useful technique to see latest clear area frame-by-frame => use random color // //painter.Clear(Color.FromArgb(255, dbugRandom.Next(0, 255), dbugRandom.Next(0, 255), dbugRandom.Next(0, 255))); // canvas.Clear(Color.White); //#else // canvas.Clear(Color.White); //#endif // base.RenderBoxContent(canvas, updateArea); // } //if (painter.PushLocalClipArea( // _invalidateRect.Left, _invalidateRect.Top, // _invalidateRect.Width, _invalidateRect.Height)) //{ #if DEBUG //for debug , test clear with random color //another useful technique to see latest clear area frame-by-frame => use random color //painter.Clear(Color.FromArgb(255, dbugRandom.Next(0, 255), dbugRandom.Next(0, 255), dbugRandom.Next(0, 255))); d.Clear(Color.White); #else d.Clear(Color.White); #endif //Rectangle updateArea2 = new Rectangle(0, 0, _builtInBackBuffer.Width, _builtInBackBuffer.Height); Rectangle backup2 = updateArea.CurrentRect; updateArea.CurrentRect = new Rectangle(0, 0, _builtInBackBuffer.Width, _builtInBackBuffer.Height); RenderElement.Render(ContentBox, d, updateArea); updateArea.CurrentRect = backup2; //} //painter.PopLocalClipArea(); // _builtInBackBuffer.IsValid = true; _hasAccumRect = false; painter.AttachToNormalBuffer(); //*** switch back painter.SetViewportSize(backupViewportW, backupViewportH); //restore viewport size } #if DEBUG else { System.Diagnostics.Debug.WriteLine("double_buffer_update:" + dbug_obj_id + " use cache"); } #endif painter.DrawImage(_builtInBackBuffer.GetImage(), 0, 0, this.Width, this.Height); } else { RenderElement.Render(ContentBox, d, updateArea); } }
static void ReleaseUpdateArea(UpdateArea u) { u.Reset(); _updateAreaPool.Push(u); }