1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-11-29 10:50:28 +00:00

Show visualization bitmap dimensions

The preview window scales freely, so it's hard to know how big the
actual pixels are.
This commit is contained in:
Andy McFadden 2019-12-11 22:12:20 -08:00
parent 071adb8e95
commit 8b20021c4d
3 changed files with 23 additions and 4 deletions

View File

@ -132,7 +132,8 @@ arrangements are common. The script defines three generators:</p>
bitmaps. This is intended for hi-res fonts, which are typically
8 bytes per entry, stored one after another. These are always
converted as monochrome, and have a 1-pixel transparent gap
between elements.</li>
between elements. (This also works for Apple /// fonts, but
currently ignores the high bit in each byte.)</li>
<li><b>Hi-Res Screen Image</b> - used for 8KiB screen images. The
data is linearized and converted to a 280x192 bitmap. Because
images are relatively large, the generator does not require them

View File

@ -97,6 +97,7 @@ limitations under the License.
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
@ -136,7 +137,12 @@ limitations under the License.
RenderOptions.BitmapScalingMode="NearestNeighbor"/>
</Border>
<Grid Grid.Row="2" HorizontalAlignment="Left">
<StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Right">
<TextBlock FontSize="10" Text="Bitmap size: "/>
<TextBlock FontSize="10" Text="{Binding BitmapDimensions, FallbackValue=32x64}"/>
</StackPanel>
<Grid Grid.Row="3" HorizontalAlignment="Left">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
@ -145,7 +151,7 @@ limitations under the License.
<StackPanel Grid.Row="0" Orientation="Horizontal" Margin="0,0,0,4">
<!--<TextBlock Text="Message:" Margin="0,0,8,0"/>-->
<TextBlock Text="{Binding PluginErrMessage}" Foreground="Red"/>
<TextBlock Text="{Binding PluginErrMessage, FallbackValue=ERROR}" Foreground="Red"/>
</StackPanel>
<TextBlock Grid.Row="1" Text="Parameters:" Margin="0,0,0,4"/>
@ -157,7 +163,7 @@ limitations under the License.
</ItemsControl>
</Grid>
<DockPanel Grid.Column="0" Grid.Row="3" Margin="0,8,0,0" LastChildFill="False">
<DockPanel Grid.Column="0" Grid.Row="4" Margin="0,8,0,0" LastChildFill="False">
<Button DockPanel.Dock="Right" Content="Cancel" Width="70" Margin="8,0,0,0" IsCancel="True"/>
<Button DockPanel.Dock="Right" Grid.Column="1" Content="OK" Width="70"
IsDefault="True" IsEnabled="{Binding IsValid}" Click="OkButton_Click"/>

View File

@ -23,6 +23,7 @@ using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using Asm65;
using PluginCommon;
@ -70,6 +71,7 @@ namespace SourceGen.WpfGui {
}
private string mTagString;
// Text turns red on error.
public Brush TagLabelBrush {
get { return mTagLabelBrush; }
set { mTagLabelBrush = value; OnPropertyChanged(); }
@ -112,6 +114,13 @@ namespace SourceGen.WpfGui {
/// </summary>
public string LastPluginMessage { get; set; }
// Bitmap width/height indicator.
public string BitmapDimensions {
get { return mBitmapDimensions; }
set { mBitmapDimensions = value; OnPropertyChanged(); }
}
private string mBitmapDimensions;
/// <summary>
/// ItemsSource for the ItemsControl with the generated parameter controls.
/// </summary>
@ -417,6 +426,7 @@ namespace SourceGen.WpfGui {
VisualizationItem item = (VisualizationItem)visComboBox.SelectedItem;
BitmapDimensions = "?";
if (!IsValid || item == null) {
previewImage.Source = sBadParamsImage;
} else {
@ -448,6 +458,8 @@ namespace SourceGen.WpfGui {
IsValid = false;
} else {
previewImage.Source = Visualization.ConvertToBitmapSource(vis2d);
BitmapDimensions = string.Format("{0}x{1}",
previewImage.Source.Width, previewImage.Source.Height);
}
}