[Gambas-user] Two extended paint devices at the same time ?

Werner wdahn at ...1000...
Sun May 24 18:41:44 CEST 2009


Andreas Müller wrote:
> Hello,
>
> I have an application wich generates plotting points (x,y) which are
> drawn by a draw.line(x1,y,1,x2,y2) command into some drawing area 'DA'.
>
>         Draw.Begin(DA)
>         Draw.ForeColor = Color.Black
>         Draw.LineStyle = Line.Solid
>         Draw.LineWidth = 1
>         
>         (.. calculate x1,y1,x2,y2 )
>         
>         Draw.Line(x1,y1,x2,y2)
>
> The resolution of the drawing area 'DA' is 500 x 750 points. 
>
> Now I want to "plot" the same points to a printer which has a higher
> resolution of 5000 x 7500 points.
>
>         IF Printer.Setup() THEN RETURN
>         Printer.Orientation = Printer.Landscape
>         Draw.Begin(Printer)
>         
>         ..
>         
>         Draw.End
>         
> The points are calculated with the higher resolution of the printer and
> scaled down for the drawing area output by a factor 10.
>
> Now my question:
>
> The calculation of the plotting points is complex and there are many of
> them (I don't know how many, when the calculation starts). How can I
> draw the points to the drawing area and to the printer without
> calculating them twice and without storing them into some open ended
> list?
>
> It would be nice to have someting like this
>
> Draw.Begin(DA)
> Draw.Begin(printer)
> Begin Loop
>         .. calculation
>         Draw.Line(to DA)
>         Draw.Refresh(to DA)
>         Draw.Line(to printer)
> End Loop
> Draw.End(DA)
> Draw.End(printer)
>
> The second Draw.Begin(printer) generates this error: "An extended paint
> device can only be painted by one QPainter at a time."
>
> best regards
> -andreas
AFAIK you can only have one Draw device open at a time. Also,
Draw.Refresh doesn't do anything while the drawing port is open, in fact
the refresh only happens in the event loop so once at the end of your
routine is enough.
How about doing the calculation before the drawing?





More information about the User mailing list