Howdy,
When I create a graphicscontext as shown below:
gc = wx.GraphicsContext_Create(canvas)
I could not find a gc.DrawPoint method similar to dc.DrawPoint. Is
there a way to paint a pixel with GraphicsContext?
Regards,
Fahri
Howdy,
When I create a graphicscontext as shown below:
gc = wx.GraphicsContext_Create(canvas)
I could not find a gc.DrawPoint method similar to dc.DrawPoint. Is
there a way to paint a pixel with GraphicsContext?
Regards,
Fahri
You can draw a circle with a very small radius instead of a point.
I guess the reason why no DrawPoint is there is because a point does not make sense with GCs when using a scaling transform. Would it neglect the scaling and remain a point? Or would it expand and take some kind of shape (circle, box)?
-Matthias
Am 16.12.2008, 02:03 Uhr, schrieb Fahreddın Basegmez <mangabasi@gmail.com>:
Howdy,
When I create a graphicscontext as shown below:
gc = wx.GraphicsContext_Create(canvas)
I could not find a gc.DrawPoint method similar to dc.DrawPoint. Is
there a way to paint a pixel with GraphicsContext?
Howdy,
When I create a graphicscontext as shown below:
gc = wx.GraphicsContext_Create(canvas)
I could not find a gc.DrawPoint method similar to dc.DrawPoint. Is
there a way to paint a pixel with GraphicsContext?You can draw a circle with a very small radius instead of a point.
I guess the reason why no DrawPoint is there is because a point does not
make sense with GCs when using a scaling transform. Would it neglect the
scaling and remain a point? Or would it expand and take some kind of shape
(circle, box)?-Matthias
_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users
Most 2D graphics libraries that I know which support affine
transformations with matrices treat scaling as a matrix operation on
coordinates.
>Sx 0 0|
SM = |0 Sy 0|
>0 0 1|
And 2D points are usually represented as
P = |x, y, 1|.
To scale points we just multiply the point with the transformation matrix.
P * SM = |xSx, ySy, 1|
And the result is another point at a different location.
This operation can be used not only for scaling but also reflecting
points about x and/or y axes by assigning Sy and Sx values as -1
respectively. Since most libraries define the origin at the upper
left corner and positive y axis from top to bottom, scaling becomes
very useful for coordinate system transformations as well.
Matthias, you bring up an interesting point; do we consider points as
graphical entities or mathematical entities? For the former it may
make sense to scale the point's size as well. Either rectangle or
ellipse shaped points would be OK. I know only one graphics library
that support this kind of scaling transformation which is Processing.
In Processing, points are scaled as rectangular shapes. It also
changes the line thicknesses with scaling as well.
As far as I know, OpenGL, Java AWT, DirectX, etc. do not change point
size with scaling operation but do support some sort of a DrawPoint
operation.
Maybe ideally both ways should be supported with a flag or something.
I tested both gc.DrawEllipse(x, y, 1, 1) and gc.DrawRectangle(x, y, 1,
1) against dc.DrawPoint(x, y) for 100000 random points several times.
These are the results from my PC.
gc.DrawEllipse: ~14 seconds
gc.DrawRectangle: ~ 14 seconds
dc.DrawPoints: ~ 7 seconds
Although the difference is significant, it is not a show stopper
unless there are tens of thousands of pixels to be colored.
Fahri
On Mon, Dec 15, 2008 at 9:03 PM, Nitro <nitro@dr-code.org> wrote:
Am 16.12.2008, 02:03 Uhr, schrieb Fahreddın Basegmez <mangabasi@gmail.com>: