Jump to content

c0d3r

Members
  • Content Count

    129
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by c0d3r


  1. @Anders Melander  Thanks so much for the help.  Now not only all the images in the application wre scaling smoothly, but also all the Toolbar2000s were all scaled perfectly under different High DPIs (100%, 125%, 150%, 200%, ...). Yes, TOOLBARS are working without adding different set of images!!!

     

     

     

     

    100.PNG

    125.PNG

    150.PNG

    200.PNG


  2. Sorry.  My mistake.  Its working now, have to use LoadBitmap32FromPNG(Source, 'normal_left.png'), along with ABitmap.AlphaFormat := afDefined;  The reason why I'm using TImage was just for testing to see how the images scaling looks like, so I could use it for scaling my own page control tab bars:

     

    pgTabBars2.png


  3. As far as I know,  once the source loads file/stream from a PNG file/stream, the transparent got lost,  Here are the codes:

     

          Source.LoadFromFile('normal_left.png');  <-- Transparent got lost, transparent turned to White

     

          Target.SetSize(Round(Source.Width * 2), Round(Source.Height * 2));

          Resampler := TKernelResampler.Create(Source); // Resampler is now owned by TBitmap32
          Resampler.Kernel := TMitchellKernel.Create; // Kernel is now owned by resampler

     

          // Stretch using kernel resampler
          Target.Draw(Target.BoundsRect, Source.BoundsRect, Source);

     

          ABitmap := TBitmap.Create;
          try
            ABitmap.Assign(Target);
            ABitmap.AlphaFormat := afDefined;
            Image1{TImage}.Picture.Bitmap.Assign(ABitmap);
          finally
            ABitmap.Free;
          end;

     

    if you replace the first line with the following, the transparent turned to Black:

     

    LoadBitmap32FromPNG(Source, 'normal_left.png');

     

     


  4. 16 minutes ago, Anders Melander said:

    I don't use LoadBitmap32FromPNG and it's not part of Graphics32. Have you verified that the transparent PNG pixels are still transparent after conversion to TBitmap32?

    Other than that the problem could be the blend and combine mode used when drawing but that should be the same regardless of the origin of the pixel data.

    The PNG file is working fine using TPngImage.  I did a very simple test with Graphics32:

     

    1:

     

    Source.LoadFromFile('XXX.PNG');

    Source.DrawTo(Image1{TImage}.Canvas.Handle, 0, 0);

     

     

    2: using GR32PNG:

     

    LoadBitmap32FromPNG(Source, 'xxx.png');

    Source.DrawTo(Image1{TImage}.Canvas.Handle, 0, 0);

     

     

    Both transparent channels were got lost with different DrawMode (dmTransparent, dmBlend, ...), all in Black,  not yet do the resample things.

     


  5. On 12/28/2020 at 10:25 AM, Anders Melander said:

    Something like this:

    
    procedure Test;
    var
      Source: TBitmap32;
      Target: TBitmap32;
      Resampler: TKernelResampler;
    begin
      Target := TBitmap32.Create;
      try
        Source := TBitmap32.Create;
        try
    
          Source.LoadFromFile('foobar.bmp');
    
          // Make new bitmap twice the size. You can also make it smaller.
          Target.SetSize(Source.Width*2, Source.Height*2);
    
          Resampler := TKernelResampler.Create(Source); // Resampler is now owned by TBitmap32
          Resampler.Kernel := TLanczosKernel.Create; // Kernel is now owned by resampler
    
          // Stretch using kernel resampler
          Target.Draw(Target.BoundsRect, Source.BoundsRect, Source);
    
        finally
          Source.Free;
        end;
    
        // Do something with target bitmap...
    
      finally
        Target.Free;
      end;
    end;

     

    Try the above codes but with PNG files, seems the transparent colors got lost always, all in black,  even though I try to use like this:

     

    LoadBitmap32FromPNG(Source, 'normal_left.png');

     

    other than this problem everything else is working,  What am I missing?

     

     

     


  6. 5 hours ago, A.M. Hoornweg said:

    My current approach is to store all *.PNG files in high resolution inside the resources.  I scale them down to the appropriate size when the application starts and the display resolution is known. I use my own scaling routines (using a Lanczos2 filter) but there are lots of libraries that can do the same thing.  

     

    This approach does not solve the situation of the user having multiple screens in multiple resolutions though.

    Thanks for the tips. I will certainly try them out.


  7. 12 minutes ago, Attila Kovacs said:

    @c0d3r which windows do they have? Is there Per-App Scaling already available?

     

    image.png.11ff4502d388ddb4cecf787b29026bef.png

    image.png

    image.png

    We are using Per Monitor v2 in the latest release, and Yes, for now we have to set this 'Override high DPI scaling...' to System.  BUT it leads to blur screens which we got other complaints (LOTS LOTS of picky people out there, but we have to make them all happy) because of that.


  8. 4 minutes ago, David Heffernan said:

    If you can't change anything, I wonder what this topic is about. Is it a thought experiment? 

    Because clients complaint that the icons won't get scaled properly, and they also don't want you change the icons when we discuss the issues with them.


  9. 5 hours ago, David Heffernan said:

    You don't need to change them. You just need new versions of your existing glyphs.. You'll need to hire a graphic designer. 

    A new version IS a change. 🙂   There are lots of people out there in NA don't like icons being changed even though they are out of date, particularly those ones in Heathcare sectors.  Dumb people all over the places,  we did got calls that ask  for where the any key is because the guys couldn't find the any key on the keyboard when they saw "Press any key to continue...'


  10. 18 hours ago, Vincent Parrett said:

    I have had good results with Vector Magic - https://vectormagic.com/

     

    The key though is having larger png's to work with. Converting a 16x16px png/bmp to svg is next to impossible as there just isn't enough detail to work with. 

     

    FWIW, I'm slowly making my way through converting thousands of images to svg (either by converting or finding alternatives), it's mind numbingly boring and am losing the will to live..... 😒

    Thanks for the link, I will try it out.


  11. 7 hours ago, Lars Fosdal said:

    You'd be surprised of the amount of SVG icons that can be found. 

    https://www.flaticon.com/

    Thanks for the link.  Unfortunately due to training issues,  we can't change any icons because our clients were all get used to them, thats one of the issues we were facing, otherwise we could get better modern icons to replace aged ones.  Clients are just ordinary people, some of them aren't smart enough.


  12. 6 hours ago, Uwe Raabe said:

    Currently not at design time (but a good feature request).

     

    You can write a small program that does this:

    
      for I := 0 to PngImageList1.Count - 1 do
        PngImageList1.PngImages[I].PngImage.SaveToFile('Image' + I.ToString);

     

    Appreciated.


  13. 9 minutes ago, emailx45 said:

    if read article by Jim McKeeth and others you will see that "style" have a relationship with new highDPI. you can create your styles to apply in app for easy "changes" on UI.

    menu Tools, Designer Bitmap

     

    each style file contains bitmaps used for many UI components, include exist many styles prepared by Embarcadero to HighDPI use. but many components (olders) not is tottally prepared to use it.

    do you already try AlphaSkins suite?

    https://www.alphaskins.com/index.php

    No. We don't use any 'style' or 'skin'.  We don't like styles and skins, and totally against using them.  Our clients don't care about how fancy the software looks like, but they DO like a stable, reliable, easy to use and bug free system.


  14. 24 minutes ago, emailx45 said:

    ok.... but by default, in RAD Studio 10.x styles is used same that you dont. look at project options "appearance" (Windows is default)

    see TStyleManager class

    in portuguese-BR

    http://www.sobreprogramacao.com.br/2017/04/tstylemanager-temas-visuais-no-delphi.html?m=1   github sample

    Just tried 'Style', and pick Windows 10 as example,  and NO its not the right way to have app DPI awared. The screen looks horribly blur, using sort of bitmap stretching way, looked exactly the same as you set 'Unaware' to the DPI awareness option.


  15. 14 minutes ago, emailx45 said:

    ok.... but by default, in RAD Studio 10.x styles is used same that you dont. look at project options "appearance" (Windows is default)

    see TStyleManager class

    in portuguese-BR

    http://www.sobreprogramacao.com.br/2017/04/tstylemanager-temas-visuais-no-delphi.html?m=1   github sample

    Thanks. but what exactly does this 'Style' do with my TPngImageLists that used by toolbars, which aren't scaled to the proper High DPI?  I'm totally confused.


  16. 7 minutes ago, Kryvich said:

    For High DPI support you should consider SVG. 

     

    I knew SVG, its great. But we were using PNGs all over the places in our major production, and no way you could find all these images in SVG.


  17. Hi, All

     

    I need some help to figure out how to make images (PNGs and BMPs, we don't use ICONs) work properly under different High DPI screen. All our VCLs used were scaled properly EXCEPT Toolbars and images. I knew toolbars have to be scaled properly based on images, so the question turns to how to get images scaled properly?  Most of our images were 16x16 PNGs, few were 24x24. and few BMPs. We were using 3rd party TPngImageList to store all PNGs. Do we have to prepare different set of Images in order to make images working under different High DPI?  like a set of 20x20, a set of 24x24, 28x28 32x32... Thats a LOT and would be PITA if we have to do.  Any good solutions?

     

    BTW,  Could be possible to have TPngImageList to be able to save selected PNG image to a file?  the reason why I'm asking is because we lost some of original PNGs during migration from Delphi 2007 to Delphi 10.4


  18. 11 hours ago, dummzeuch said:

    Sometimes the IDE inserts two includes for CodeGear.Delphi.Targets (I think it's a bug in the updating code for projects):

    
        <Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/>

    One, with the condition, one without.

    Not sure this has something to do with the message though.

    Good catch!.  Removing the one without condition seems made it working.  Thanks.

×