Jump to content

Martin Liddle

Members
  • Content Count

    9
  • Joined

  • Last visited

Community Reputation

1 Neutral
  1. I am porting some code from the Gnu Pascal compiler that makes extensive use of WriteStr which is an ISO 10206 Extended Pascal extension; is there a Delphi equivalent? For those not familiar with WriteStr, WriteStr(S,Args) behaves like Write, except that it stores its output in the string variable S instead of a file.
  2. Martin Liddle

    Display of bmp and jpeg images is poorer quality in Windows 11

    I have now found time to have another look at this problem. The issue appears to be that the PIxelFormat of the canvas was originally set to pf16bit but 9 years ago was reduced to pf8bit to save memory. This worked satisfactorily on all Windows version up to and including Windows 10. Changing the PixelFormat to pf16bit fixes the problem on Windows 11. Thank you to all who contributed to this thread.
  3. Martin Liddle

    Display of bmp and jpeg images is poorer quality in Windows 11

    Thank you that is an interesting observation; any thoughts on why that is only happening on Windows 11?
  4. Martin Liddle

    Display of bmp and jpeg images is poorer quality in Windows 11

    There would be a significant amount of work to strip out the necessary code. If I can't find a solution then I will do that but I don't want to commit the time to do it until I have exhausted other avenues. I was hoping I might find someone here who had seen a similar problem and found a solution.
  5. Martin Liddle

    Display of bmp and jpeg images is poorer quality in Windows 11

    I apologise; this is the first time I have posted on this forum; most forums I have used show the file name of an upload. The top image is Windows 10 and the bottom image Windows 11. I agree that not rescaling will produce the best image but 20 years of experience with this software has convinced me that the images are good enough for the purpose using stretchdraw.
  6. Martin Liddle

    Display of bmp and jpeg images is poorer quality in Windows 11

    Why do you think that the conversion produce different results when running the same executable on Windows 10 and Windows 11?
  7. Martin Liddle

    Display of bmp and jpeg images is poorer quality in Windows 11

    The code used to show the pictures and to print the pictures is the same; just the dpi is changed. Code to load images: Procedure GetALogo(EventNumber:Integer;AFileName:String;LogoNumber:Integer;Var HasLoaded:Boolean); Var TempFileName:String; Begin HasLoaded:=True; TempFileName:=WorkingDirectory+AFileName+IntToStr(EventNumber); If FileExists(TempFileName+'.bmp') then Logo[LogoNumber].LoadFromFile(TempFileName+'.bmp') Else If FileExists(TempFileName+'.jpg') then Begin JpegLogo[LogoNumber].LoadFromFile(TempFileName+'.jpg'); Logo[LogoNumber].Assign(JpegLogo[LogoNumber]); End Else Begin TempFileName:=WorkingDirectory+AFileName; If FileExists(TempFileName+'.bmp') then Logo[LogoNumber].LoadFromFile(TempFileName+'.bmp') Else If FileExists(TempFileName+'.jpg') then Begin JpegLogo[LogoNumber].LoadFromFile(TempFileName+'.jpg'); Logo[LogoNumber].Assign(JpegLogo[LogoNumber]); End Else Begin HasLoaded:=False; Logo[LogoNumber].Free; Logo[LogoNumber]:=TBitMap.Create; End; End; End; Code to show an image: Procedure ShowLogoNew(PageProps:TPageProps;ABitMap:TBitMap;LeftSpace,TopSpace,WidthSpace,DepthSpace:Real; HorizAlign,VertAlign:TLogoAlignment;Var ActualBottom:Real); Const MLogo=0.018; Var ALeft,ATop,ARight,ABottom,ExtraMargin:Integer; ImgAspectRatio,SpaceAspectRatio:Real; ARect:Trect; Begin With ABitMap, PageProps Do Begin If ABitMap.Height*ABitMap.Width>0 then Begin ALeft:=Round((LeftSpace+MLogo)*HPix); ATop:= Round((TopSpace+MLogo)*VPix); ImgAspectRatio:=Height/Width; SpaceAspectRatio:=DepthSpace/WidthSpace; If ImgAspectRatio>SpaceAspectRatio then Begin ExtraMargin:=Round((WidthSpace-2*MLogo)*HPix-(DepthSpace-2*MLogo)*VPix/ImgAspectRatio); Case HorizAlign of laLeft : (*ALeft:=ALeft*); laHCentre : ALeft:=ALeft+ExtraMargin div 2; laRight : ALeft:=ALeft+ExtraMargin; Else ; End; ARight:=ALeft+Round((DepthSpace-2*Mlogo)*HPix/ImgAspectRatio); ABottom:=ATop+Round((DepthSpace-2*Mlogo)*VPix); End Else Begin ExtraMargin:=Round((DepthSpace-2*MLogo)*VPix-(WidthSpace-2*MLogo)*HPix*ImgAspectRatio); Case VertAlign of laTop : (*ATop:=ATop*); laVCentre : ATop:=ATop+ExtraMargin div 2; laBottom : ATop:=ATop+ExtraMargin; End; ARight:=ALeft+Round((WidthSpace-2*Mlogo)*HPix); ABottom:=ATop+Round((WidthSpace-2*Mlogo)*VPix*ImgAspectRatio); End; ARect:=Rect(ALeft,ATop,ARight,ABottom); ActualBottom:=ABottom/VPix; ACanvas.StretchDraw(ARect,ABitMap); End; (*If AbitMap.Height*ABitMap.Width>0*) End; End; (*ShowLogoNew*)
  8. Martin Liddle

    Display of bmp and jpeg images is poorer quality in Windows 11

    I currently only have details for one of the computers, a Lenovo Thinkpad E15 gen 2 with : the recommended setting for screen scaling is 125% which is what I was using; I had already experimented with setting screen scaling to 100% and the problem remains. The image is 8" x 0.633" (203.2mm x 16.1mm) with a 300 dpi resolution. The size of the display rectangle can vary but is typically 7.5" x 0.6" (190.5mm x 15.4mm).
  9. I have a VCL Delphi app that displays bmp or jpeg images on reports as headers and footers using stretchdraw. This code that has worked well for 22 years but on two different Windows 11 computers the quality of the images when displayed on screen is much poorer than on earlier versions of Windows. I have attached two screen grabs, note that the images will only be about 25mm height when displayed. The results are the same if the code is compiled on Windows 10 using Delphi 10.3.1 or on Windows 11 using Delphi 10.4. When printed the images are identical for all versions of Windows. My googling skills are obviously failing me as I thought this would be a common problem but I have so far only found one reference to a vaguely similar problem. I am guessing there is some graphics setting in Windows 11 that needs tweaking but I would also be interested if there are changes to the way the images are drawn that might help.
×