Skip to content

Commit

Permalink
Update GetBitmapFrameByWidthAndDpi to public.
Browse files Browse the repository at this point in the history
  • Loading branch information
ricaun committed Nov 19, 2024
1 parent 71ceab2 commit 5879f18
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Add `SystemDpi` to store the system `dpi` value.
- Update `GetBitmapFrameByWidthAndDpi` to round `dpi` frame value.
- Update `Width` to `Math.Round` to improve order by `Width`.
- Update `GetBitmapFrameByWidthAndDpi` to public.
### Example
- Add `Cube-Grey-Light.tiff` and `Cube-Grey-Dark.tiff` in `AppTheme`.
### Tests
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project>
<PropertyGroup>
<Version>0.7.1-alpha.3</Version>
<Version>0.7.1-alpha.4</Version>
</PropertyGroup>
</Project>
10 changes: 7 additions & 3 deletions ricaun.Revit.UI/BitmapExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,20 @@ internal static double GetSystemDpi()
catch { }
return systemDpi;
}
internal readonly static double SystemDpi = GetSystemDpi();

/// <summary>
/// System Dpi
/// </summary>
public readonly static double SystemDpi = GetSystemDpi();

/// <summary>
/// Get the bitmap frame from the <paramref name="bitmapDecoder"/> based on the DPI and width.
/// </summary>
/// <param name="bitmapDecoder">The bitmap decoder.</param>
/// <param name="width">The desired width of the bitmap frame. When set to zero, the smallest width frame is returned.</param>
/// <param name="dpi">The optimal dpi for the frame.</param>
/// <param name="dpi">The optimal dpi for the frame. When set to zero, <see cref="SystemDpi"/> is used.</param>
/// <returns>The bitmap frame with the specified width or the smallest width frame.</returns>
internal static BitmapFrame GetBitmapFrameByWidthAndDpi(this BitmapDecoder bitmapDecoder, int width = 0, int dpi = 0)
public static BitmapFrame GetBitmapFrameByWidthAndDpi(this BitmapDecoder bitmapDecoder, int width, int dpi = 0)
{
double systemDpi = dpi > 0 ? dpi : SystemDpi;

Expand Down

0 comments on commit 5879f18

Please sign in to comment.