Skip to content

Commit a150a05

Browse files
committed
Optimize image flip logic
1 parent a5455bd commit a150a05

File tree

4 files changed

+26
-9
lines changed

4 files changed

+26
-9
lines changed

src/Portalum.TrwPrinter.EasyPrinterS3.ControlPanel/ImageConfigWindow.xaml

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,29 @@
66
xmlns:local="clr-namespace:Portalum.TrwPrinter.EasyPrinterS3.ControlPanel"
77
mc:Ignorable="d"
88
Title="ImagePositionWindow"
9-
Height="229"
10-
Width="296"
9+
Height="566"
10+
Width="514"
1111
Background="{StaticResource SecondaryColor}" WindowStartupLocation="CenterOwner">
12-
<Grid>
13-
<Button Style="{StaticResource BaseButtonStyle}" x:Name="ButtonFullSize" Content="Full Size 960x70" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Width="127" Height="30" Click="ButtonFullSize_Click"/>
14-
<Button Style="{StaticResource BaseButtonStyle}" x:Name="ButtonLeftBottom" Content="Bottom Left 200x20" HorizontalAlignment="Left" Margin="10,79,0,0" VerticalAlignment="Top" Click="ButtonLeftBottom200x20_Click" Width="127" Height="29"/>
15-
<Button Style="{StaticResource BaseButtonStyle}" x:Name="ButtonBottomRight200_20" Content="Bottom Right 200x20" HorizontalAlignment="Left" Margin="10,113,0,0" VerticalAlignment="Top" Width="127" Height="29" Click="ButtonBottomRight200x20_Click"/>
16-
<Button Style="{StaticResource BaseButtonStyle}" x:Name="ButtonHalfSize" Content="Half Size 450x35" HorizontalAlignment="Left" Margin="11,45,0,0" VerticalAlignment="Top" Width="126" Height="29" Click="ButtonHalfSize_Click"/>
17-
<Button Style="{StaticResource BaseButtonStyle}" x:Name="ButtonTopRight200_20" Content="Top Right 200x20" HorizontalAlignment="Left" Margin="10,147,0,0" VerticalAlignment="Top" Width="127" Height="29" Click="ButtonTopRight200_20_Click" />
12+
<Grid Margin="0,0,0,-6">
13+
<Button Style="{StaticResource BaseButtonStyle}" x:Name="ButtonFullSize" Content="Full Size 960x70" HorizontalAlignment="Left" Margin="5,145,0,0" VerticalAlignment="Top" Width="239" Height="30" Click="ButtonFullSize_Click" Grid.Column="1"/>
14+
<Button Style="{StaticResource BaseButtonStyle}" x:Name="ButtonLeftBottom" Content="Bottom Left 200x20" HorizontalAlignment="Left" Margin="5,317,0,0" VerticalAlignment="Top" Click="ButtonLeftBottom200x20_Click" Width="239" Height="29"/>
15+
<Button Style="{StaticResource BaseButtonStyle}" x:Name="ButtonBottomRight200_20" Content="Bottom Right 200x20" HorizontalAlignment="Left" Margin="256,317,0,0" VerticalAlignment="Top" Width="239" Height="29" Click="ButtonBottomRight200x20_Click"/>
16+
<Button Style="{StaticResource BaseButtonStyle}" x:Name="ButtonHalfSize" Content="Half Size 450x35" HorizontalAlignment="Left" Margin="253,146,0,0" VerticalAlignment="Top" Width="239" Height="29" Click="ButtonHalfSize_Click" Grid.Column="1"/>
17+
<Button Style="{StaticResource BaseButtonStyle}" x:Name="ButtonTopRight200_20" Content="Top Right 200x20" HorizontalAlignment="Left" Margin="5,484,0,0" VerticalAlignment="Top" Width="240" Height="29" Click="ButtonTopRight200_20_Click" />
18+
<Canvas Margin="5,12,0,0" Background="WhiteSmoke" HorizontalAlignment="Left" Width="239" Height="128" VerticalAlignment="Top">
19+
<Rectangle Canvas.Left="10" Canvas.Top="10" Height="108" Width="219" Stroke="Black" StrokeThickness="1" Fill="White" />
20+
</Canvas>
21+
<Canvas Margin="253,12,0,0" Background="WhiteSmoke" Grid.Column="1" HorizontalAlignment="Left" Width="239" Height="128" VerticalAlignment="Top">
22+
<Rectangle Canvas.Left="10" Canvas.Top="58" Height="60" Width="108" Stroke="Black" StrokeThickness="1" Fill="White" HorizontalAlignment="Left" VerticalAlignment="Center" />
23+
</Canvas>
24+
<Canvas Margin="4,184,0,0" Background="WhiteSmoke" Grid.Column="1" Grid.RowSpan="2" HorizontalAlignment="Left" Width="240" Height="128" VerticalAlignment="Top">
25+
<Rectangle Canvas.Left="10" Canvas.Top="80" Height="38" Width="58" Stroke="Black" StrokeThickness="1" Fill="White" HorizontalAlignment="Left" VerticalAlignment="Center" />
26+
</Canvas>
27+
<Canvas Background="WhiteSmoke" Height="128" Canvas.Left="-2" Canvas.Top="172" Width="239" Grid.Column="1" Margin="253,184,16,0" Grid.RowSpan="2" VerticalAlignment="Top">
28+
<Rectangle Canvas.Left="171" Canvas.Top="80" Height="38" Width="58" Stroke="Black" StrokeThickness="1" Fill="White" HorizontalAlignment="Left" VerticalAlignment="Center" />
29+
</Canvas>
30+
<Canvas Margin="5,351,0,0" Background="WhiteSmoke" HorizontalAlignment="Left" Width="240" Height="128" VerticalAlignment="Top">
31+
<Rectangle Canvas.Left="172" Canvas.Top="10" Height="38" Width="58" Stroke="Black" StrokeThickness="1" Fill="White" HorizontalAlignment="Left" VerticalAlignment="Top" />
32+
</Canvas>
1833
</Grid>
1934
</Window>

src/Portalum.TrwPrinter.EasyPrinterS3.ControlPanel/MainWindow.xaml.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ private async void ButtonPrintImageDemo_Click(object sender, RoutedEventArgs e)
229229

230230
var printDocument = new PrintDocument();
231231
printDocument.AddElement(new ImagePrintElement(filePath, imageConfigDialog.X1, imageConfigDialog.X2, imageConfigDialog.Y1, imageConfigDialog.Y2));
232+
printDocument.AddElement(new TextPrintElement("imagedemo", 0, 60));
232233
await this._printerClient.PrintDocumentAsync(printDocument);
233234
}
234235

src/Portalum.TrwPrinter.EasyPrinterS3/Portalum.TrwPrinter.EasyPrinterS3.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
<TargetFrameworks>netstandard2.0;netstandard2.1;net6.0</TargetFrameworks>
2525

26-
<Version>1.0.11</Version>
26+
<Version>1.0.12</Version>
2727
</PropertyGroup>
2828

2929
<ItemGroup>

src/Portalum.TrwPrinter.EasyPrinterS3/PrintElements/ImagePrintElement.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ private async Task<byte[]> PreparePrintImageAsync(CancellationToken cancellation
6161
.BackgroundColor(Color.White)
6262
.DrawImage(image, new Point(0, (int)offsetY), 1f)
6363
.Rotate(rotate)
64+
.Flip(FlipMode.Vertical)
6465
);
6566

6667
using var memoryStreamPrintImage = new MemoryStream();

0 commit comments

Comments
 (0)