Deep Zoom Aspect Ratio Returning Wrong Value
My MultiScaleImage is returning an aspect ratio of 1, when the image is a 2000x1500 png. What's even more odd, is that the xml metadata shows 1.33 in the aspect ratio tag, but then has a height and width of 1.
What the heck am I missing here?
Thanks for any help!
MetaData:
<Metadata version="1">
<AspectRatio>1.33333333333333</AspectRatio>
<Image>
<FileName>C:\Documents and Settings\asmith\Desktop\Temp\DZComposer\Testing1\Source Images\2000x1500 sample image.png</FileName>
<x>0</x>
<y>0</y>
<Width>1</Width>
<Height>1</Height>
<ZOrder>1</ZOrder>
<Tag />
</Image>
</Metadata>
The dzc_output.xml agrees with this also:
<Collection MaxLevel="8" TileSize="256" Format="jpg" NextItemId="1" ServerFormat="Default" xmlns="http://schemas.microsoft.com/deepzoom/2009">
<Items>
<I Id="0" N="0" Source="dzc_output_images/2000x1500%20sample%20image.xml">
<Size Width="2000" Height="1500" />
<Viewport Width="1" X="-0" Y="-0" />
</I>
</Items>
</Collection>
MSI Declaration:
<MultiScaleImage
x:Name="msi" Grid.Column="1" Grid.Row="1" Width="720" Height="540"
MouseMove="msi_MouseMove"
MouseLeftButtonUp="msi_MouseLeftButtonUp">
</MultiScaleImage>
Property outputs: (based on the msi's mousemove)
Width: 720
Height: 540
AspectRatio: 1
Width / Aspect Ratio: 720
Logical X: 0.55555555556
Logical Y: 0.37361111111
Logical X * Width: 400
Logical Y * Width: 269
Raw X: 400
Raw Y: 269
Viewport Origin: 0,0
Viewport Width: 1
Codebehind that populates property outputs:
private void msi_MouseMove(object sender, MouseEventArgs e)
{
txtWidth.Text = msi.Width.ToString();
txtHeight.Text = msi.Height.ToSt开发者_如何学Cring();
txtAspectRatio.Text = msi.AspectRatio.ToString();
txtWidthDivAR.Text = (msi.Width / msi.AspectRatio).ToString();
Point pLogical = msi.ElementToLogicalPoint(e.GetPosition(msi));
txtMsiX.Text = pLogical.X.ToString();
txtMsiY.Text = pLogical.Y.ToString();
txtLogicYxW.Text = (pLogical.Y * msi.Width).ToString();
txtLogicXxW.Text = (pLogical.X * msi.Width).ToString();
Point pRaw = e.GetPosition(msi);
txtRawX.Text = pRaw.X.ToString();
txtRawY.Text = pRaw.Y.ToString();
txtVPO.Text = msi.ViewportOrigin.ToString();
txtVPW.Text = msi.ViewportWidth.ToString();
}
dzc_output.xml's width and height are original image size in pixels, while aspect ratio in metadata is width and height of MultiScaleImage as a whole. Width and height of image in metadata are logical to multiscaleimage's size.
精彩评论