Auflösung verdoppeln
Übersicht

battlegorgeBetreff: Auflösung verdoppeln |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Ich möchte das Programm in 320*240 laufen lassen und vor dem flip
das Bild auf 640*480 skalieren. Ich habe es schon mit pixmaps versucht aber mit der Methode braucht ein frame 130 ms ![]() Ausserdem wird das Bild nicht wie bei Paint normal verdoppelt, sondern seltsam gefiltert. Wie würdet ihr das machen? Code: [AUSKLAPPEN] Strict
Graphics 640,480,0,75 Global image:timage=LoadImage("image.bmp") Global ms1,ms2 Repeat ms1=MilliSecs() DrawImage image,0,0 f_draw() ms2=MilliSecs()-ms1 DrawText ms2,10,10 Flip Cls Until KeyHit(key_escape) Or AppTerminate() Function f_draw() Local pix1:TPixmap=GrabPixmap(0,0,320,240) Local pix2:TPixmap=ResizePixmap(pix1,640,480) DrawPixmap pix2,0,0 End Function |
||
![]() |
mahe |
![]() Antworten mit Zitat ![]() |
---|---|---|
Code: [AUSKLAPPEN] global im:TImage = CreateImage(320,240,1,0) Function f_draw() GrabImage im,0,0 SetScale 2,2 DrawImage im,0,0 SetScale 1,1 EndFunction sollte um einiges schneller sein. Bei CreateImage bei den Flags 0 angeben dann wird auch nicht "gesmoothed". |
||
ʇɹǝıdɯnɹɹoʞ ɹnʇɐuƃıs - ǝpoɥʇǝɯ-ɹoɹɹıɯ ɹǝp uı ,ɹoɹɹǝ, |
battlegorge |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Das ist schon deutlich schneller.
Aber die Berechnung dauert immernoch 20 ms. Gibts noch eine andere Methode? |
||
![]() |
mahe |
![]() Antworten mit Zitat ![]() |
---|---|---|
Außer alle Bilder vorher schon skaliert zu zeichnen fällt mir sonst nichts ein.
Du müsstest dazu nur den SetScale-Befehl an den Anfang setzen und alle Positionsangaben verdoppeln. |
||
ʇɹǝıdɯnɹɹoʞ ɹnʇɐuƃıs - ǝpoɥʇǝɯ-ɹoɹɹıɯ ɹǝp uı ,ɹoɹɹǝ, |
![]() |
FOODy |
![]() Antworten mit Zitat ![]() |
---|---|---|
Mal den Thread mal ansehen: http://www.blitzbasic.com/Comm...opic=66775
Da ist auch dieser Code bei: Code: [AUSKLAPPEN] Strict
Type TVirtualGraphics Global virtualWidth, virtualHeight Global xRatio!, yRatio! Function Set(width=640, height=480) TVirtualGraphics.virtualWidth = width TVirtualGraphics.virtualHeight = height TVirtualGraphics.xRatio! = width / Double(GraphicsWidth()) TVirtualGraphics.yRatio! = height / Double(GraphicsHeight()) ?Win32 Local D3D7Driver:TD3D7Max2DDriver = TD3D7Max2DDriver(_max2dDriver) If D3D7Driver Local matrix#[] = [2.0 / width, 0.0, 0.0, 0.0,.. 0.0, -2.0 / height, 0.0, 0.0,.. 0.0, 0.0, 1.0, 0.0,.. -1 - (1.0 / width), 1 + (1.0 / height), 1.0, 1.0] D3D7Driver.device.SetTransform(D3DTS_PROJECTION, matrix) Else ? glMatrixMode(GL_PROJECTION) glLoadIdentity() glortho(0, width, height, 0, 0, 1) glMatrixMode(GL_MODELVIEW) glLoadIdentity() ?Win32 EndIf ? End Function Function MouseX() Return (BRL.PolledInput.MouseX() * TVirtualGraphics.xRatio!) End Function Function MouseY() Return (BRL.PolledInput.MouseY() * TVirtualGraphics.yRatio!) End Function End Type '----------------------------------------------- TEST ----------------------------------------------- 'SetGraphicsDriver GLMax2DDriver() SeedRnd MilliSecs() Local index = Rand(0, CountGraphicsModes() - 1) Local screenW, screenH, screenD, screenR GetGraphicsMode(index, screenW, screenH, screenD, screenR) Graphics screenW, screenH, screenD TVirtualGraphics.Set(1024, 768) HideMouse AutoMidHandle True Local image:TImage = LoadImage(getenv_("BMXPATH") + "/doc/bmax120.png") Assert image Else "Oi..." Local x = Rand(0, TVirtualGraphics.virtualWidth - 1) Local y = Rand(0, TVirtualGraphics.virtualheight - 1) Local xInc = Rand(1, 4) Local yInc = Rand(1, 4) Local scale# SetClsColor 0, 0, 100 Repeat x :+ xInc If x >= TVirtualGraphics.virtualWidth x = TVirtualGraphics.virtualWidth - 1 xInc = -xInc ElseIf x < 0 x = 0 xInc = -xInc EndIf y :+ yInc If y >= TVirtualGraphics.virtualHeight y = TVirtualGraphics.virtualHeight - 1 yInc = -yInc ElseIf y < 0 y = 0 yInc = -yInc EndIf scale# = 1 + (Cos(MilliSecs() / 10.0) * 0.5) Cls SetTransform(Sin(MilliSecs() / 40.0) * 180.0, scale#, scale#) DrawImage image, x, y SetTransform(0, TVirtualGraphics.xRatio!, TVirtualGraphics.xRatio!) DrawText screenW + " x " + screenH + " x " + screenD, 12, 12 Plot TVirtualGraphics.MouseX(), TVirtualGraphics.MouseY() Flip Until KeyHit(KEY_ESCAPE) End Der könnte dir eventuell weiterhelfen. Gruß, FOODy |
||
BlitzMax + MaxGUI, 64-bit Arch Linux: Intel Core² E8500 | 8 GB Ram | GeForce GTX 460 · 1024 MB |
battlegorge |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Der code aus dem blitzbasic forum sieht interessant aus.
Aber etwas kompliziert. ![]() Die Idee alle Bilder direkt zu vergrössern ist gut. Ich glaube so mache ichs. |
||
![]() |
RallimenSieger des 30-EUR-Wettbewerbs |
![]() Antworten mit Zitat ![]() |
---|---|---|
ich habe einen Code der Bilder ca 100x schneller vergrößert als
Scaleimage 2,2 (mit Tformfilter 0), vielleicht läßt der sich auf Bmax umstricken !? Code: [AUSKLAPPEN] Graphics 800 ,600,16,2
; Bild erstellen img = CreateImage (320 ,240) SetBuffer ImageBuffer (img) Color 0 ,255,255 Oval 0 ,0,320,240 ; Time = MilliSecs () img = ScaleImageHoch2 (img) time = MilliSecs () - time ; SetBuffer BackBuffer () While Not KeyDown (1) DrawBlock img,0,0 Text 0 ,550,time + " Millisekunden " Flip Cls Wend End Function ScaleImageHoch2 (img) ; Bild schnell vergrößern (Scaleimage img, 2,2) ; Img1 = CreateImage (ImageWidth (img) * 2 ,ImageHeight (img) * 2) ; For x = 0 To ImageWidth (img) - 1 CopyRect x,0,1,ImageHeight (img) ,x * 2 ,0, ImageBuffer (img) ,ImageBuffer (img1) CopyRect x,0,1,ImageHeight (img) ,x * 2 + 1 ,0, ImageBuffer (img) ,ImageBuffer (img1) Next ; For y = ImageHeight (img) - 1 To 0 Step - 1 CopyRect 0 ,y,ImageWidth (img1) ,1,0,y * 2, ImageBuffer (img1) ,ImageBuffer (img1) CopyRect 0 ,y,ImageWidth (img1) ,1,0,y * 2 + 1, ImageBuffer (img1) ,ImageBuffer (img1) Next ; FreeImage img Return img1 End Function |
||
[BB2D | BB3D | BB+]
|
![]() |
mahe |
![]() Antworten mit Zitat ![]() |
---|---|---|
Das hätte nicht viel Sinn.
Bei BMax werden alle Bilder als Texturen auf 3D-Objekte (Sprites) geladen und mittels OpenGL (DirectX ist auch möglich) gerendert. Somit ist die Vergrößerung mit SetScale noch viel schneller als Deine Funktion. |
||
ʇɹǝıdɯnɹɹoʞ ɹnʇɐuƃıs - ǝpoɥʇǝɯ-ɹoɹɹıɯ ɹǝp uı ,ɹoɹɹǝ, |
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group