Fixed on GIT Mojo1 DrawImage9P frame not used

Rich

Active Member
3rd Party Module Dev
Joined
Sep 9, 2017
Hi
I found that frame wasnt used in DrawImage9P in mojo1
I have a fix for this, or you can fix it by adding frame onto each call to DrawImageRect and DrawImageRect2 in that function
I can pull and fix if needs be
 

MikeHart

Administrator
Staff member
Joined
Jun 19, 2017
Location
Germany
It isn't a bug. That command has no frame parameter. But yes, it make sense to have it.
 

Rich

Active Member
3rd Party Module Dev
Joined
Sep 9, 2017
It isn't a bug. That command has no frame parameter. But yes, it make sense to have it.
It does in the docs and in the function parameters (and also some redundant code in the function)
 

MikeHart

Administrator
Staff member
Joined
Jun 19, 2017
Location
Germany
Can you show me where you see it in the docs and function parameters? I just checked the online docs and github and can't see it.
I see a frame reference in the mojo implementation.
 

Rich

Active Member
3rd Party Module Dev
Joined
Sep 9, 2017
fixed and tested...
645

Cerberus X:
Function DrawImage9P( image:Image, x#,y#,patchSize, rotation#, scaleX#,scaleY#,frame=0 )

#If CONFIG="debug"
    DebugRenderDevice
    If frame<0 Or frame>=image.frames.Length Error "Invalid image frame"
#End

    Local patchS2 = patchSize * 2.0
    Local tsX# = ((image.width*scaleX)-patchS2) / ((image.width-patchS2))
    Local tsY# = ((image.height*scaleY)-patchS2) / ((image.height-patchS2))

    Local xo2:Float = (+image.HandleX-image.HandleX*scaleX)
    Local yo2:Float = (+image.HandleY-image.HandleY*scaleY)

    PushMatrix
    Translate x, y
    Rotate rotation
    Translate xo2, yo2

    DrawImageRect ( image,0,0, 0,0,patchSize,patchSize,frame )
    _DrawImageRect2( image,patchSize-image.HandleX,-image.HandleY,patchSize,0,image.Width-patchS2,patchSize,0.0,tsX,1.0,frame )
    DrawImageRect ( image,(image.Width*scaleX)-patchSize,0,image.Width-patchSize,0,patchSize,patchSize,frame )

    DrawImageRect( image,0,patchSize, 0,patchSize,patchSize,image.Height-patchS2,0.0, 1.0,tsY,frame )
    _DrawImageRect2( image,patchSize-image.HandleX,patchSize-image.HandleY,patchSize,patchSize,image.Width()-patchS2,image.Height()-patchS2,0,tsX, tsY, frame )
    DrawImageRect( image,(image.Width*scaleX)-patchSize,patchSize, image.Width-patchSize,patchSize,patchSize,image.Height-patchS2,0.0, 1.0,tsY,frame )

    DrawImageRect ( image,0, image.Height*scaleY-patchSize, 0,image.Height-patchSize,patchSize,patchSize, frame )
    _DrawImageRect2( image,patchSize-image.HandleX, image.Height*scaleY-patchSize-image.HandleY, patchSize ,image.Height-patchSize,image.Width-patchS2,patchSize,0,tsX,1.0, frame )
    DrawImageRect ( image,(image.Width*scaleX)-patchSize, image.Height*scaleY-patchSize, image.Width-patchSize,image.Height-patchSize, patchSize,patchSize, frame )

    PopMatrix
End
 
Top Bottom