Bug in BT_DrawTextEx?

Moderator: Rathinagiri

Post Reply
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Bug in BT_DrawTextEx?

Post by Rathinagiri »

I found some weird behavior of DrawTextEx:

When a BT_DrawText is used before DrawTextEx with BT_Text_Center alignment, the alignment is carried over to the next BT_DrawTextEx even though we give BT_Text_Left

Consider this example:

Code: Select all

#include <hmg.ch>

Function Main
   define window x at 0, 0 width 400 height 300 main
      define button y
         row 10
         col 10
         caption 'Click me!'
         action drawtest()
      end button   
   end window
   x.center
   x.activate

Return


function drawtest
   local hBitMap, hDC, BTStruct
   hBitMap := BT_BitmapCreateNew ( 800, 600, { 255,255,255 } )
   hDC := BT_CreateDC ( hBitmap, BT_HDC_BITMAP, @BTstruct)
   // connent following line and see the difference!
   BT_DrawText (hDC, 10, 100, 'This is the text!', 'Arial', 12, { 0, 0, 0 }, { 255, 255, 255 }, BT_TEXT_OPAQUE, BT_TEXT_CENTER )
   BT_DrawRectangle (hDC, 100, 150, 200, 300, { 0, 0, 0 }, 2 )
   BT_DrawTextEx (hDC, 100, 150, 200, 300, 'This is the text!', 'Arial', 12, { 0, 0, 0 }, { 255, 255, 255 }, BT_TEXT_OPAQUE, BT_TEXT_LEFT )
   BT_DeleteDC( BTStruct )               
   BT_BitmapSaveFile ( hBitmap, 'new.bmp', BT_FILEFORMAT_BMP )
   BT_BitmapRelease ( hBitmap )
return nil
Try commenting the line and run.

Code: Select all

   BT_DrawText (hDC, 10, 100, 'This is the text!', 'Arial', 12, { 0, 0, 0 }, { 255, 255, 255 }, BT_TEXT_OPAQUE, BT_TEXT_CENTER )
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: Bug in BT_DrawTextEx?

Post by srvet_claudio »

I will check
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
Post Reply