diff --git a/.gitignore b/.gitignore index d7a6c317..abf56ef7 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,5 @@ !/targets/winrt_win8 !/targets/winrt_winphone8 !/targets/xna +src/.bmx/rebuildall.bmx.console.release.win32.x86.o +src/.bmx/rebuildall.bmx.console.release.win32.x86.s diff --git a/modules/mojo/graphics.monkey b/modules/mojo/graphics.monkey index 4a0e4118..5df7aebe 100644 --- a/modules/mojo/graphics.monkey +++ b/modules/mojo/graphics.monkey @@ -492,6 +492,32 @@ Function DrawImage( image:Image,x#,y#,rotation#,scaleX#,scaleY#,frame=0 ) PopMatrix End +Function DrawImage( image:Image,x#,y#,m#[],frame=0 ) + + #If CONFIG="debug" + DebugRenderDevice + If frame<0 Or frame>=image.frames.Length Error "Invalid image frame" + #End + + Local f:Frame=image.frames[frame] + + PushMatrix + + Translate x,y + Transform m + Translate -image.tx,-image.ty + + context.Validate + + If image.flags & Image.FullFrame + renderDevice.DrawSurface image.surface,0,0 + Else + renderDevice.DrawSurface2 image.surface,0,0,f.x,f.y,image.width,image.height + Endif + + PopMatrix +End + Function DrawImageRect( image:Image,x#,y#,srcX,srcY,srcWidth,srcHeight,frame=0 ) #If CONFIG="debug" @@ -531,6 +557,29 @@ Function DrawImageRect( image:Image,x#,y#,srcX,srcY,srcWidth,srcHeight,rotation# PopMatrix End +Function DrawImageRect( image:Image,x#,y#,srcX,srcY,srcWidth,srcHeight,m#[],frame=0 ) + + #If CONFIG="debug" + DebugRenderDevice + If frame<0 Or frame>=image.frames.Length Error "Invalid image frame" + If srcX<0 Or srcY<0 Or srcX+srcWidth>image.width Or srcY+srcHeight>image.height Error "Invalid image rectangle" + #End + + Local f:Frame=image.frames[frame] + + PushMatrix + + Translate x,y + Transform m + Translate -image.tx,-image.ty + + context.Validate + + renderDevice.DrawSurface2 image.surface,0,0,srcX+f.x,srcY+f.y,srcWidth,srcHeight + + PopMatrix +End + Function ReadPixels( pixels[],x,y,width,height,offset=0,pitch=0 ) If Not pitch pitch=width