Hi Komag
Started a TextFX object a few months back but did not do much with it ( just had to get that grid done) . Your post reminded me of it. So here is what I have put together. Never really optimized it or looked at it much, but plan on addressing it sometime in the future so I probably will make changes. Anyway you can look at this and get some ideas. I believe this is something like you have in mind
I just hacked quickly at a demo so it is not my style or level of scrutiny but here it is. The left,right remote keys operate. Since it is fullsize from the start you need to start with the left key. I'm sure others can improve on it, but it's a start. ( Keep in mind 360 rotation may not be supported ). Also scale modes are set to 1.
Sub Main()
l_ds = CreateObject( "roDeviceInfo" ).GetDisplaySize()
l_dw = l_ds.w
l_dh = l_ds.h
l_bitmap = CreateBitmap()
l_screen = CreateObject( "roScreen", True, l_dw, l_dh )
l_port = CreateObject( "roMessagePort" )
l_screen.SetMessagePort( l_port )
l_screen.SetAlphaEnable( True )
l_screen.Clear( &hFFFFFFFF )
l_x = l_dw / 2 - l_bitmap.GetWidth() / 2
l_Y = l_dh / 2 - l_bitmap.GetHeight() / 2
l_screen.DrawObject( l_x, l_y, l_bitmap)
l_screen.SwapBuffers()
l_kp_BK = 0
l_kp_LT = 4
l_kp_RT = 5
l_isFullSize = True
while( True )
l_msg = l_port.GetMessage()
if type( l_msg ) = "roUniversalControlEvent"
l_index = l_msg.GetInt()
if l_index = l_kp_LT and l_isFullSize
ScaleRotate( l_screen, l_bitmap, l_x, l_y, False )
l_isFullSize = False
else if l_index = l_kp_RT and ( not l_isFullSize )
ScaleRotate( l_screen, l_bitmap, l_x, l_y )
l_isFullSize = True
else if l_index = l_kp_BK
exit while
end if
end if
end while
End Sub
Function ScaleRotate( a_screen As Object, a_bitmap As Object, a_x As Integer, a_y As Integer, a_isUp = True )
l_w = a_bitmap.GetWidth()
l_h = a_bitmap.GetHeight()
l_x = int( l_w / 2 )
l_y = int( l_h / 2 )
l_region1 = CreateObject( "roRegion", a_bitmap, 0, 0, l_w, l_h )
l_region1.SetScaleMode( 1 )
l_region1.SetPretranslation( -l_x, -l_y )
l_bitmap2 = CreateObject( "roBitmap", { width: l_w, height: l_h, AlphaEnable: True } )
l_region2 = CreateObject( "roRegion", l_bitmap2, 0, 0, l_w, l_h )
l_region2.SetScaleMode( 1 )
l_rgb = &hFFFFFF00
l_frames = 24
for l_i = 1 to l_frames
if a_isUP
l_scale = l_i / l_frames
else
l_scale = ( l_frames - l_i ) / l_frames
end if
l_j = 360 * l_scale
l_bitmap2.Clear( &h00000000 )
l_bitmap2.DrawRotatedObject( l_x, l_y, -l_j, l_region1 )
l_bitmap2.Finish()
l_rgba = int( 255 * l_scale ) + l_rgb
l_x1 = ( l_w - int( l_w * l_scale ) ) / 2
l_y1 = ( l_h - int( l_h * l_scale ) ) / 2
a_screen.Clear( &hFFFFFFFF )
a_screen.DrawScaledObject( a_x + l_x1, a_y + l_y1, l_scale, l_scale, l_region2, l_rgba )
a_screen.SwapBuffers()
end for
End Function
Function CreateBitmap() As Object
l_bitmap = CreateObject( "roBitmap", { width: 300, height: 300, AlphaEnable: True } )
l_bitmap.Clear( &hFFFFFF00 )
l_font = CreateObject( "roFontRegistry" ).GetDefaultFont( 300, True, False )
l_w = l_font.GetOneLineWidth( "X", 300 )
l_h = l_font.GetOneLineHeight()
l_bitmap.DrawText( "X" , 150 - l_w / 2, 150 - l_h / 2, &h000000FF, l_font )
l_bitmap.Finish()
return l_bitmap
End Function
My Channels: 2D API Framework Presentation: https://owner.roku.com/add/2M9LCVC
Updated: 11-11-2015 - Completed Keyboard interface
The Joel Channel ( Final Beta )