Autor Beitrag
Flamefire
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1207
Erhaltene Danke: 31

Win 10
Delphi 2009 Pro, C++ (Visual Studio)
BeitragVerfasst: Fr 21.01.11 16:29 
Ich habe in einer Komponente eine Funktion, die Bilder skaliert zeichnet und dazu GDI+ verwendet.
Die Funktion ist die hier:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
procedure TGpGraphics.DrawImage(Image: TGPImage; X, Y, Width, Height: Integer);
begin
if ((Image.Width <= 10and (Width > Image.Width)) or           
   ((Image.Height <= 10and (Height > Image.Height))  then
     DrawSmallStretchedImage(Image, X, Y, Width, Height)
else
  GdipDrawImageRectI (fGraphics, Image.fHandle, X, Y, Width, Height);
end;

Das Problem ist, dass er beim verkleinern die Bilder sehr unschön aussehen lässt. Es fehlen dann ein paar Linien.
Gibts da ne bessere Variante?
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19315
Erhaltene Danke: 1747

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Fr 21.01.11 17:03 
Mir fiele da so auf die Schnelle ein vorher ein Antialiasing durchzuführen bzw. beides zu kombinieren.
bummi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1248
Erhaltene Danke: 187

XP - Server 2008R2
D2 - Delphi XE
BeitragVerfasst: Fr 21.01.11 17:34 
ich weiß nicht welche GDI+ Implementierung Du verwendest, aber vielleicht kannst Du mit meinem folgenden Schnippsel was anfangen..

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
//.....
 graphics := TGPGraphics.Create(HDCImage.Canvas.Handle);
  graphics.SetInterpolationMode(InterpolationModeHighQualityBicubic);
  graphics.DrawImage(
    image,
    MakeRect(destx,  desty , faktor * width, faktor * height),  
    00,        
    width,       
    height,      
    UnitPixel);
//.....

_________________
Das Problem liegt üblicherweise zwischen den Ohren H₂♂
DRY DRY KISS
Flamefire Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1207
Erhaltene Danke: 31

Win 10
Delphi 2009 Pro, C++ (Visual Studio)
BeitragVerfasst: Sa 22.01.11 23:54 
Hilft leider nicht :(
Gleiches Ergebnis.
Zlatan
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 175



BeitragVerfasst: Mi 26.01.11 17:56 
hast du es schon mal bei google versucht
Flamefire Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1207
Erhaltene Danke: 31

Win 10
Delphi 2009 Pro, C++ (Visual Studio)
BeitragVerfasst: Mi 26.01.11 18:50 
Jep. Hab am Ende gefunden, dass es auf ein Canvas gezeichnet wird und ich mit SetStretchBltMode(ahDC, HALFTONE) die Qualität extrem verbessern konnte.
Habs vergessen hier zu schreiben. sry