From 27fb67b49af7006bca2e4982d0904f37afb9c0b4 Mon Sep 17 00:00:00 2001 From: tslediter Date: Fri, 26 Jan 2024 17:53:23 +0800 Subject: [PATCH] canvas MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 优化 --- funcext/tvclib/twincontrol.tsf | 5 +++-- funcext/tvclib/ugtkinterface.tsf | 3 ++- funcext/tvclib/utslvclauxiliary.tsf | 3 ++- funcext/tvclib/utslvclgdi.tsf | 6 +++--- funcext/tvclib/utvclgraphics.tsf | 13 ++++++++++--- 5 files changed, 20 insertions(+), 10 deletions(-) diff --git a/funcext/tvclib/twincontrol.tsf b/funcext/tvclib/twincontrol.tsf index ff8785d..fac5dd4 100644 --- a/funcext/tvclib/twincontrol.tsf +++ b/funcext/tvclib/twincontrol.tsf @@ -1452,7 +1452,8 @@ type TWinControl = class(tcontrol) rgb := _wapi.CreateRectRgn(outrect[0],outrect[1],outrect[2],outrect[3]); //¿Ø¼þÇøÓò //_wapi.CombineRgn(rgC,rga,rgb,RGN_AND); //¿Ø¼þ»æ»­ÇøÓò //bkrg := _wapi.SelectClipRgn(TheMessage.wparam,rgc); //²Ã¼ôÇøÓò - bkrg := _wapi.SelectClipRgn(TheMessage.wparam,rgb); //²Ã¼ôÇøÓò + //bkrg := + _wapi.SelectClipRgn(TheMessage.wparam,rgb); //²Ã¼ôÇøÓò try pts := it.PaintStruct(); pts._setvalue_("rcpaint",array(outrect[0]-itbounds[0],outrect[1]-itbounds[1],outrect[2]-itbounds[0],outrect[3]-itbounds[1])); @@ -1461,7 +1462,7 @@ type TWinControl = class(tcontrol) it.Perform(ne); _wapi.SetViewportOrgEx(TheMessage.wparam,c[0],c[1],nil); //»Ö¸´»ù×¼µã finally - _wapi.SelectClipRgn(TheMessage.wparam,bkrg); //»Ö¸´ÇøÓò + //_wapi.SelectClipRgn(TheMessage.wparam,bkrg); //»Ö¸´ÇøÓò _wapi.DeleteObject(rgb); //Ïú»ÙÇøÓò end; end diff --git a/funcext/tvclib/ugtkinterface.tsf b/funcext/tvclib/ugtkinterface.tsf index 48d119c..e4fb913 100644 --- a/funcext/tvclib/ugtkinterface.tsf +++ b/funcext/tvclib/ugtkinterface.tsf @@ -4736,11 +4736,12 @@ type tgtkapis = class() //gtk function cairo_applay_pen_style(dc); begin pt := gtk_object_get_data(dc,"pen.style"); - if pt=0x2 then + if pt=0x2 or pt=0x3 or pt=0x4 then begin cairo_set_dash(dc,array(4.0,1.0),2,0); end else cairo_set_dash(dc,array(4.0,0.0),2,0); + return pt=5; end function cairo_draw_round_rectangle(cr,x,y,w,h,r); begin diff --git a/funcext/tvclib/utslvclauxiliary.tsf b/funcext/tvclib/utslvclauxiliary.tsf index 3cd184a..f98c946 100644 --- a/funcext/tvclib/utslvclauxiliary.tsf +++ b/funcext/tvclib/utslvclauxiliary.tsf @@ -2243,11 +2243,12 @@ type TCanvsRgnClipAutoSave=class() FCvsHandle := cvs.Handle; FCrg := FW32api.CreateRectRgn(rec[0],rec[1],rec[2],rec[3]); FBKrg := FW32api.SelectClipRgn(FCvsHandle,FCrg); //²Ã¼ôÇøÓò + FBKrg := nil; end end function Destroy(); begin - if FW32api and FCvsHandle and FBKrg and FCrg then + if FW32api and FCvsHandle {and FBKrg} and FCrg then begin FW32api.SelectClipRgn(FCvsHandle,FBKrg); //»Ö¸´ÇøÓò FW32api.DeleteObject(FCrg); //Ïú»ÙÇøÓò diff --git a/funcext/tvclib/utslvclgdi.tsf b/funcext/tvclib/utslvclgdi.tsf index 6c3f774..d1ba25e 100644 --- a/funcext/tvclib/utslvclgdi.tsf +++ b/funcext/tvclib/utslvclgdi.tsf @@ -2305,13 +2305,13 @@ type TcustomCanvas = class(TSLUIBASE) end return r; end - function SelectClipRgn(rgn); + (*function SelectClipRgn(rgn); begin {** @explan(˵Ã÷) ÉèÖÃÇøÓò %% @param(rgn)(TRgn) Ñ¡ÔñÇøÓò %% **} - if rgn=FRgn then exit; + if rgn and (rgn=FRgn) then exit; r := FRgn; FRgn := rgn; if not HandleAllocated()then exit; @@ -2324,7 +2324,7 @@ type TcustomCanvas = class(TSLUIBASE) end if r is class(trgn)then return r; return r1; - end + end*) function create();override; begin inherited; diff --git a/funcext/tvclib/utvclgraphics.tsf b/funcext/tvclib/utvclgraphics.tsf index 745851b..3aee64d 100644 --- a/funcext/tvclib/utvclgraphics.tsf +++ b/funcext/tvclib/utvclgraphics.tsf @@ -682,9 +682,13 @@ type tg_axes = class(tg_graph) // function paint(cvs);override; begin if not visible then return ; - modify_coordinate_postion(); - inherited; + modify_coordinate_postion(); + r := array(p_left-1,p_top-1,p_left+p_width+1,p_top+p_height+1); + o := new TCanvsRgnClipAutoSave(cvs,r); + inherited; + o := nil; paint_grid(cvs); + for i,v in faxes_objects do //»æÖÆ×ø±ê begin v.paint(cvs); @@ -1330,7 +1334,10 @@ type tg_Polyline = class(tg_graph) end else begin - cvs.draw_polyline().points(xys).draw(); + if fclosed and length(xys)>2 then + cvs.draw_polyline().points( xys union xys[0:0]).draw(); + else + cvs.draw_polyline().points(xys).draw(); end end; mk := markinfo;