Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2010-08

[WINCE] Canvas.ClipRect get as Parent coordinate.

21 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Zaher Dirkey

In TGraphicControl Canvas.ClipRect have value depend on the Parent of this control (e.g. Form), while in Win32 it get based on Left and Top of the Control
it is make problem with Controls use Canvas.ClipRect and InvalidateRect, like TGrid.

Lazarus SVN #27109

Thanks in advance.

Zaher Dirkey -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100817/7dd48b57/attachment.html>

Reply by email

Alexander Klenin
to Zaher Dirkey: In TGraphicControl Canvas.ClipRect have value depend on the Parent of this control (e.g.…

2010/8/17 Zaher Dirkey :

Show quoted text 9 lines
In TGraphicControl Canvas.ClipRect have value depend on the Parent of this control (e.g. Form), while in Win32 it get based on Left and Top of the Control it is make problem with Controls use Canvas.ClipRect and InvalidateRect, like TGrid. Lazarus SVN #27109 Thanks in advance.

May be related to http://bugs.freepascal.org/view.php?id=15508 -- similar problem on Win32

Alexander S. Klenin

Reply by email

Zaher Dirkey
to Alexander Klenin
Alexander Klenin wrote 16 lines
2010/8/17 Zaher Dirkey : > In TGraphicControl Canvas.ClipRect have value depend on the Parent of this > control (e.g. Form), while in Win32 it get based on Left and Top of the > Control > it is make problem with Controls use Canvas.ClipRect and InvalidateRect, > like TGrid. > > Lazarus SVN #27109 > > Thanks in advance. May be related to http://bugs.freepascal.org/view.php?id=15508 -- similar problem on Win32

That bug for SetClipRect, the bug in my hand when make InvalidateRect to a for TGraphicControl, in Win32 received correct ClipRect, in WinCE nop I think it is depend on MoveWindowOrg.

PaintControls draw the controls after move the coordinates by call MoveWindowOrg(DC, Left, Top) at this time the ClipRect (ClipBox) must be moved in WinCE but that not happened.

Thanks

Zaher Dirkey -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100817/95824252/attachment.html>

Reply by email

Felipe Monteiro de Carvalho
to Zaher Dirkey

2010/8/17 Zaher Dirkey :

PaintControls draw the controls after move the coordinates by call MoveWindowOrg(DC, Left, Top) at this time the ClipRect (ClipBox) must be moved in WinCE but that not happened.

MoveWindowOrg is very problematic under Windows CE, it basically destroys all native drawing of controls if overused.

Maybe we need a flag which warns the LCL that the platform doesn't support WindowOrg, and then it will use absolute positions like was done before.

Felipe Monteiro de Carvalho

Reply by email

Zaher Dirkey
to Felipe Monteiro de Carvalho

On Tue, Aug 17, 2010 at 8:03 AM, Felipe Monteiro de Carvalho <

Show quoted text 5 lines
wrote: MoveWindowOrg is very problematic under Windows CE, it basically destroys all native drawing of controls if overused.

Yes it is WinCE issue, i have tested with native API, ClipRect not moved to new coordinates, but MoveWindowOrg worked in WinCE

--------------------------------------------------------
procedure TForm1.Paint;
var
  R: TRect;
  sdc: Integer;
begin
  inherited Paint;
  Windows.GetClipBox(Canvas.Handle, @R);
  Log(PrintRect(R));
  sdc := SaveDC(Canvas.Handle);
  MoveWindowOrg(Canvas.Handle, 100, 100);
  Windows.GetClipBox(Canvas.Handle, @R);
  Log(PrintRect(R));
  RestoreDC(Canvas.Handle, sdc);
  Windows.GetClipBox(Canvas.Handle, @R);
  Log(PrintRect(R));
end;
--------------------------------------------------------
The next example it used to test MoveWindowOrg and it is worked,
--------------------------------------------------------
procedure TForm1.Button3Click(Sender: TObject);
var
  R: TRect;
begin
  R:= Rect(10, 100, 60, 150);
  Canvas.Brush.Style := bsClear;
  Canvas.Pen.Color := clGreen;
  Canvas.Rectangle(R);
  MyMoveWindowOrg(Canvas.Handle, 50, 50);
  Canvas.Brush.Style := bsClear;
  Canvas.Pen.Color := clGreen;
  Canvas.Rectangle(R);
end;
--------------------------------------------------------

What if implement the GetClipRect in WinCE wedgetset to offset the rect depenf on the new coordinaed by call GetWindowsOrgEx, I will test it

function TWinCEWidgetSet.GetClipBox(DC : hDC; lpRect : PRect) : Longint;
var
  P: TPoint;
begin
  Result := Windows.GetClipBox(DC, Windows.LPRECT(lpRect));
  LCLIntf.GetWindowOrgEx(DC, @P);
  OffsetRect(lpRect^, -P.x, -P.y);
end;

Thanks

Zaher Dirkey -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100817/ee9de298/attachment-0001.html>

Reply by email

Zaher Dirkey
to Felipe Monteiro de Carvalho: 2010/8/17 Zaher Dirkey : MoveWindowOrg is very problematic under Windows CE, it basically…

On Tue, Aug 17, 2010 at 8:03 AM, Felipe Monteiro de Carvalho <

Show quoted text 8 lines
wrote: 2010/8/17 Zaher Dirkey : Maybe we need a flag which warns the LCL that the platform doesn't support WindowOrg, and then it will use absolute positions like was done before.

Hi,
Before #22551 the WinCE and my controls work perfect in all devices that i have, now i have this problems, what it is changed why we lost that, not only ClipRect, it is drawing the Graphic controls on Sony Ericsson X1 Xperia, it have special DC (Canvas), i still work on it to understand the problem.

Thanks

Zaher Dirkey -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100817/4a724fb9/attachment.html>

Reply by email

Zaher Dirkey
to Zaher Dirkey
Zaher Dirkey wrote 11 lines
Hi, Before #22551 the WinCE and my controls work perfect in all devices that i have, now i have this problems, what it is changed why we lost that, not only ClipRect, it is drawing the Graphic controls on Sony Ericsson X1 Xperia, it have special DC (Canvas), i still work on it to understand the problem. Thanks This images with original size.

I-Mate Shapes draw as it designed
http://flic.kr/p/8taG5n

X1 Hi density screen, it do somthing to make the control bigger, but there is trouble in draw Shapes
http://flic.kr/p/8tdFXL

Zaher Dirkey -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100817/f20a0449/attachment.html>

Reply by email

Felipe Monteiro de Carvalho
to Zaher Dirkey

I only see 2 screenshots, without any information about how the drawing is being done, if the app is hiresaware, why it should be wrong, etc.

The code of the app would be good too.

Felipe Monteiro de Carvalho

Reply by email

Zaher Dirkey
to Felipe Monteiro de Carvalho

On Tue, Aug 17, 2010 at 11:53 PM, Felipe Monteiro de Carvalho <

Show quoted text 10 lines
wrote: I only see 2 screenshots, without any information about how the drawing is being done, if the app is hiresaware, why it should be wrong, etc. The code of the app would be good too. -- Felipe Monteiro de Carvalho

Thanks for your replay.

First screen I-Mate the good, the second the bad drawing for the same app.

Zaher Dirkey -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100817/69b55764/attachment.html>

Reply by email

Zaher Dirkey
to Felipe Monteiro de Carvalho: I only see 2 screenshots, without any information about how the drawing is being done, if…

On Tue, Aug 17, 2010 at 11:53 PM, Felipe Monteiro de Carvalho <

Show quoted text 6 lines
wrote: I only see 2 screenshots, without any information about how the drawing is being done, if the app is hiresaware, why it should be wrong, etc.

The code of the app would be good too.

We can add ExcludeClipRect to GetClibBox (Canvas.ClipRect) , ExcludeClipRect the rect must offset before call it, depend on the SetWindowOrgEx values.

Best regards

Zaher Dirkey -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100818/87cadc92/attachment.html>

Reply by email

Zaher Dirkey
to Felipe Monteiro de Carvalho

On Wed, Aug 18, 2010 at 8:41 AM, Felipe Monteiro de Carvalho <

Show quoted text 13 lines
wrote: Hello, Could you please paste the code that you are using to draw? Without actual code it is hard to guess the problem. thanks, -- Felipe Monteiro de Carvalho I am sorry i post it in the forums,

http://lazarus.freepascal.org/index.php/topic,10237.new.html#new Include the example to test the problem.

Zaher Dirkey -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100819/216fa374/attachment.html>

Reply by email

Felipe Monteiro de Carvalho
to Felipe Monteiro de Carvalho

I just checked your code. Indeed, I think that SetWindowOrg is somehow badly affecting the ClipRect.

But, on the other hand, are you aware that you can make your drawing without any use of the ClipRect? You just need to draw everything to a TBitmap and then copy the bitmap in one quick step to the screen.

Using a TCustomControl descendent instead of a TGraphicControl will probably also help.

It would be good if you could add this to the bug tracker and upload there the test app as well.

thanks,

Felipe Monteiro de Carvalho

Reply by email

Zaher Dirkey
to Felipe Monteiro de Carvalho: I just checked your code. Indeed, I think that SetWindowOrg is somehow badly affecting…

On Fri, Aug 20, 2010 at 12:31 PM, Felipe Monteiro de Carvalho <

Show quoted text 6 lines
wrote: I just checked your code. Indeed, I think that SetWindowOrg is somehow badly affecting the ClipRect. Yes i think it is bug in Windows CE :-P
But, on the other hand, are you aware that you can make your drawing without any use of the ClipRect? You just need to draw everything to a TBitmap and then copy the bitmap in one quick step to the screen.

Double buffer eat the memory, and slow painting in slow devices.

Using a TCustomControl descendent instead of a TGraphicControl will probably also help.

Yes it is help, but my controls worked for more than 2 years with my customer hands on slow devices, why i should now to convert to heavy kind controls, TGraphicControl more light for me.

It would be good if you could add this to the bug tracker and upload there the test app as well.

I will make a patch to resolve that problem (just correcting the rect of ClipRect and ExcludeClipRect in WinCE wedgets) and post it with bug tracker.

Thanks

Zaher Dirkey -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100820/ea7cb6fd/attachment.html>

Reply by email

Zaher Dirkey
to Zaher Dirkey
Zaher Dirkey wrote
I will make a patch to resolve that problem (just correcting the rect of ClipRect and ExcludeClipRect in WinCE wedgets) and post it with bug tracker.

I posted a bug tracker with a patch
http://bugs.freepascal.org/view.php?id=17249

Thanks

Zaher Dirkey -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100823/7fc99f43/attachment.html>

Reply by email

Zaher Dirkey
to Zaher Dirkey
Zaher Dirkey wrote 10 lines
On Fri, Aug 20, 2010 at 3:03 PM, Zaher Dirkey wrote: > I will make a patch to resolve that problem (just correcting the rect of > ClipRect and ExcludeClipRect in WinCE wedgets) and post it with bug tracker. > > I posted a bug tracker with a patch http://bugs.freepascal.org/view.php?id=17249

Hi, i reopened the bug with new patch.

Thanks in advance.

Zaher Dirkey -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100831/542400aa/attachment.html>

Reply by email