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 11-19-2007, 01:20 PM
Vincent Bergeron
Newsgroup Contributor
 
Posts: n/a
InkPicture and zooming

Hi!

I'm using InkPicture. I got the zooming to work.

What I want, is to resize the InkPicture Height and Width to represent the
new zommed factor.

How can I do that? How can I get the new "canvas" size?

Thanks

VB


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

 
Old 11-19-2007, 01:20 PM
  #2 (permalink)  
Old 11-19-2007, 09:10 PM
Josh Einstein
Newsgroup Contributor
 
Posts: n/a
Re: InkPicture and zooming

Resizing the InkPicture is a bit hacky. You might want to at least put it
inside a scrolling Panel. But anyway, the answer to your question, "how can
I get the new canvas size" is pretty simple. newWidth = (int)(initialWidth *
zoom) And same for the height.

You might have a look at www.infinotes.com. The standard edition can have a
background image and has full zooming support. That is the easiest and most
automatic way. The *right* way however, would be to drop InkPicture and
subclass Panel. Then attach an InkOverlay and add a read/write Image
property. Then in the control's OnPaintBackground method, you can draw the
image using Graphics.DrawImage, scaling it proportionally with the renderer.

A complete example would be a bit more code than I have time to write at the
moment, which is why I also suggested the Infinotes control.

--
Josh Einstein (Tablet PC MVP)
Einstein Technologies
Tablet Enhancements for Outlook - Try it free: www.tabletoutlook.com


"Vincent Bergeron" <info@vincentbergeron.com> wrote in message
news:u7T3xEvKIHA.1208@TK2MSFTNGP05.phx.gbl...
> Hi!
>
> I'm using InkPicture. I got the zooming to work.
>
> What I want, is to resize the InkPicture Height and Width to represent the
> new zommed factor.
>
> How can I do that? How can I get the new "canvas" size?
>
> Thanks
>
> VB
>


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

  #3 (permalink)  
Old 11-20-2007, 11:40 AM
Vincent Bergeron
Newsgroup Contributor
 
Posts: n/a
Re: InkPicture and zooming

Hi Josh.

Thanks for your answer...

> property. Then in the control's OnPaintBackground method, you can draw the
> image using Graphics.DrawImage, scaling it proportionally with the
> renderer.


That's where you lost me. How can I use the renderer to scale a graphic?

Thanks

VB


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

  #4 (permalink)  
Old 11-20-2007, 12:50 PM
Josh Einstein
Newsgroup Contributor
 
Posts: n/a
Re: InkPicture and zooming

That's pretty easy. You can just use InkOverlay.Renderer.Scale(xFactor,
yFactor) which are floating point values that indicate how to scale the
rendered ink. So for example, to zoom to 50% you would pass 0.5 to both
parameters. To zoom at 150%, pass 1.5, etc. Whatever you do, be sure to pass
the same value to both parameters or else you will stretch the ink
non-uniformly in either direction.

For scaling the graphic, you have to use Graphics.DrawImage which just takes
a source and destination rect as opposed to a scale value. But you can
calculate the destination rect (which can be bigger than your client area if
necessary) by just multiplying the width and height of the original by the
same scaling factor that you used on the renderer.

--
Josh Einstein (Tablet PC MVP)
Einstein Technologies
Tablet Enhancements for Outlook - Try it free: www.tabletoutlook.com


"Vincent Bergeron" <info@vincentbergeron.com> wrote in message
news:eZgCQu6KIHA.4272@TK2MSFTNGP05.phx.gbl...
> Hi Josh.
>
> Thanks for your answer...
>
>> property. Then in the control's OnPaintBackground method, you can draw
>> the image using Graphics.DrawImage, scaling it proportionally with the
>> renderer.

>
> That's where you lost me. How can I use the renderer to scale a graphic?
>
> Thanks
>
> VB
>


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

  #5 (permalink)  
Old 11-21-2007, 05:50 AM
Vincent Bergeron
Newsgroup Contributor
 
Posts: n/a
Re: InkPicture and zooming

Hi Josh.

Thanks for your inputs. I got it working very well...

BTW, I'm using Delphi and the COM Ink API to achieve that. It gets me a
little more thinking, but your inputs are very appreciated. I also removed
the InkPicture to use the InkOverlay.

I have one last question, and it's regarding the scrooling.

I can scroll the ink with no problem. I can scroll the background picture
with no problem. But both are not "syncronized". The background picture
moves a lot more than the Ink, or vice versa depending of what I'm trying.

The Transform method scrolls the Ink by X,Y ink space units. So, if my
scrollbar position is set to 10,10, the renderer will scroll it for 10,10
ink space.

My background picture uses pixels to scroll. So I used the
InkSpaceToPixel(10, 10) to get the correct pixel numbers. But the function
alway's returns 0,0.

What am I missing there? Is there a best way to scroll the background
picture?

Thanks

VB


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

  #6 (permalink)  
Old 11-21-2007, 06:30 AM
Josh Einstein
Newsgroup Contributor
 
Posts: n/a
Re: InkPicture and zooming

There's two different ways to achieve what you want, but I'm only familiar
with GDI+ in .NET, not Delphi. In GDI+, you could apply a scale transform to
the Graphics object such that your bitmap offset can be specified in
inkspace, but it's usually more common to do the opposite.

Pass the pixel values of your graphics translation to
Renderer.PixelToInkSpace. Make sure you pass the hDC of the graphics context
on which you're painting and pass the x and y values by reference. They will
be updated with the ink space coordinates of the value you pass in. Then you
can apply a translate transformation to the InkRenderer with those new
values.

And if I had to guess, the reason you were getting 0,0 is because ink space
units are usually very large compared to pixels. And if you were passing
something like 200,200 to InkSpaceToPixel, then it's likely that 0,0 would
be the correct pixel mapping for that value. In other words, you're going in
the wrong direction.

--
Josh Einstein (Tablet PC MVP)
Einstein Technologies
Tablet Enhancements for Outlook - Try it free: www.tabletoutlook.com


"Vincent Bergeron" <info@vincentbergeron.com> wrote in message
news:e0BpySELIHA.1164@TK2MSFTNGP02.phx.gbl...
> Hi Josh.
>
> Thanks for your inputs. I got it working very well...
>
> BTW, I'm using Delphi and the COM Ink API to achieve that. It gets me a
> little more thinking, but your inputs are very appreciated. I also removed
> the InkPicture to use the InkOverlay.
>
> I have one last question, and it's regarding the scrooling.
>
> I can scroll the ink with no problem. I can scroll the background picture
> with no problem. But both are not "syncronized". The background picture
> moves a lot more than the Ink, or vice versa depending of what I'm trying.
>
> The Transform method scrolls the Ink by X,Y ink space units. So, if my
> scrollbar position is set to 10,10, the renderer will scroll it for 10,10
> ink space.
>
> My background picture uses pixels to scroll. So I used the
> InkSpaceToPixel(10, 10) to get the correct pixel numbers. But the function
> alway's returns 0,0.
>
> What am I missing there? Is there a best way to scroll the background
> picture?
>
> Thanks
>
> VB
>


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

  #7 (permalink)  
Old 11-21-2007, 04:10 PM
Vincent Bergeron
Newsgroup Contributor
 
Posts: n/a
Re: InkPicture and zooming

Hi Josh.

Thanks for all your help. It's very appreciated!

VB


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
InkPicture NewInAirPackets not fireing... Vincent Bergeron Tablet PC Developers 2 11-19-2007 10:21 AM
Image zooming Travis Desktop Computers 0 02-06-2007 06:21 PM
Renderer Problems with InkPicture matt Windows XP Tablet PC Newsgroup 1 03-17-2005 09:15 AM
InkPicture, InkCollector & JScript =?Utf-8?B?RnV6eXJhbQ==?= Windows XP Tablet PC Newsgroup 1 07-19-2004 03:20 PM
inkpicture CharlieChau Windows XP Tablet PC Newsgroup 1 06-03-2004 11:21 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 05:07 PM.


2003 - 2009 All Rights Reserved. Technology Questions

Search Engine Friendly URLs by vBSEO 3.3.0