parent
5d69525909
commit
eccc96de15
|
|
@ -11,11 +11,14 @@ type tcustomcontrol=class(TWinControl)
|
||||||
begin
|
begin
|
||||||
//odh := canvas.Handle;
|
//odh := canvas.Handle;
|
||||||
Canvas.Handle := dc;
|
Canvas.Handle := dc;
|
||||||
Canvas.ClipRect := PAINTSTRUCT().rcpaint();
|
canvas.font := font;
|
||||||
|
canvas.brush.Color := Color;
|
||||||
|
Canvas.requiregdi();
|
||||||
|
Canvas.rcpaint := PAINTSTRUCT().rcpaint();
|
||||||
try
|
try
|
||||||
Paint();
|
Paint();
|
||||||
finally
|
finally
|
||||||
Canvas.Handle := odh;
|
Canvas.Handle := 0;
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
procedure Paint();override;
|
procedure Paint();override;
|
||||||
|
|
|
||||||
|
|
@ -241,7 +241,12 @@ type TWinControl = class(tcontrol)
|
||||||
begin
|
begin
|
||||||
factivated := false;
|
factivated := false;
|
||||||
FWsPopUp := nv;
|
FWsPopUp := nv;
|
||||||
if HandleAllocated()then RecreateWnd();
|
vb := Visible;
|
||||||
|
if HandleAllocated()then
|
||||||
|
begin
|
||||||
|
RecreateWnd();
|
||||||
|
if vb and nv then show(); //处理顶层窗口的显示
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function GetWsPopUp();virtual;
|
function GetWsPopUp();virtual;
|
||||||
|
|
@ -1257,6 +1262,8 @@ type TWinControl = class(tcontrol)
|
||||||
memdc := _wapi.CreateCompatibleDC(0);
|
memdc := _wapi.CreateCompatibleDC(0);
|
||||||
if not memdc then exit;
|
if not memdc then exit;
|
||||||
oldmp := _wapi.SelectObject(memdc,mbit);
|
oldmp := _wapi.SelectObject(memdc,mbit);
|
||||||
|
_wapi.SaveDC(memdc);
|
||||||
|
_wapi.SetGraphicsMode(memdc,2);
|
||||||
|
|
||||||
{$else}
|
{$else}
|
||||||
cr := ClientRect;
|
cr := ClientRect;
|
||||||
|
|
@ -1280,6 +1287,7 @@ type TWinControl = class(tcontrol)
|
||||||
rc := ps.rcpaint;
|
rc := ps.rcpaint;
|
||||||
|
|
||||||
{$ifdef gdipaint}
|
{$ifdef gdipaint}
|
||||||
|
_wapi.RestoreDC(memdc,-1);
|
||||||
_wapi.BitBlt(dc,rc[0],rc[1],rc[2]-rc[0],rc[3]-rc[1],memdc,rc[0],rc[1],SRCCOPY); //_wapi.BitBlt(dc,c[0],c[1],c[2],c[3],memdc,0,0,SRCCOPY);
|
_wapi.BitBlt(dc,rc[0],rc[1],rc[2]-rc[0],rc[3]-rc[1],memdc,rc[0],rc[1],SRCCOPY); //_wapi.BitBlt(dc,c[0],c[1],c[2],c[3],memdc,0,0,SRCCOPY);
|
||||||
{$else}
|
{$else}
|
||||||
_wapi.SelectClipRgn(memdc,0);
|
_wapi.SelectClipRgn(memdc,0);
|
||||||
|
|
@ -1420,6 +1428,7 @@ type TWinControl = class(tcontrol)
|
||||||
end
|
end
|
||||||
procedure PaintHandler(var TheMessage:TLMPaint); //type_twinctrol
|
procedure PaintHandler(var TheMessage:TLMPaint); //type_twinctrol
|
||||||
begin
|
begin
|
||||||
|
hdc := TheMessage.wparam;
|
||||||
PaintWindow(TheMessage.wparam);
|
PaintWindow(TheMessage.wparam);
|
||||||
//c := ClientRect;
|
//c := ClientRect;
|
||||||
c := array(0,0); //ÉèÖûù×¼µã,Ϊ00 20201112 ÐÞ¸Ä
|
c := array(0,0); //ÉèÖûù×¼µã,Ϊ00 20201112 ÐÞ¸Ä
|
||||||
|
|
|
||||||
|
|
@ -1824,9 +1824,42 @@ type tsgtkapi = class(tgtkapis)
|
||||||
cairo_scale(dc,1,rx/ry);
|
cairo_scale(dc,1,rx/ry);
|
||||||
cairo_translate(dc,0-mx,0-my);
|
cairo_translate(dc,0-mx,0-my);
|
||||||
end
|
end
|
||||||
Function Polygon(hdc :pointer;points:array of integer;n:integer):integer;
|
Function Polygon(dc :pointer;points:array of integer;n:integer):integer;
|
||||||
begin
|
begin
|
||||||
|
if n<3 then return ;
|
||||||
|
x := gtk_object_get_data(dc,"viewport.x");
|
||||||
|
y := gtk_object_get_data(dc,"viewport.y");
|
||||||
|
pc := gtk_object_get_data(dc,"pen.color");
|
||||||
|
brc := gtk_object_get_data(dc,"brush.color");
|
||||||
|
pw := gtk_object_get_data(dc,"pen.width");
|
||||||
|
if pw>0 then cairo_set_line_width(dc,pw);
|
||||||
|
else cairo_set_line_width(dc,1);
|
||||||
|
|
||||||
|
//cairo_move_to(dc,points[0]+x,Points[1]+y);
|
||||||
|
cairo_applay_pen_style(dc);
|
||||||
|
for i := 0 to n-1 do
|
||||||
|
begin
|
||||||
|
cairo_line_to(dc,Points[i,0]+x,Points[i,1]+y);
|
||||||
|
end
|
||||||
|
cairo_line_to(dc,Points[0,0]+x,Points[0,1]+y);
|
||||||
|
if brc=0 then
|
||||||
|
begin
|
||||||
|
cairo_set_source_rgb(dc,0,0,0);
|
||||||
|
end else
|
||||||
|
begin
|
||||||
|
gtk_rgb_color_rgb(brc,rc,gc,bc);
|
||||||
|
cairo_set_source_rgb(dc,rc,gc,bc);
|
||||||
|
end
|
||||||
|
cairo_fill_preserve(dc);
|
||||||
|
if pc=0 then
|
||||||
|
begin
|
||||||
|
cairo_set_source_rgb(dc,0,0,0);
|
||||||
|
end else
|
||||||
|
begin
|
||||||
|
gtk_rgb_color_rgb(pc,rc,gc,bc);
|
||||||
|
cairo_set_source_rgb(dc,rc,gc,bc);
|
||||||
|
end
|
||||||
|
cairo_stroke(dc);
|
||||||
end
|
end
|
||||||
Function PolyBezier(dc :pointer;points:array of integer;n:integer):integer;
|
Function PolyBezier(dc :pointer;points:array of integer;n:integer):integer;
|
||||||
begin
|
begin
|
||||||
|
|
@ -1875,11 +1908,10 @@ type tsgtkapi = class(tgtkapis)
|
||||||
gtk_rgb_color_rgb(pc,rc,gc,bc);
|
gtk_rgb_color_rgb(pc,rc,gc,bc);
|
||||||
cairo_set_source_rgb(dc,rc,gc,bc);
|
cairo_set_source_rgb(dc,rc,gc,bc);
|
||||||
end
|
end
|
||||||
cairo_move_to(dc,points[0]+x,Points[1]+y);
|
|
||||||
cairo_applay_pen_style(dc);
|
cairo_applay_pen_style(dc);
|
||||||
for i := 1 to n-1 do
|
for i := 0 to n-1 do
|
||||||
begin
|
begin
|
||||||
cairo_line_to(dc,Points[i*2]+x,Points[i*2+1]+y);
|
cairo_line_to(dc,Points[i,0]+x,Points[i,1]+y);
|
||||||
end
|
end
|
||||||
cairo_stroke(dc);
|
cairo_stroke(dc);
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -2226,7 +2226,7 @@ type TIniFileExter=class()
|
||||||
ffilename;
|
ffilename;
|
||||||
finiobj;
|
finiobj;
|
||||||
end
|
end
|
||||||
type TCanvsRgnClipAutoSave=class
|
type TCanvsRgnClipAutoSave=class()
|
||||||
{**
|
{**
|
||||||
@expan(说明) 裁剪canvas区域,销毁时还原 %%
|
@expan(说明) 裁剪canvas区域,销毁时还原 %%
|
||||||
**}
|
**}
|
||||||
|
|
|
||||||
|
|
@ -524,7 +524,7 @@ type tcustompen=class(tgdi)
|
||||||
begin
|
begin
|
||||||
w := FWidth;
|
w := FWidth;
|
||||||
end else
|
end else
|
||||||
w := 0;
|
w := 0;
|
||||||
hp := _wapi.CreatePen(FStyle,w,FColor);
|
hp := _wapi.CreatePen(FStyle,w,FColor);
|
||||||
addsource(hp);
|
addsource(hp);
|
||||||
end
|
end
|
||||||
|
|
@ -2339,6 +2339,7 @@ type TcustomCanvas = class(TSLUIBASE)
|
||||||
FFont := new Tcustomfont();
|
FFont := new Tcustomfont();
|
||||||
FFont.Canvas := self;
|
FFont.Canvas := self;
|
||||||
FTEXTMETRICA := new ttagTEXTMETRICA();
|
FTEXTMETRICA := new ttagTEXTMETRICA();
|
||||||
|
_xformobj := new Ttagxform();
|
||||||
end
|
end
|
||||||
function Recycling();override;
|
function Recycling();override;
|
||||||
begin
|
begin
|
||||||
|
|
@ -2627,6 +2628,17 @@ type TcustomCanvas = class(TSLUIBASE)
|
||||||
if HandleAllocated() then requiregdi();
|
if HandleAllocated() then requiregdi();
|
||||||
return new tshapeBezier(self(true));
|
return new tshapeBezier(self(true));
|
||||||
end
|
end
|
||||||
|
function draw_polygon(); //填充折线绘制
|
||||||
|
begin
|
||||||
|
if HandleAllocated() then requiregdi();
|
||||||
|
return new tshapepolygon(self(true));
|
||||||
|
end
|
||||||
|
function draw_polyline(); //折线绘制
|
||||||
|
begin
|
||||||
|
if HandleAllocated() then requiregdi();
|
||||||
|
return new tshapepolyline(self(true));
|
||||||
|
end
|
||||||
|
|
||||||
function draw(name_,points,f,m);
|
function draw(name_,points,f,m);
|
||||||
begin
|
begin
|
||||||
{**
|
{**
|
||||||
|
|
@ -2738,8 +2750,6 @@ type TcustomCanvas = class(TSLUIBASE)
|
||||||
{$ifdef linux}
|
{$ifdef linux}
|
||||||
return r;
|
return r;
|
||||||
{$endif}
|
{$endif}
|
||||||
if not _xformobj then
|
|
||||||
_xformobj := new Ttagxform();
|
|
||||||
_xformobj.em11 := trans[0];
|
_xformobj.em11 := trans[0];
|
||||||
_xformobj.em12 := trans[1];
|
_xformobj.em12 := trans[1];
|
||||||
_xformobj.em21 := trans[2];
|
_xformobj.em21 := trans[2];
|
||||||
|
|
@ -2748,6 +2758,25 @@ type TcustomCanvas = class(TSLUIBASE)
|
||||||
_xformobj.edy := trans[5];
|
_xformobj.edy := trans[5];
|
||||||
return _wapi.SetWorldTransform(FHandle,_xformobj._getptr_);
|
return _wapi.SetWorldTransform(FHandle,_xformobj._getptr_);
|
||||||
end
|
end
|
||||||
|
function trans(ag,x,y);
|
||||||
|
begin
|
||||||
|
{**
|
||||||
|
@explan(说明)文本旋转%%
|
||||||
|
@param(ag)(double) 角度%%
|
||||||
|
**}
|
||||||
|
{$ifdef linux}
|
||||||
|
_wapi.cairo_translate(FHandle,x,y);
|
||||||
|
_wapi.cairo_rotate(FHandle,-ag);
|
||||||
|
return 1;
|
||||||
|
{$endif}
|
||||||
|
_xformobj.em11 := cos(ag);
|
||||||
|
_xformobj.em12 := -sin(ag);
|
||||||
|
_xformobj.em21 := sin(ag);
|
||||||
|
_xformobj.em22 := cos(ag);
|
||||||
|
_xformobj.edx := ifnumber(x)?x:0;
|
||||||
|
_xformobj.edy := ifnumber(y)?y:0;
|
||||||
|
return _wapi.SetWorldTransform(FHandle,_xformobj._getptr_);
|
||||||
|
end
|
||||||
function SetPolyFillMode(md); //ÉèÖÃÌî³äÑùʽ
|
function SetPolyFillMode(md); //ÉèÖÃÌî³äÑùʽ
|
||||||
begin
|
begin
|
||||||
{**
|
{**
|
||||||
|
|
@ -2864,7 +2893,7 @@ type TControlCanvs=class(TcustomCanvas)
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
end
|
end
|
||||||
property ClipRect read FClipRect write SetClipRect;
|
property rcpaint read FClipRect write SetClipRect;
|
||||||
private
|
private
|
||||||
Function SetClipRect(v);
|
Function SetClipRect(v);
|
||||||
begin
|
begin
|
||||||
|
|
@ -3181,6 +3210,54 @@ type tshapechord = class(tshape,tshaperect,tsepoint)
|
||||||
return inherited;
|
return inherited;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
type tshapepolygon = class(tshape)
|
||||||
|
function create(dc);
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
fbpoints := array();
|
||||||
|
end
|
||||||
|
function draw();override;
|
||||||
|
begin
|
||||||
|
if fcanvas and fcanvas.HandleAllocated() and fbpoints then
|
||||||
|
begin
|
||||||
|
fcanvas._wapi.Polygon(fcanvas.handle,fbpoints,length(fbpoints));
|
||||||
|
end
|
||||||
|
return inherited;
|
||||||
|
end
|
||||||
|
function points(ps);virtual;
|
||||||
|
begin
|
||||||
|
tps := array();
|
||||||
|
for i,v in ps do
|
||||||
|
begin
|
||||||
|
if ifarray(v) and ifnumber(v[0]) and ifnumber(v[1]) then
|
||||||
|
begin
|
||||||
|
tps[idx++] := array(v[0],v[1]);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if length(tps)>2 then
|
||||||
|
begin
|
||||||
|
fbpoints := tps;
|
||||||
|
end
|
||||||
|
return self(true);
|
||||||
|
end
|
||||||
|
protected
|
||||||
|
fbpoints;
|
||||||
|
|
||||||
|
end
|
||||||
|
type tshapepolyline = class(tshapepolygon)
|
||||||
|
function create(dc);
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
end
|
||||||
|
function draw();override;
|
||||||
|
begin
|
||||||
|
if fcanvas and fcanvas.HandleAllocated() and fbpoints then
|
||||||
|
begin
|
||||||
|
fcanvas._wapi.polyline(fcanvas.handle,fbpoints,length(fbpoints));
|
||||||
|
end
|
||||||
|
return self(true);
|
||||||
|
end
|
||||||
|
end
|
||||||
type tshapeBezier = class(tshape)
|
type tshapeBezier = class(tshape)
|
||||||
function create(dc);
|
function create(dc);
|
||||||
begin
|
begin
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue