# Moving rects produced by FillRect

**URL:** <https://psychtoolbox.discourse.group/t/moving-rects-produced-by-fillrect/714>\
**Category:** Uncategorized\
**Created:** [October 6, 2005, 1:30am UTC](https://psychtoolbox.discourse.group/t/moving-rects-produced-by-fillrect/714 "2005-10-06T01:30:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sethegger1313](https://avatars.discourse-cdn.com/v4/letter/s/f17d59/32.png) [@sethegger1313](https://psychtoolbox.discourse.group/u/sethegger1313)\
**Post date:** [October 6, 2005, 1:30am UTC](https://psychtoolbox.discourse.group/t/moving-rects-produced-by-fillrect/714/1 "2005-10-06T01:30:03Z")

</div>

Hi all,  
I am curious if there is a function that allows PTB users to move the  
contents of a group of   
pixels to another location quickly and return the original pixel  
group to the background   
color.  
  
I want to use Screen('fillrect') to create small dots on the screen  
and then move them to   
another location in real-time (not a premade movie). However,  
'fillrect' puts limitations on   
the amount of dots I can produce each frame and, to my knowledge, how  
many dots I can   
move. This is because (the way I am doing this), in order to "move"  
a dot, I need to not   
only call 'fillrect' to fill the new dot location, but I need to  
'fillrect' to change the old dot   
location back to the background. This means that can make (about)  
two fewer new dots   
than if I didn't move any dots. Depending on how many dots I want to  
move between   
frames, this can be QUITE costly to my ability to produce new dots  
elsewhere.  
  
If I could quickly move the dots to another location, however, I  
would not have to make   
two extra calls to 'fillrect' per moved dot and the cost in time to  
move dots would   
(hopefully) by much less.  
  
I looked trough all the screen commands without any luck and a search  
of topics related to   
moving onscreen stimuli on the forum didn't turn up any help either.   
Of note, I did read a   
post (1182) that mentioned a MoveRect, ShiftRect, or RectShift  
function. I have no idea   
what exactly that refers to.  
  
Thanks for your help,  
Seth

---

<div class="post-metadata">

**Author:** ![anblick](https://avatars.discourse-cdn.com/v4/letter/a/48db29/32.png) [@anblick](https://psychtoolbox.discourse.group/u/anblick)\
**Post date:** [October 6, 2005, 5:30pm UTC](https://psychtoolbox.discourse.group/t/moving-rects-produced-by-fillrect/714/2 "2005-10-06T17:30:10Z")

</div>

Which version of the PTB are you using? For OSX there is a DrawDots   
command. If you are using OS9, I have a drawdots.mex file that will   
do what you want. If you're using Windows, I don't know whether   
anyone has written a fast dot drawing routine.  
  
keith  
  

> On Oct 5, 2005, at 9:30 PM, sethegger1313 wrote:  
>    
> \> Hi all,  
> \> I am curious if there is a function that allows PTB users to move the  
> \> contents of a group of  
> \> pixels to another location quickly and return the original pixel  
> \> group to the background  
> \> color.  
> \>  
> \> I want to use Screen('fillrect') to create small dots on the screen  
> \> and then move them to  
> \> another location in real-time (not a premade movie). However,  
> \> 'fillrect' puts limitations on  
> \> the amount of dots I can produce each frame and, to my knowledge, how  
> \> many dots I can  
> \> move. This is because (the way I am doing this), in order to "move"  
> \> a dot, I need to not  
> \> only call 'fillrect' to fill the new dot location, but I need to  
> \> 'fillrect' to change the old dot  
> \> location back to the background. This means that can make (about)  
> \> two fewer new dots  
> \> than if I didn't move any dots. Depending on how many dots I want to  
> \> move between  
> \> frames, this can be QUITE costly to my ability to produce new dots  
> \> elsewhere.  
> \>  
> \> If I could quickly move the dots to another location, however, I  
> \> would not have to make  
> \> two extra calls to 'fillrect' per moved dot and the cost in time to  
> \> move dots would  
> \> (hopefully) by much less.  
> \>  
> \> I looked trough all the screen commands without any luck and a search  
> \> of topics related to  
> \> moving onscreen stimuli on the forum didn't turn up any help either.  
> \> Of note, I did read a  
> \> post (1182) that mentioned a MoveRect, ShiftRect, or RectShift  
> \> function. I have no idea  
> \> what exactly that refers to.  
> \>  
> \> Thanks for your help,  
> \> Seth  
> \>  
> \>  
> \>  
> \>  
> \>  
> \>  
> \> ------------------------ Yahoo! Groups Sponsor --------------------   
> \> ~--\>  
> \> Get fast access to your favorite Yahoo! Groups. Make Yahoo! your   
> \> home page  
> \> [http://us.click.yahoo.com/dpRU5A/wUILAA/yQLSAA/BEfwlB/TM](http://us.click.yahoo.com/dpRU5A/wUILAA/yQLSAA/BEfwlB/TM)  
> \> --------------------------------------------------------------------   
> \> ~-\>  
> \>  
> \> Post your message to: [psychtoolbox@yahoogroups.com](mailto:psychtoolbox@yahoogroups.com)  
> \> Please indicate OS9, OSX, or WIN version, and include your full name.  
> \> Denis Pelli, David Brainard, and Allen Ingling.  
> \> [http://psychtoolbox.org](http://psychtoolbox.org)  
> \>  
> \> Yahoo! Groups Links  
> \>  
> \>  
> \>  
> \>  
> \>  
> \>  
> \>  
> \>  
> \>  
> \>
