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

[Bug]: Title Bar Images Stretched/Cropped (Regression) #603

Closed
sdreb3421 opened this issue Jan 20, 2022 · 41 comments
Closed

[Bug]: Title Bar Images Stretched/Cropped (Regression) #603

sdreb3421 opened this issue Jan 20, 2022 · 41 comments
Labels
bug Something isn't working fixed This issue has been fixed. regression Something was working in a previous release, but isn't working now.
Milestone

Comments

@sdreb3421
Copy link

The new canary build (60.22.1.17) has introduced stretching/cropping of the icons/images in the krypton form title bar. This could be related to #601.

Stable:
image

Canary:
image

@PWagner1 PWagner1 added the bug Something isn't working label Jan 20, 2022
@PWagner1 PWagner1 changed the title Title Bar Images Stretched/Cropped (Canary) [Bug]: Title Bar Images Stretched/Cropped (Canary) Jan 20, 2022
@Smurf-IV
Copy link
Member

Smurf-IV commented Jan 22, 2022

@sdreb3421 I am unable to replicate this (At any of the scaling I have on my QHD monitor with Win 10 20H2)
Can you state what

  • size display you are using
  • scale applied
  • Version of windows
    image

@sdreb3421
Copy link
Author

I was unable to resolve the issue with any scale setting unfortunately. The advanced scaling settings are disabled, but changing them didn't fix it either. Neither did changing the resolution of my monitor (native 1920x1080). The images below show my OS info, the results of various scaling (100%, 125%, 150%), and the images I used.

To replicate the issue, create an empty krypton form, no palette settings, and add button specs to the form using the three images below. The issue is most obvious when using smaller images that have rounded edges. If you're unable to replicate this I will go run some tests on other computers I can find.

image

Test

help16
play20
recordredtop

@PWagner1
Copy link
Contributor

Hi @sdreb3421 is it possible to use images, which are 24 x 24?

@Smurf-IV
Copy link
Member

I was unable to resolve the issue with any scale setting unfortunately..... The images below show my OS info, the results of various scaling (100%, 125%, 150%), and the images I used.
Are you saying that this is a problem even when 100% on Native scaling ?

What is the size of the images (i.e. 16x16 or something else) ( cannot see from the images you have chosen as they are png's, and they will may be stored as bitmaps internally)

Note: at this size bmp is more efficient than png overhead.

@Smurf-IV
Copy link
Member

FYI See the following PR demo of Form butts with round images:
#604

@sdreb3421
Copy link
Author

Yeah it would be okay to use 24px. Does that fix the issue? I can test it tomorrow morning...

@sdreb3421
Copy link
Author

@Smurf-IV looks like you were able to replicate it in that PR. Is the issue the image size?

@PWagner1
Copy link
Contributor

Yeah it would be okay to use 24px. Does that fix the issue? I can test it tomorrow morning...

Yes it does, please see @Smurf-IV previous comment for a demo.

@PWagner1
Copy link
Contributor

@Smurf-IV looks like you were able to replicate it in that PR. Is the issue the image size?

@sdreb3421 They are using 24 or 25px

@sdreb3421
Copy link
Author

@Smurf-IV I'm confused, are you saying they had the issue when using 24px, or that is the fix?

@sdreb3421
Copy link
Author

I'm assuming this image size requirement doesn't just apply to button specs, but also applies to the form control buttons and form icon?

@Smurf-IV
Copy link
Member

I'm assuming this image size requirement doesn't just apply to button specs, but also applies to the form control buttons and form icon?

Form Control buttons are ButtonSpecs.

The Form Icon is independent and should be an "Icon with multiple sized images " not a single bitmap image

@sdreb3421
Copy link
Author

sdreb3421 commented Feb 2, 2022

I just upgraded to the latest stable (60.22.2.32) and tried using a 24px button spec image, and the problem still exists. The help button spec below is 24px. We have tested with 16, 20, 24 and 32px with the same issue. The issue is applying to form button specs and navigator button specs. Have you guys been able to replicate the issue?

24px test

@sdreb3421
Copy link
Author

Looks like #623 is likely the same issue.

@Smurf-IV Smurf-IV added the under investigation This bug/issue is currently under investigation. label Feb 6, 2022
@Smurf-IV Smurf-IV self-assigned this Feb 6, 2022
@Smurf-IV
Copy link
Member

Smurf-IV commented Feb 6, 2022

Using the images supplied:
image
image
image

Results (Restart app between scale changes):
image
image
image
image

I was only able to see "Compression" (not clipping) when the images are rescaled down to 16*16 as expected for 100%.

@Smurf-IV
Copy link
Member

Smurf-IV commented Feb 6, 2022

@sdreb3421
tried to replicate by using the sample app to cover your repro steps: (To replicate the issue, create an empty krypton form, no palette settings, and add button specs to the form using the three images below. )

  1. What Windows theme are you using?
  2. What Krypton theme are you using?

@Smurf-IV
Copy link
Member

Smurf-IV commented Feb 6, 2022

1 thing I have noticed ("Due to compression"), is that the images are compressed more vertically, that they are horizontally:
image

@Smurf-IV
Copy link
Member

Smurf-IV commented Feb 6, 2022

Fix for the compression artefacts:
image

@Smurf-IV
Copy link
Member

Smurf-IV commented Feb 6, 2022

The above fix has "Now" rebroken the scaling of the images up:
image

@Smurf-IV
Copy link
Member

Smurf-IV commented Feb 6, 2022

I think I have fixed both scenarios:
image
image
image

@Smurf-IV Smurf-IV reopened this Jul 4, 2022
@Smurf-IV
Copy link
Member

Smurf-IV commented Jul 4, 2022

@Wagnerp in your court now.

PWagner1 added a commit that referenced this issue Jul 4, 2022
@PWagner1 PWagner1 mentioned this issue Jul 4, 2022
@PWagner1 PWagner1 added awaiting feedback A fix for this issue has been implemented, waiting for feedback on the fix. and removed under investigation This bug/issue is currently under investigation. labels Jul 4, 2022
@PWagner1 PWagner1 modified the milestones: April 2022, Version 7 Jul 4, 2022
@PWagner1
Copy link
Contributor

PWagner1 commented Jul 4, 2022

@sdreb3421 Please retry using today's nightly

@Smurf-IV Somehow, old code snuck back in :)

@PWagner1 PWagner1 added the regression Something was working in a previous release, but isn't working now. label Jul 4, 2022
@PWagner1 PWagner1 changed the title [Bug]: Title Bar Images Stretched/Cropped [Bug]: Title Bar Images Stretched/Cropped (Regression) Jul 4, 2022
@sdreb3421
Copy link
Author

sdreb3421 commented Jul 5, 2022

Fixed in Nightly 70.22.7.185-alpha!

However, when updating to this from stable 6.2201.4 I'm getting designer exceptions and a runtime exception (VS2022 latest version). The runtime exception is occurring on ((System.ComponentModel.ISupportInitialize)(this.tabMain)).EndInit(); Is this expected?

@PWagner1
Copy link
Contributor

PWagner1 commented Jul 5, 2022

Fixed in Nightly 70.22.7.185-alpha!

However, when updating to this from stable 6.2201.4 I'm getting designer exceptions and a runtime exception. The runtime exception is occurring on ((System.ComponentModel.ISupportInitialize)(this.tabMain)).EndInit();

Old code might have got back in between 2201.4 & 70.22.7.185.

((System.ComponentModel.ISupportInitialize)(this.tabMain)).EndInit(); Is this expected?

Might be something to do with .NET 4.8.1, @Smurf-IV any ideas?

@PWagner1 PWagner1 added fixed This issue has been fixed. and removed awaiting feedback A fix for this issue has been implemented, waiting for feedback on the fix. labels Jul 5, 2022
@sdreb3421
Copy link
Author

I'm using VS 2022 with only NET6 as target framework. I can't also target net48 due to incompatible assemblies. However, designer looks good and no runtime exceptions with 6.2201.4.

@sdreb3421
Copy link
Author

@Wagnerp @Smurf-IV should this fix have been included in the July canary release? I just installed and still see the icon distortion... Thanks

@PWagner1
Copy link
Contributor

@Wagnerp @Smurf-IV should this fix have been included in the July canary release? I just installed and still see the icon distortion... Thanks

@sdreb3421 Yes it should be if it's fixed in the latest nightly.

@sdreb3421
Copy link
Author

sdreb3421 commented Jul 30, 2022

@Wagnerp @Smurf-IV you guys... what is happening here. The issue was fixed in nightly 70.22.7.185-alpha, but broken again in 70.22.7.194-alpha. This is the second time the fix has been removed. I blame it on the aliens.

Interestingly, when the fix was implemented (185 and 188), I get a runtime exception for the KNavigator. This exception went away again in 194 once the fix was removed. Exception details below. It looks like some of the new code for the button spec bitmaps is causing an exception with the KNavigator button specs...

System.ArgumentException
HResult=0x80070057
Message=Parameter is not valid.
Source=System.Drawing.Common
StackTrace:
at System.Drawing.Bitmap..ctor(Int32 width, Int32 height, PixelFormat format)
at System.Drawing.Bitmap..ctor(Int32 width, Int32 height)
at Krypton.Toolkit.CommonHelper.ScaleImageForSizedDisplay(Image src, Single trgtWidth, Single trgtHeight)
at Krypton.Toolkit.ButtonSpecView.GetImage(PaletteState state)
at Krypton.Toolkit.RenderStandard.AllocateImageSpace(StandardContentMemento memento, IPaletteContent paletteContent, IContentValues contentValues, PaletteState state, Rectangle displayRect, RightToLeft rtl, Size[,]& allocation)
at Krypton.Toolkit.RenderStandard.GetContentPreferredSize(ViewLayoutContext context, IPaletteContent palette, IContentValues values, VisualOrientation orientation, PaletteState state, Boolean composition, Boolean glowing)
at Krypton.Toolkit.ViewDrawContent.GetPreferredSize(ViewLayoutContext context)
at Krypton.Toolkit.ViewLayoutDocker.GetPreferredSize(ViewLayoutContext context)
at Krypton.Toolkit.ViewComposite.GetPreferredSize(ViewLayoutContext context)
at Krypton.Toolkit.ViewDrawSplitCanvas.GetPreferredSize(ViewLayoutContext context)
at Krypton.Toolkit.ViewDrawButton.GetPreferredSize(ViewLayoutContext context)
at Krypton.Toolkit.ViewComposite.GetPreferredSize(ViewLayoutContext context)
at Krypton.Toolkit.ViewLayoutCenter.GetPreferredSize(ViewLayoutContext context)
at Krypton.Toolkit.ViewLayoutDocker.GetPreferredSize(ViewLayoutContext context)
at Krypton.Toolkit.ViewComposite.GetPreferredSize(ViewLayoutContext context)
at Krypton.Navigator.ViewLayoutInsetOverlap.GetPreferredSize(ViewLayoutContext context)
at Krypton.Toolkit.ViewLayoutDocker.Layout(ViewLayoutContext context)
at Krypton.Toolkit.ViewComposite.Layout(ViewLayoutContext context)
at Krypton.Toolkit.ViewDrawPanel.Layout(ViewLayoutContext context)
at Krypton.Toolkit.ViewManager.Layout(ViewLayoutContext context)
at Krypton.Toolkit.ViewManager.Layout(IRenderer renderer)
at Krypton.Toolkit.VisualControlBase.OnLayout(LayoutEventArgs levent)
at Krypton.Navigator.KryptonNavigator.OnLayout(LayoutEventArgs levent)
at Krypton.Navigator.KryptonNavigator.OnInitialized(EventArgs e)
at Krypton.Toolkit.VisualControl.EndInit()
at MotionView.AppUI.InitializeComponent() in C:\Users\sethd\Documents\TFS\MotionView\MotionView\MotionView\App\AppMainUI\AppUI.Designer.cs:line 1341
((System.ComponentModel.ISupportInitialize)(this.tabMain)).EndInit();

@PWagner1
Copy link
Contributor

@sdreb3421 The only fixed version I can think of was in this version. If I compile said version, are you able to test?

cc. @Smurf-IV

@PWagner1
Copy link
Contributor

Got it! The 'fix' is here. Going to reimplement tomorrow.

@sdreb3421
Copy link
Author

Awesome. Tag me and I'll test the nightly when it's time. Thanks

@PWagner1
Copy link
Contributor

PWagner1 commented Aug 1, 2022

Hi @sdreb3421

Please re-test using today's nightly build, 213

@sdreb3421
Copy link
Author

Looks perfect. And no runtime exceptions. Well done, thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed This issue has been fixed. regression Something was working in a previous release, but isn't working now.
Projects
None yet
Development

No branches or pull requests

3 participants