ScaleImage problem
Übersicht

![]() |
AMYBetreff: ScaleImage problem |
![]() Antworten mit Zitat ![]() |
---|---|---|
Mal ne frage. Funktioniert scaleimage nur auf der grösse des fensters oder des desktops? Denn wenn ich ein 1600x1200 bild mit scaleimage auf 1024x768 verkleinern will ist es immer abgeschnitten und manchmal sogar viel kleiner als 1024x768. Kann mir das vielleicht mal einer erklären warum das so ist.
Hier mal der benutzte Code: Code: [AUSKLAPPEN] Global screenx=1024
Global screeny=768 Graphics screenx,screeny,32,2 filename$=CommandLine() If Asc(Left$(filename$,1))=34 Then filename1$=Mid$(filename$,2,Len(filename)-2) Else filename1$=filename readimg=LoadImage(filename1) x=ImageWidth(readimg) y=ImageHeight(readimg) ;If x>screenx Or y>screeny Or x>screenx And y>screeny Then ;---- Millisecs for 1600x1200 to 1024x768 ;resizecool(x,y,screenx,screeny,readimg) ;If x>screenx Or y>screeny Or x>screenx And y>screeny Then ;3027 Millisecs for 1600x1280 to 1024x768 ;resizecool2(x,y,screenx,screeny,readimg) If x>screenx Or y>screeny Or x>screenx And y>screeny Then ;???? Millisecs for 1600x1200 to 1024x768 resizecool3(x,y,screenx,screeny,readimg) ;VEERRRYYYYYYYYYYYYYYYYYYYYYYYYY FAST ;If x>screenx Or y>screeny Or x>screenx And y>screeny Then ;>50 Millisecs for 1600x1200 to 1024x768 ;ScaleImageFast(readimg,FrontBuffer(),0,0,1024,1000) Else drawy=(screeny-y)/2 drawx=(screenx-x)/2 DrawImage readimg,drawx,drawy WaitKey End If End Function ScaleImageFast(src,dest,x,y,width,height) temporary=CreateImage(width,height) start=MilliSecs() src_width =ImageWidth (src) src_height =ImageHeight(src) src_buffer =ImageBuffer(src) tmp_buffer =ImageBuffer(temporary) div_x# =Float#(src_width) /Float#(width) div_y# =Float#(src_height)/Float#(height) If width=0 Or height=0 Or src_width=0 Or src_height=0 Then Return For i=0 To width-1 CopyRect i*div_x#,0,1,src_height,i,0,src_buffer,tmp_buffer Next For i=0 To height-1 CopyRect 0,i*div_y#,width,1,x,y+i,tmp_buffer,dest Next Ende=MilliSecs() Zeit=Ende-Start WaitKey Delay(2500) Cls Text screenx/2,screeny/2,Zeit+" Millisecs needed; Press a key",1,1 WaitKey End Function Function resizecool3(pixelx,pixely,screenx,screeny,image) start=MilliSecs() sfx#=1024.0/pixelx sfy#=768.0/pixely If sfx<sfy Then ScaleImage image,sfx,sfx Else ScaleImage image,sfy,sfy End If drawy=(screeny-pixely)/2 drawx=(screenx-pixelx)/2 DrawImage Image,drawx,drawy Ende=MilliSecs() Zeit=Ende-Start Delay(2500) Cls Text screenx/2,screeny/2,Zeit+" Millisecs needed; Press a key",1,1 WaitKey End Function Function resizecool2(pixelx,pixely,screenx,screeny,image) start=MilliSecs() pixelx1#=pixelx pixely1#=pixely wert#=pixelx/pixely1 wert2#=pixely/pixelx1 difx=pixelx-screenx dify=pixely-screeny If difx>dify Then pixelx=pixelx-difx pixely=pixelx/wert Else pixely=pixely-dify pixelx=pixely/wert2 End If drawy=(screeny-pixely)/2 drawx=(screenx-pixelx)/2 ResizeImage image,pixelx,pixely DrawImage Image,drawx,drawy Ende=MilliSecs() Zeit=Ende-Start Delay(2500) Cls Text screenx/2,screeny/2,Zeit+" Millisecs needed; Press a key",1,1 WaitKey End Function Function resizecool(pixelx,pixely,screenx,screeny,image) pixelx1#=pixelx pixely1#=pixely wert#=pixelx1/pixely1 wert2#=pixely1/pixelx1 Repeat If pixelx>screenx And pixely>screeny Then pixelx=pixelx-1 pixely=pixely-1 End If If pixelx>screenx And pixely<screeny Then pixelx=pixelx-1 pixely=pixely-1 End If If pixelx<screenx And pixely>screeny Then pixelx=pixelx-1 pixely=pixely-1 End If If pixelx<screenx And pixely<screeny Then pixelx=pixelx+1 pixely=pixely+1 End If If pixelx=screenx And pixely<screeny Then pixely=pixelx/wert:Exit If pixely=screeny And pixelx<screenx Then pixelx=pixely/wert2:Exit Forever If pixelx=screenx Then drawy=(screeny-pixely)/2 If pixely=screeny Then drawx=(screenx-pixelx)/2 ResizeImage image,pixelx,pixely DrawImage Image,drawx,drawy Ende=MilliSecs() Zeit=Ende-Start WaitKey Cls Text screenx/2,screeny/2,Zeit+" Millisecs needed",1,1 WaitKey End Function ~EDITIERT~ Die BB-Code Tags funktionieren leider nicht mehr. d-bug |
||
Projekte: www.amyscbi.de
I never comment my sourcecode. What's HARD to write must be HARD to read! |
Gerhard |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Da dein Bildschirm gleich der Bildgrösse ist, muss drawx und drawy jeweils 0 sein. Sonst siehst du das Bild nur teilweise.
Lass mal 32,2 bei graphics weg, dann passt es bei mir. |
||
![]() |
AMY |
![]() Antworten mit Zitat ![]() |
---|---|---|
danke für die antwort. werds mal ausprobieren.
drawx und drawy ist ja durch die berechnung automatisch auf 0. das bild war ja auch kleiner als 1024x768 aber eben viel kleiner. |
||
Projekte: www.amyscbi.de
I never comment my sourcecode. What's HARD to write must be HARD to read! |
![]() |
AMYBetreff: geschafft |
![]() Antworten mit Zitat ![]() |
---|---|---|
hab das problem gefunden.
habe den image buffer nur auf die grösse des fertigen bildes gemacht deswegen konnte er die weiteren punkte nicht speichern und damit auch nicht darstellen. bei graphics das 32,2 weglassen bringt gar nichts. schreib ich eigentlich auch immer nur übersichtshalber hin. und wie gesagt drawx und drawy sind automatisch auf 0 THX 4 Ur HELP |
||
Projekte: www.amyscbi.de
I never comment my sourcecode. What's HARD to write must be HARD to read! |
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group