Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix of QOI textures display on different system scale setting. #948

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions UndertaleModLib/Util/QoiConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public unsafe static Bitmap GetImageFromSpan(ReadOnlySpan<byte> bytes, out int l
ReadOnlySpan<byte> pixelData = bytes.Slice(12, length);

Bitmap bmp = new Bitmap(width, height, PixelFormat.Format32bppArgb);
bmp.SetResolution(96.0f, 96.0f);

BitmapData data = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
if (data.Stride != width * 4)
Expand Down
2 changes: 1 addition & 1 deletion UndertaleModTool/Converters/MaskImageConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace UndertaleModTool
{
public class MaskImageConverer : IMultiValueConverter
public class MaskImageConverter : IMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
Expand Down
3 changes: 2 additions & 1 deletion UndertaleModTool/Editors/UndertaleEmbeddedTextureEditor.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>

<Viewbox Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3" Stretch="Uniform" StretchDirection="DownOnly">
<Viewbox Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3" Stretch="Uniform" StretchDirection="DownOnly"
SnapsToDevicePixels="True" RenderOptions.BitmapScalingMode="NearestNeighbor">
<Border>
<Border.Background>
<DrawingBrush Stretch="None" TileMode="Tile" Viewport="0,0,20,20" ViewportUnits="Absolute">
Expand Down
5 changes: 3 additions & 2 deletions UndertaleModTool/Editors/UndertaleSpriteEditor.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,12 @@
<StackPanel Name="MaskEditor">
<Viewbox Stretch="None">
<Border BorderThickness="2" BorderBrush="Gray" Name="MaskBorder">
<Image Stretch="None" Name="MaskImage">
<Image Stretch="None" Name="MaskImage"
SnapsToDevicePixels="True" RenderOptions.BitmapScalingMode="NearestNeighbor">
<Image.Source>
<MultiBinding>
<MultiBinding.Converter>
<local:MaskImageConverer/>
<local:MaskImageConverter/>
</MultiBinding.Converter>
<Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="DataContext.Width" Mode="OneWay"/>
<Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="DataContext.Height" Mode="OneWay"/>
Expand Down
3 changes: 2 additions & 1 deletion UndertaleModTool/Editors/UndertaleTexturePageItemEditor.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@
<Button Grid.Column="3" Content="Export" Click="Export_Click"/>
</Grid>

<Viewbox Grid.Row="6" Grid.Column="0" Grid.ColumnSpan="2" Stretch="Uniform" StretchDirection="DownOnly">
<Viewbox Grid.Row="6" Grid.Column="0" Grid.ColumnSpan="2" Stretch="Uniform" StretchDirection="DownOnly"
SnapsToDevicePixels="True" RenderOptions.BitmapScalingMode="NearestNeighbor">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
Expand Down