BRT Community

Please login or register.

Login with username, password and session length
Advanced search  

News:

Welcome to the Bridgetek Community!

Please read our Welcome Note

Technical Support enquires
please contact the team
@ Bridgetek Support

Please refer to our website for detailed information on all our products - Bridgetek - Bridging Technology

Author Topic: Rotated bitmaps are clipped  (Read 8169 times)

aharrah

  • Newbie
  • *
  • Posts: 4
    • View Profile
Rotated bitmaps are clipped
« on: September 06, 2023, 04:43:43 PM »


Is there a way to increase the size of the clipping region when I do transformations?

When I rotate a bitmap 45 degrees with CMD_ROTATEAROUND the corners of the bitmap are clipped. This is also seen if the bitmap is rectangular and rotated 90 degrees.

For example, if the bitmap is 100x50, and it is rotated 90 degrees, then the displayed bitmap will be rotated, but have the ends clipped.

It acts as if there is a scissor region that is the size of the bitmap.

This also happens when the bitmaps associated with the preloaded fonts are rotated.

--

I am using CMD_ROTATEAROUND to rotate around the center of the bitmap. I have also tried the CMD_TRANSLATE/CMD_ROTATE/CMD_TRANSLATE sequence, but it is effectively the same operation.

The work around for bitmaps is to enlarge the clipping region by simply enlarging the bitmap, filling in the extra with a transparent background. This workaround is not available when displaying built-in fonts though.

Thank you,
Andy
Logged

BRT Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 746
    • View Profile
Re: Rotated bitmaps are clipped
« Reply #1 on: September 11, 2023, 09:42:16 AM »

Hi,

We checked with our R&D team and they suggested a good solution using CMD_ROMFONT which works well, we will post the details of how to do it.

Best Regards, BRT Community

Logged

BRT Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 746
    • View Profile
Re: Rotated bitmaps are clipped
« Reply #2 on: September 18, 2023, 11:24:13 AM »

Hi,

Here is an example showing one way to do it.

By using CMD_ROMFONT to assign the font 34 to handle 1, we can get the properties of the font using EVE Screen Editor etc. Using these properties, we can then do the rotation. The translate helps to avoid clipping.

Here is the code and please find an image showing the rotation attached.

Code: [Select]
CLEAR(1, 1, 1)
CMD_ROMFONT(1,34)  //Load the settings of built-in font 34 into bitmap handle 1

BITMAP_LAYOUT_H(0,0)
BITMAP_SIZE(NEAREST, BORDER,BORDER, 0,0) //Update the visible area of bitmap handle 1 to the maximum

CMD_LOADIDENTITY()
CMD_TRANSLATE(4128768, 3276800)
CMD_ROTATE(8192)
CMD_SETMATRIX()    //Configure transform matrix of bitmap

CMD_TEXT(77, 111, 1, 0, "TEST-ROTATED")  //Draw the text to be rotated

CMD_LOADIDENTITY()
CMD_SETMATRIX()    //Restore transform matrix of bitmap

CMD_ROMFONT(1,34)  //Re-load the setting of built-in font 34 into bitmap handle 1 to restore the visible area to normal
CMD_TEXT(100, 313, 1, 0, "TEST-Normal")  //Draw the normal text

Best Regards, BRT Community
Logged

aharrah

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Rotated bitmaps are clipped
« Reply #3 on: September 27, 2023, 07:40:48 PM »


Thank you for the example. That trick works well. I brought up an additional question though. Here is your example with two new lines added:

Code: [Select]
CLEAR(1, 1, 1)
CMD_ROMFONT(1,34)  //Load the settings of built-in font 34 into bitmap handle 1

BITMAP_LAYOUT_H(0,0)
BITMAP_SIZE(NEAREST, BORDER,BORDER, 0,0) //Update the visible area of bitmap handle 1 to the maximum

CMD_LOADIDENTITY()
CMD_TRANSLATE(4128768, 3276800)
CMD_ROTATE(8192)
CMD_SETMATRIX()    //Configure transform matrix of bitmap

VERTEX2II(77, 10, 1, 'a')  // <-- "a" does not display (you can test this by moving it down below the CMD_TEXT line)
CMD_TEXT(77, 111, 1, 0, "TEST-ROTATED")  //Draw the text to be rotated
VERTEX2II(177, 10, 1, 'b') // <-- "b" displays

CMD_LOADIDENTITY()
CMD_SETMATRIX()    //Restore transform matrix of bitmap

CMD_ROMFONT(1,34)  //Re-load the setting of built-in font 34 into bitmap handle 1 to restore the visible area to normal
CMD_TEXT(100, 313, 1, 0, "TEST-Normal")  //Draw the normal text

The new lines (ex: VERTEX2II(177, 10, 1, 'b')) draw a char using its bitmap. The first one does not work, but the second one does. What does the CMD_TEXT command to that allows the bitmaps to be displayed?

Thank you,
Andy
Logged

jlewis

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Rotated bitmaps are clipped
« Reply #4 on: December 21, 2023, 11:32:11 PM »

I am seeing similar things with rotating images, and then text not appearing.  Did you ever figure this out?
Logged