Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
paint skips coordinates :( help!

Subject: paint skips coordinates :( help!

From: Shamane

Date: 21 Sep, 2009 15:26:20

Message: 1 of 1

Hi All! :)

I am trying to paint different colours on images read in to the GUI, and have managed to do so according to the mouse click and movement. However, now there's one problem. It will only paint freehand if I move my mouse slowly. However, should my mouse move fast, the paint will skip quite a few coordinates and you will only see splashes of dots scattered along the lines I drew. Is there a way to help this? Thank you so much in advance!!

Here's a snippet of the code:

function MouseMotionFcn(gcbo,eventdata,handles)

handles = guidata(gcbo);

if handles.drawFlag
    
clicked = get(gca, 'currentpoint');
 xi = ceil(clicked(1,1));
 yi = ceil(clicked(1,2));
handles.color = handles.mGetColorFcn();

p = plot(xi, yi);
set(p,'marker','.')
set(p,'markersize',30)
set(p,'Color', handles.color);

end

guidata(gcbo,handles);

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us