# Pixel

**URL:** <https://forum.xojo.com/t/pixel/49414>\
**Category:** General\
**Created:** [July 18, 2019, 5:30pm UTC](https://forum.xojo.com/t/pixel/49414 "2019-07-18T17:30:20Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eric\_R](https://forum.xojo.com/user_avatar/forum.xojo.com/eric_r/32/2371_2.png) [@Eric\_R](https://forum.xojo.com/u/Eric_R)\
**Post date:** [July 18, 2019, 5:30pm UTC](https://forum.xojo.com/t/pixel/49414/1 "2019-07-18T17:30:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![DaveS](https://forum.xojo.com/letter_avatar_proxy/v4/letter/d/848f3c/32.png) [@DaveS](https://forum.xojo.com/u/DaveS)\
**Post date:** [July 18, 2019, 5:39pm UTC](https://forum.xojo.com/t/pixel/49414/2 "2019-07-18T17:39:15Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Eric\_R](https://forum.xojo.com/user_avatar/forum.xojo.com/eric_r/32/2371_2.png) [@Eric\_R](https://forum.xojo.com/u/Eric_R)\
**Post date:** [July 18, 2019, 6:17pm UTC](https://forum.xojo.com/t/pixel/49414/3 "2019-07-18T18:17:34Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Jeff\_Tullin](https://forum.xojo.com/user_avatar/forum.xojo.com/jeff_tullin/32/693_2.png) [@Jeff\_Tullin](https://forum.xojo.com/u/Jeff_Tullin)\
**Post date:** [July 18, 2019, 6:23pm UTC](https://forum.xojo.com/t/pixel/49414/4 "2019-07-18T18:23:50Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Eric\_R](https://forum.xojo.com/user_avatar/forum.xojo.com/eric_r/32/2371_2.png) [@Eric\_R](https://forum.xojo.com/u/Eric_R)\
**Post date:** [July 18, 2019, 8:34pm UTC](https://forum.xojo.com/t/pixel/49414/5 "2019-07-18T20:34:27Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [April 29, 2021, 4:01pm UTC](https://forum.xojo.com/t/pixel/49414/6 "2021-04-29T16:01:03Z")

</div>


