Forum Discussion

bitninja's avatar
bitninja
Visitor
13 years ago

roCompositor is clipping images and biasing incorrectly

For the following code I am seeing two problems. The first is that all images are off 18pixels higher than they should be and 32 pixels to the left of where expected. In addition large images (greater than 1000 width) are clipped right around the ~1050 pixel area (pixel cutoff width on screen not of image). Weird thing is when I place multiple images only larger images are clipped past the 1050 pixel region. If I have a image that is around 200Wx150H I can place these anywhere within the view without clipping. However all images are subject to the strange 18w32h pixel offset. I get the problem even running the following modified from the rocompositor example code.

Function main()
black=&hFF'RGBA
screen=CreateObject("roScreen")
compositor=CreateObject("roCompositor")
compositor.SetDrawTo(screen, black)
bigbm=CreateObject("roBitmap","pkg:/images/image_old_hd.png") 'Image is 1000wx350H
region=CreateObject("roRegion", bigbm, 0, 0, 850, 720)
view_sprite=compositor.NewSprite(200, 200, region)
compositor.draw()
msgport = CreateObject("roMessagePort")
screen.SetMessagePort(msgport)
codes = bslUniversalControlEventCodes()
While True
msg=wait(0, msgport) ' wait for a button
If type(msg)="roUniversalControlEvent" Then
If msg.GetInt() = codes.BUTTON_BACK_PRESSED ' back button
Exit While
End If
End If
End While
End Function

3 Replies

  • There are many things wrong with the code you posted above, the primary issue being it doesn't work.

    * if the image is 1000 x 350 then you can't create a region that is 850 x 720
    * there is no screen.finish() in your code
    * try compositor.drawall()
    * since the region is invalid, you won't be able to create a sprite.

    I suggest posting some tested code that actually works along with a link to the graphics in question, or, better yet, upload a zip file for testing and post a link to it.

    Also, in the future please use the code tag around any code you post.

    - Joel