Technology Questions

Go Back   Technology Questions > Hardware Questions > Mobile Computers > Tablet PC > Tablet PC Software > Tablet PC Developers

Tablet PC Developers Show off your work while discussing with others how to create ink enabled applications.

Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old 06-27-2007, 08:50 AM
Josef Meile
Newsgroup Contributor
 
Posts: n/a
Erasing stroke segments

Hi,

I'm trying to implement some kind of PointErase instead of StrokeErase. I
need to
implement an eraser tool that deletes physically segments of existing
strokes. So,
here is how it should work: the user selects the eraser tool, next, he will
see that
the PenTip changed an now it is bigger. Then, he will be able to delete
parts of
strokes by pushing and dragging the mouse over them. Afterwards, I will
integrate
this eraser tool into a whiteboard, so, if the user erases something
locally, it must
be erased on the remote whiteboards.

After searching the web, I found this message posted on this forum:

* Questions about erasing ink:
http://tinyurl.com/2ecby2

It helped me a lot with some ideas and code; however, now I'm stuck and don't
seem to solve my problem.

First, I took the inkErase sample from the tablet-PC SDK and add my code to
delete
ink. Here is how I did:

1) Instead changing to PointErase Mode, I set the "RasterOperation" from the
DefaultDrawingAttributes of my InkCollector to "White", so, as soon as the
user
push and drags the mouse, he will see a white stroke. I also changed the
width of
the stroke in order to make it much bigger than a normal stroke, so, you
will see a
big circle instead of the normal PenTip.

2) After the user releases the mouse button, the "Stroke" event of my
InkCollector
will be fired. Inside this handler, I will first look for the intersection
points the white
stroke with other strokes.

3) Then for each intersection, I will search the strokes near to this point
by using a
HitTest with a radious equal to the width of the white stroke.

4) For each found stroke, I will get the points intersecting the rectangle
sorrounding the intersection point. To do this I use the
GetRectangleIntersections
method. Here I will get, most of the time, two indexes.

5) For each found set of points, I will split the stroke first at the
EndIndex, then at
the BeginIndex. Finally I will delete the resulting stroke.

This is working somehow. The only problem I saw is that the white stroke
will only
intersect another stroke, if the mouse pointer center crosses it. Otherwise,
if the
white stroke just touches the other stroke, it won't be detected as an
intersection. I
guess this is because a stroke is strored as a collection of points and
points don't
have a width or a height, so it doesn't matter if you see a thick stroke on
the
screen it will be in reality a thin polyline. Does anybody know how to
detect this
type of collitions?

Best regards
Josef
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

 
Old 06-27-2007, 08:50 AM
  #2 (permalink)  
Old 06-27-2007, 09:10 AM
Josef Meile
Newsgroup Contributor
 
Posts: n/a
RE: Erasing stroke segments

Hi again,

I think I found an easier way of doing this. I haven't tested it yet, but I
think it
should work:

Instead of waiting that the "Stroke" event is fired, track the mouseMove
event and
do a realtime HitTest (that's how the EraseInk sample does it). So I will
find the hit
strokes, then I can use the "GetRectangleIntersections" method to split the
hit strokes and erase the segments.

I don't know yet how performance is, but if somebody has a better idea, I'm
all
ears. My initial idea of wainting till the eraser stroke was completed was
to do the
hard work at the end, but as I exposed before it didn't work.


"Josef Meile" wrote:

> Hi,
>
> I'm trying to implement some kind of PointErase instead of StrokeErase. I
> need to
> implement an eraser tool that deletes physically segments of existing
> strokes. So,
> here is how it should work: the user selects the eraser tool, next, he will
> see that
> the PenTip changed an now it is bigger. Then, he will be able to delete
> parts of
> strokes by pushing and dragging the mouse over them. Afterwards, I will
> integrate
> this eraser tool into a whiteboard, so, if the user erases something
> locally, it must
> be erased on the remote whiteboards.
>
> After searching the web, I found this message posted on this forum:
>
> * Questions about erasing ink:
> http://tinyurl.com/2ecby2
>
> It helped me a lot with some ideas and code; however, now I'm stuck and don't
> seem to solve my problem.
>
> First, I took the inkErase sample from the tablet-PC SDK and add my code to
> delete
> ink. Here is how I did:
>
> 1) Instead changing to PointErase Mode, I set the "RasterOperation" from the
> DefaultDrawingAttributes of my InkCollector to "White", so, as soon as the
> user
> push and drags the mouse, he will see a white stroke. I also changed the
> width of
> the stroke in order to make it much bigger than a normal stroke, so, you
> will see a
> big circle instead of the normal PenTip.
>
> 2) After the user releases the mouse button, the "Stroke" event of my
> InkCollector
> will be fired. Inside this handler, I will first look for the intersection
> points the white
> stroke with other strokes.
>
> 3) Then for each intersection, I will search the strokes near to this point
> by using a
> HitTest with a radious equal to the width of the white stroke.
>
> 4) For each found stroke, I will get the points intersecting the rectangle
> sorrounding the intersection point. To do this I use the
> GetRectangleIntersections
> method. Here I will get, most of the time, two indexes.
>
> 5) For each found set of points, I will split the stroke first at the
> EndIndex, then at
> the BeginIndex. Finally I will delete the resulting stroke.
>
> This is working somehow. The only problem I saw is that the white stroke
> will only
> intersect another stroke, if the mouse pointer center crosses it. Otherwise,
> if the
> white stroke just touches the other stroke, it won't be detected as an
> intersection. I
> guess this is because a stroke is strored as a collection of points and
> points don't
> have a width or a height, so it doesn't matter if you see a thick stroke on
> the
> screen it will be in reality a thin polyline. Does anybody know how to
> detect this
> type of collitions?
>
> Best regards
> Josef

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #3 (permalink)  
Old 06-28-2007, 07:10 AM
Stefan Wick[MS]
Newsgroup Contributor
 
Posts: n/a
RE: Erasing stroke segments

Hi Josef,

that approach should work OK. You might have to fine tune it a little bit to
get the right balance between accuracy and performance.

Just curious: why is the built-in point-erase functionality in the
InkOverlay not sufficient for your scenario?

Thanks,
Stefan Wick

Microsoft - Windows Experience

"Josef Meile" wrote:

> Hi again,
>
> I think I found an easier way of doing this. I haven't tested it yet, but I
> think it
> should work:
>
> Instead of waiting that the "Stroke" event is fired, track the mouseMove
> event and
> do a realtime HitTest (that's how the EraseInk sample does it). So I will
> find the hit
> strokes, then I can use the "GetRectangleIntersections" method to split the
> hit strokes and erase the segments.
>
> I don't know yet how performance is, but if somebody has a better idea, I'm
> all
> ears. My initial idea of wainting till the eraser stroke was completed was
> to do the
> hard work at the end, but as I exposed before it didn't work.
>


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #4 (permalink)  
Old 06-28-2007, 08:40 AM
Josef Meile
Newsgroup Contributor
 
Posts: n/a
RE: Erasing stroke segments

Hi Stefan,

> Just curious: why is the built-in point-erase functionality in the
> InkOverlay not sufficient for your scenario?

Now I'm using ConferenceXP with a smartboard. The whiteboard functionality of
this tool implements StrokeErasing, but I need to only delete segments of a
stroke
and need that this appears almost simultaneally in to the remote station.

PointErase works good for the local station; however, when sending the
transparent stroke to the remote station, it won't cover the deleted
strokes. I guess
that's because the other inkoverlay's end is in EditingMode and not in
ErasingMode
and the ink width is also diferent than the one that I use in Erasing mod.
Changing
the overlay's mode at the other end may create unexpected results while a
person
is also drawing something.

Futhermore, if I just send white strokes, they will cover the erased
strokes, but
each time the overlay gets painted, you will see shortly what you erased
before.
That's why I need to delete them for complete.

Best regards
Josef
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calculating the Size of letters, Breaking down stroke information U of M GradMan Tablet PC Developers 2 05-15-2007 05:30 AM
How to assign a character to a key stroke Pete L Windows XP 5 01-24-2007 03:30 PM
Keyboard stroke ctrl+space bw Windows XP 0 01-04-2007 02:08 AM
erasing? Mike Windows XP Tablet PC Newsgroup 2 03-11-2005 09:15 PM
"shift-R click" with a pen stroke (ie without a keyboard) =?Utf-8?B?Q3JhaWc=?= Windows XP Tablet PC Newsgroup 4 05-26-2004 10:16 PM


New To Technology Questions? Do You Need Help with Your Computer or Device? Do You Need Help with this site?

All times are GMT -8. The time now is 03:32 PM.


2003 - 2009 All Rights Reserved. Technology Questions

Search Engine Friendly URLs by vBSEO 3.3.0