Pixel

I’m working on a project and I was going through the language reference and noticed that Graphics.Pixel is deprecated and should use RGBSurface. It states that “Pixel manipulations using the RGBSurface property are faster than the same manipulations using the Graphics class methods”

However I find this not to be the case at least for what I’m doing.

In my project I have a canvas and a timer.

In the timer I have
canvas.Invalidate.

In the canvas paint event I have something like this -

select case somenumber

case 1
drawsomething(g,somevalue)// which use some algorithms and g.Pixel
case 2
.
.
.
.

G.pixel works great.
I tried to use what was in the examples in the language ref for RGBSurface Pixel and unless I did something wrong, it is vastly slower than g.Pixel for what I’m doing.

XOJO 2018 r3
Mac OS 10.14.5

why not create a PICTURE object and manipulate that (using RGBSurface if necessary)
and in the Canvas PAINT event, just draw the picture. this way you can cache the picture and it should speed things up alot

I had tried that before and it was slower, however I think I might of use floodfill as well for “erasing” what was drawn.

I’ll try it again with some modification and see what happens.

Thanks.

Im finding the same. I think it differs between Mac and Windows.
Currently looking into options from MBS

Ok I got it to speed up quite a bit but its was still slightly slower than g.pixel. I also noticed the graphics where kinds of “muddy” if you will. Then it hit me, antialias. So I turned it off and now I think the speed is where it should be. I don’t have any FPS calc’s so…

Anyway I still have more methods to go though but seems to be working except for one, it seems to have lost a small bit the visual effects it had with g.pixel, not sure why. However it’s not by much. I can live with it.

Thanks.