Skip to content
This repository was archived by the owner on Nov 4, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
49 changes: 49 additions & 0 deletions modules/mojo/graphics.monkey
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down