MaskRegion()

MaskRegion()

Postby Jimmy » Thu Dec 19, 2019 2:45 am

hi,

in c:\fwh\source\function\fwbmp.c i found function MaskRegion() but no Sample.

i have a Xbase++ and HMG Sample for Region but my FiveWin Version display wrong :shock:

Code: Select all  Expand view  RUN
Not Acceptable!

An appropriate representation of the requested resource could not be found on this server. This error was generated by Mod_Security.
 

:shock:
i can't post that Code :?:

ok, found out that he do not like Comment like /* hello */ in Code Tag :lol:

in Xbase++ and HMG Version i use DLLCall like this
Code: Select all  Expand view  RUN
STATIC FUNCTION API_SetRegion(nIDig, aRegion, nNr)
LOCAL hRgn, hAdd, nX, hComb, nRet, nDLL, nDLL2
LOCAL cIdx, cForm, cImage, cMacro
LOCAL hWnd

   IF EMPTY( aRegion )
      RETURN NIL
   ENDIF

   cIdx := STRZERO(nIDig,2)
   cForm := "Form_" + cIdx
   hWnd := GetFormHandle(cForm)

   nDLL := DLLLOAD( 'GDI32.DLL' )
   If !EMPTY(nDll)
      // Create first region
      hRgn := DLLCALL( nDll, DLL_OSAPI,"CreateRectRgn", aRegion[1,1],;
                                                        aRegion[1,2],;
                                                        aRegion[1,3],;
                                                        aRegion[1,4] )
      FOR nX := 2 to Len( aRegion )
         // create all the other regions and combine them with the first
         hAdd := DLLCALL( nDll, DLL_OSAPI,"CreateRectRgn", aRegion[nX,1],;
                                                           aRegion[nX,2],;
                                                           aRegion[nX,3],;
                                                           aRegion[nX,4] )

         nRet := DLLCALL( nDll, DLL_OSAPI, "CombineRgn", hRgn, hRgn, hAdd, RGN_OR )

         // discard this region (no longer needed)
         DLLCALL( nDll, DLL_OSAPI,"DeleteObject", hAdd )
      NEXT

      nDll2 := DLLLoad( 'USER32.DLL' )
      // call windows to create the region
      DLLCALL( nDll2, DLL_OSAPI, "SetWindowRgn", hWnd, hRgn, 1 )

      DLLUNLOAD( nDll  )
      DLLUNLOAD( nDll2 )
   ENDIF

RETURN NIL

under FiveWin i have reduce DllCall
Code: Select all  Expand view  RUN
STATIC FUNCTION API_SetRegion(nIDig, aRegion, nNr)
LOCAL hRgn, hAdd, nX, nRet
LOCAL hWnd

   IF EMPTY( aRegion )
      RETURN NIL
   ENDIF

   hWnd := a_Forms[nIDig][My_FormObj]:hwnd
   // Create first region
   hRgn := CreateRectRgn( aRegion[1,1],;
                          aRegion[1,2],;
                          aRegion[1,3],;
                          aRegion[1,4] )
   FOR nX := 2 to Len( aRegion )
      // create all the other regions and combine them with the first
      hAdd := CreateRectRgn( aRegion[nX,1],;
                             aRegion[nX,2],;
                             aRegion[nX,3],;
                             aRegion[nX,4] )

      nRet := CombineRgn(hRgn, hRgn, hAdd, RGN_OR )

      // discard this region (no longer needed)
      DeleteObject( hAdd )
   NEXT

   // call windows to create the region
   SetWindowRgn( hWnd, hRgn, 1 )

RETURN NIL

it does not crash ... but Result display wrong 7-Segment Area

while there is MaskRegion() in FiveWin i like to ask if somebody have a Sample. :?:
here my Region data

Code: Select all  Expand view  RUN
STATIC FUNCTION LoadMask()
LOCAL aMask := {}
LOCAL aMIA  := MaskItemArray()

   AADD( aMask, GetMaskArray( aMIA, ZahlArray( 0 ) ) )
   AADD( aMask, GetMaskArray( aMIA, ZahlArray( 1 ) ) )
   AADD( aMask, GetMaskArray( aMIA, ZahlArray( 2 ) ) )
   AADD( aMask, GetMaskArray( aMIA, ZahlArray( 3 ) ) )
   AADD( aMask, GetMaskArray( aMIA, ZahlArray( 4 ) ) )
   AADD( aMask, GetMaskArray( aMIA, ZahlArray( 5 ) ) )
   AADD( aMask, GetMaskArray( aMIA, ZahlArray( 6 ) ) )
   AADD( aMask, GetMaskArray( aMIA, ZahlArray( 7 ) ) )
   AADD( aMask, GetMaskArray( aMIA, ZahlArray( 8 ) ) )
   AADD( aMask, GetMaskArray( aMIA, ZahlArray( 9 ) ) )
   AADD( aMask, GetMaskArray( aMIA, ZahlArray( 10 ) ) )

RETURN aMask
 

Code: Select all  Expand view  RUN
STATIC FUNCTION MaskItemArray()
LOCAL aRegion := {}
   // 1
   AADD( aRegion, { 5, 160, 20 + 9, 250 } )                 //      Balken links Oben
   AADD( aRegion, { 5 + 8, 251, 21, 259 } )                 // Nase Balken links Oben   oben
   AADD( aRegion, { 5 + 8, 151, 21, 159 } )                 // Nase Balken links Oben   unten
   // 4
   AADD( aRegion, { 5, 39, 20 + 9, 128 } )                  //      Balken links unten
   AADD( aRegion, { 5 + 8, 129, 21, 137 } )                 // Nase Balken links unten  oben
   AADD( aRegion, { 5 + 8, 30, 21, 38 } )                   // Nase Balken links unten  unten
   // 7
   AADD( aRegion, { 21 + 9, 252, 70 + 9, 280 } )            //      Balken Mitte Oben
   AADD( aRegion, { 21, 260, 29, 272 } )                    // Nase Balken Mitte Oben   links
   AADD( aRegion, { 80, 260, 88, 272 } )                    // Nase Balken Mitte Oben   rechts
   // 10
   AADD( aRegion, { 21 + 9, 130, 70 + 9, 158 } )            //      Balken Mitte Mitte
   AADD( aRegion, { 21, 138, 29, 150 } )                    // Nase Balken Mitte Mitte  links
   AADD( aRegion, { 80, 138, 88, 150 } )                    // Nase Balken Mitte Mitte  rechts
   // 13
   AADD( aRegion, { 21 + 9, 9, 70 + 9, 37 } )               //      Balken Mitte Unten
   AADD( aRegion, { 21, 17, 29, 29 } )                      // Nase Balken Mitte Unten  links
   AADD( aRegion, { 80, 17, 88, 29 } )                      // Nase Balken Mitte Unten  rechts
   // 16
   AADD( aRegion, { 81, 160, 96 + 9, 250 } )                //      Balken Rechts oben
   AADD( aRegion, { 81 + 8, 251, 97, 259 } )                // Nase Balken Rechts oben  oben
   AADD( aRegion, { 81 + 8, 151, 97, 159 } )                // Nase Balken Rechts oben  unten
   // 19
   AADD( aRegion, { 81, 39, 96 + 9, 128 } )                 //      Balken Rechts unten
   AADD( aRegion, { 81 + 8, 129, 97, 137 } )                // Nase Balken Rechts unten oben
   AADD( aRegion, { 81 + 8, 30, 97, 38 } )                  // Nase Balken Rechts unten unten
   // 22
   AADD( aRegion, { 40, 70, 60, 100 } )
   AADD( aRegion, { 40, 200, 60, 230 } )

#IFDEF Use_BottomLeft
#ELSE
   AEVAL(aRegion, {|x| x[4] := ABS(aSubSize[2]-x[4]) }  )
   AEVAL(aRegion, {|x| x[2] := ABS(aSubSize[2]-x[2]) }  )
#ENDIF

RETURN aRegion
 


Code: Select all  Expand view  RUN
STATIC FUNCTION GetMaskArray( aMIA, aZeig )
LOCAL i, iMax := LEN( aMIA )
LOCAL aRet := {}

   FOR i := 1 TO iMax
      IF ASCAN( aZeig, { | e | e = i } ) > 0
         AADD( aRet, aMIA[ i ] )
      ENDIF
   NEXT

RETURN aRet
 

Code: Select all  Expand view  RUN
STATIC FUNCTION ZahlArray( nNo )
LOCAL aZeig

#IFDEF Use_BottomLeft
   DO CASE
      CASE nNo = 0
         aZeig := { 1, 2, 3, 4, 5, 6, 7, 8, 9, 13, 14, 15, 16, 17, 18, 19, 20, 21 }
      CASE nNo = 1
         aZeig := { 16, 17, 18, 19, 20, 21 }
      CASE nNo = 2
         aZeig := { 1, 2, 3, 7, 8, 9, 10, 11, 12, 13, 14, 15, 19, 20, 21 }
      CASE nNo = 3
         aZeig := { 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21 }
      CASE nNo = 4
         aZeig := { 4, 5, 6, 10, 11, 12, 16, 17, 18, 19, 20, 21 }
      CASE nNo = 5
         aZeig := { 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 }
      CASE nNo = 6
         aZeig := { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 }
      CASE nNo = 7
         aZeig := { 13, 14, 15, 16, 17, 18, 19, 20, 21 }
      CASE nNo = 8
         aZeig := { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21 }
      CASE nNo = 9
         aZeig := { 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21 }
      CASE nNo = 10
         aZeig := { 22, 23 }                                // ":"
   ENDCASE
#ELSE      // Windows use Topleft as 0,0
   DO CASE
      CASE nNo = 0
         aZeig := { 1, 2, 3, 4, 5, 6, 7, 8, 9, 13, 14, 15, 16, 17, 18, 19, 20, 21 }
      CASE nNo = 1
         aZeig := { 16, 17, 18, 19, 20, 21 }
      CASE nNo = 2
         aZeig := { 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 }
      CASE nNo = 3
         aZeig := { 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21 }
      CASE nNo = 4
         aZeig := { 1, 2, 3, 10, 11, 12, 16, 17, 18, 19, 20, 21 }
      CASE nNo = 5
         aZeig := { 1, 2, 3, 7, 8, 9, 10, 11, 12, 13, 14, 15, 19, 20, 21 }
      CASE nNo = 6
         aZeig := { 1, 2, 3, 4, 5, 6, 10, 11, 12, 13, 14, 15, 19, 20, 21 }
      CASE nNo = 7
         aZeig := { 7, 8, 9, 16, 17, 18, 19, 20, 21 }
      CASE nNo = 8
         aZeig := { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21 }
      CASE nNo = 9
         aZeig := { 1, 2, 3, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21 }
      CASE nNo = 10
         aZeig := { 22, 23 }                                // ":"
   ENDCASE
#ENDIF
RETURN aZeig
 
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: MaskRegion()

Postby Antonio Linares » Thu Dec 19, 2019 6:29 am

You have an example of use from C in source/function/fwbmp.c
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: MaskRegion()

Postby Jimmy » Thu Dec 19, 2019 8:28 am

hi,
Antonio Linares wrote:You have an example of use from C in source/function/fwbmp.c

thx for Answer

Yes i saw that C Code but not how it work ( i'm not a C Programmer ... only xBase )
i begin to understand "C" ... but that Level is still to high for me (yet)

if someone have xBase Code how to call it so i can "see" if it make what i want.

Question : can i use MaskRegion() to create a Splash Screen :?:

i saw it in MiniGUI
Code: Select all  Expand view  RUN
        SetProperty( name, "Image_1", "Picture", cSaveBmp )
        SET REGION OF &name BITMAP &cSaveBmp TRANSPARENT COLOR RGB(252, 253, 252) TO RegionHandle
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: MaskRegion()

Postby Antonio Linares » Thu Dec 19, 2019 4:57 pm

You can simply use MsgLogo() and/or MsgSplash()

\SAMPLES\TESTMSGL.*
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: MaskRegion()

Postby Jimmy » Thu Dec 19, 2019 8:54 pm

hi,
Antonio Linares wrote:You can simply use MsgLogo() and/or MsgSplash()
\SAMPLES\TESTMSGL.*

i have look at those Sample but they don't use SetRegion to "Mask" my Output

i want to use SetRegion to get ride of Titlebar, Frame and all what does not belong to Image
Image

---

Code: Select all  Expand view  RUN
/*
   BitmapToRegion: Create a region from the "non-transparent" pixels of a bitmap
   Author        : Jean-Edouard Lachand-Robert
   (http://www.geocities.com/Paris/LeftBank/1160/resume.htm), June 1998.

   hBmp :              Source bitmap
   cTransparentColor : Color base for the "transparent" pixels
                       (default is black)
   cTolerance :        Color tolerance for the "transparent" pixels.

   A pixel is assumed to be transparent if the value of each of its 3
   components (blue, green and red) is
   greater or equal to the corresponding value in cTransparentColor and is
   lower or equal to the corresponding value in cTransparentColor + cTolerance.
 */

#define ALLOC_UNIT  100

HRGN BitmapToRegion( HBITMAP hBmp, COLORREF cTransparentColor, COLORREF cTolerance )
{
   HRGN   hRgn = NULL;
   VOID * pbits32;
   DWORD  maxRects = ALLOC_UNIT;

   if( hBmp )
   {
      // Create a memory DC inside which we will scan the bitmap content
      HDC hMemDC = CreateCompatibleDC( NULL );
      if( hMemDC )
      {
         BITMAP bm;
         BITMAPINFOHEADER RGB32BITSBITMAPINFO;
         HBITMAP          hbm32;

         // Get bitmap size
         GetObject( hBmp, sizeof( bm ), &bm );

         // Create a 32 bits depth bitmap and select it into the memory DC
         RGB32BITSBITMAPINFO.biSize          = sizeof( BITMAPINFOHEADER );
         RGB32BITSBITMAPINFO.biWidth         = bm.bmWidth;
         RGB32BITSBITMAPINFO.biHeight        = bm.bmHeight;
         RGB32BITSBITMAPINFO.biPlanes        = 1;
         RGB32BITSBITMAPINFO.biBitCount      = 32;
         RGB32BITSBITMAPINFO.biCompression   = BI_RGB;
         RGB32BITSBITMAPINFO.biSizeImage     = 0;
         RGB32BITSBITMAPINFO.biXPelsPerMeter = 0;
         RGB32BITSBITMAPINFO.biYPelsPerMeter = 0;
         RGB32BITSBITMAPINFO.biClrUsed       = 0;
         RGB32BITSBITMAPINFO.biClrImportant  = 0;

         hbm32 = CreateDIBSection( hMemDC, ( BITMAPINFO * ) &RGB32BITSBITMAPINFO, DIB_RGB_COLORS, &pbits32, NULL, 0 );
         if( hbm32 )
         {
            HBITMAP holdBmp = ( HBITMAP ) SelectObject( hMemDC, hbm32 );

            // Create a DC just to copy the bitmap into the memory DC
            HDC hDC = CreateCompatibleDC( hMemDC );
            if( hDC )
            {
               // Get how many bytes per row we have for the bitmap bits (rounded up to 32 bits)
               BITMAP    bm32;
               HANDLE    hData;
               RGNDATA * pData;
               BYTE *    p32;
               BYTE      lr, lg, lb, hr, hg, hb;
               INT       y, x;
               HRGN      h;

               GetObject( hbm32, sizeof( bm32 ), &bm32 );
               while( bm32.bmWidthBytes % 4 )
                  bm32.bmWidthBytes++;

               // Copy the bitmap into the memory DC
               holdBmp = ( HBITMAP ) SelectObject( hDC, hBmp );
               BitBlt( hMemDC, 0, 0, bm.bmWidth, bm.bmHeight, hDC, 0, 0, SRCCOPY );

               // For better performances, we will use the  ExtCreateRegion() function to create the  region.
               // This function take a RGNDATA structure on  entry.
               // We will add rectangles by amount of ALLOC_UNIT number in this structure.
               hData = GlobalAlloc( GMEM_MOVEABLE, sizeof( RGNDATAHEADER ) + ( sizeof( RECT ) * maxRects ) );

               pData = ( RGNDATA * ) GlobalLock( hData );
               pData->rdh.dwSize = sizeof( RGNDATAHEADER );
               pData->rdh.iType  = RDH_RECTANGLES;
               pData->rdh.nCount = pData->rdh.nRgnSize = 0;
               SetRect( &pData->rdh.rcBound, MAXLONG, MAXLONG, 0, 0 );

               // Keep on hand highest and lowest values for the  "transparent" pixels
               lr = GetRValue( cTransparentColor );
               lg = GetGValue( cTransparentColor );
               lb = GetBValue( cTransparentColor );
               hr = ( BYTE ) HB_MIN( 0xff, lr + GetRValue( cTolerance ) );
               hg = ( BYTE ) HB_MIN( 0xff, lg + GetGValue( cTolerance ) );
               hb = ( BYTE ) HB_MIN( 0xff, lb + GetBValue( cTolerance ) );

               // Scan each bitmap row from bottom to top (the bitmap is  inverted vertically)
               p32 = ( BYTE * ) bm32.bmBits + ( bm32.bmHeight - 1 ) * bm32.bmWidthBytes;
               for( y = 0; y < bm.bmHeight; y++ )     // Scan each bitmap pixel from left to right
               {
                  for( x = 0; x < bm.bmWidth; x++ )   // Search for a continuous range of "non transparent pixels"
                  {
                     int    x0 = x;
                     LONG * p  = ( LONG * ) p32 + x;
                     while( x < bm.bmWidth )
                     {
                        BYTE b = GetRValue( *p );
                        if( b >= lr && b <= hr )
                        {
                           b = GetGValue( *p );
                           if( b >= lg && b <= hg )
                           {
                              b = GetBValue( *p );
                              if( b >= lb && b <= hb )
                                 break;   // This pixel is "transparent"
                           }
                        }

                        p++;
                        x++;
                     }

                     if( x > x0 )         // Add the pixels (x0, y) to (x, y+1) as a new rectangle in the region
                     {
                        RECT * pr;
                        if( pData->rdh.nCount >= maxRects )
                        {
                           GlobalUnlock( hData );
                           maxRects += ALLOC_UNIT;
                           hData     = GlobalReAlloc( hData, sizeof( RGNDATAHEADER ) + ( sizeof( RECT ) * maxRects ), GMEM_MOVEABLE );
                           pData     = ( RGNDATA * ) GlobalLock( hData );
                        }

                        pr = ( RECT * ) &pData->Buffer;
                        SetRect( &pr[ pData->rdh.nCount ], x0, y, x, y + 1 );
                        if( x0 < pData->rdh.rcBound.left )
                           pData->rdh.rcBound.left = x0;

                        if( y < pData->rdh.rcBound.top )
                           pData->rdh.rcBound.top = y;

                        if( x > pData->rdh.rcBound.right )
                           pData->rdh.rcBound.right = x;

                        if( y + 1 > pData->rdh.rcBound.bottom )
                           pData->rdh.rcBound.bottom = y + 1;

                        pData->rdh.nCount++;

                        // On Windows98, ExtCreateRegion() may fail if  the number of rectangles is too
                        // large (ie: > 4000).
                        // Therefore, we have to create the region by multiple steps.
                        if( pData->rdh.nCount == 2000 )
                        {
                           h = ExtCreateRegion( NULL, sizeof( RGNDATAHEADER ) + ( sizeof( RECT ) * maxRects ), pData );
                           if( hRgn )
                           {
                              CombineRgn( hRgn, hRgn, h, RGN_OR );
                              DeleteObject( h );
                           }
                           else
                              hRgn = h;

                           pData->rdh.nCount = 0;
                           SetRect( &pData->rdh.rcBound, MAXLONG, MAXLONG, 0, 0 );
                        }
                     }
                  }

                  // Go to next row (remember, the bitmap is inverted vertically)
                  p32 -= bm32.bmWidthBytes;
               }

               // Create or extend the region with the remaining  rectangles
               h = ExtCreateRegion( NULL, sizeof( RGNDATAHEADER ) + ( sizeof( RECT ) * maxRects ), pData );
               if( hRgn )
               {
                  CombineRgn( hRgn, hRgn, h, RGN_OR );
                  DeleteObject( h );
               }
               else
                  hRgn = h;

               // Clean up
               GlobalFree( hData );
               SelectObject( hDC, holdBmp );
               DeleteDC( hDC );
            }

            DeleteObject( SelectObject( hMemDC, holdBmp ) );
         }

         DeleteDC( hMemDC );
      }
   }

   return hRgn;
}
 
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: MaskRegion()

Postby Jimmy » Fri Dec 20, 2019 2:15 am

hi,

i have include c:\harbour\lib\win\bcc\hbxpp.lib and use my old HMG DllCall() Code and it work under FiveWin :D
so there is a Problem with FiveWin CreateRectRgn() / CombineRgn() but i can't figure out what is different.

both HB_FUNC are working but the Result of HB_FUNC is different ...
it is like Coordinate Top -> Bottom (have try it) or left goes right ... have no Idea :cry:

---

i have add in FivEdit LIB Folder to c:\harbour\lib\win\bcc while there is no LIB under c:\harbour\lib (default LIBS)
i have Sub-Directory

BCC
MinGW
MSVC


---

in FivEdit IDE App now start ... always which Debugger ...
this is OK if i can use F5 but than Debugger ask for EXIT :shock:
i only can use F8 :cry:

---

as told i use ..\BUILDh.BAT MyPrg
now i need to add Folder c:\harbour\lib\win\bcc and c:\harbour\include
-L<libpath> additional path to search for libraries
-i<p>|-incpath=<p> additional path to search for headers

Code: Select all  Expand view  RUN
..\BUILDh.BAT MyPrg -Lc:\harbour\lib\win\bcc -ic:\harbour\include

Compiling...
Error F0034 Bad command line option '-c'


so how is the right Syntax for CMD Box :?:
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: MaskRegion()

Postby Jimmy » Fri Dec 20, 2019 3:04 am

hi,

have figure out what the difference is, here working FiveWin Code
Code: Select all  Expand view  RUN
STATIC FUNCTION API_SetRegion(nIDig, aRegion, nNr)
LOCAL hRgn, hAdd, nX, nRet
LOCAL hWnd
   IF EMPTY( aRegion )
      RETURN NIL
   ENDIF
   hWnd := a_Forms[nIDig][My_FormObj]:hwnd
   // Create first region
   hRgn := CreateRectRgn( aRegion[1,1],;
                          aRegion[1,2],;
                          aRegion[1,4],;
                          aRegion[1,3] )
   FOR nX := 2 to Len( aRegion )
      // create all the other regions and combine them with the first
      hAdd := CreateRectRgn( aRegion[nX,1],;
                             aRegion[nX,2],;
                             aRegion[nX,4],;
                             aRegion[nX,3] )

      nRet := CombineRgn(hRgn, hRgn, hAdd, RGN_OR )

      // discard this region (no longer needed)
      DeleteObject( hAdd )
   NEXT

   // call windows to create the region
   SetWindowRgn( hWnd, hRgn, 1 )

RETURN NIL
 

i change 3 and 4 to get same Result after i saw in c:\fwh\source\winapi\regions.c

Code: Select all  Expand view  RUN
HB_FUNC( CREATERECTRGN )
{
   HRGN hRgn = CreateRectRgn( hb_parni( 1 ), hb_parni( 2 ),
                              hb_parni( 4 ), hb_parni( 3 ) );
 


CreateRectRgn is used in c:\fwh\source\winapi\ctrldraw.c
Code: Select all  Expand view  RUN

HB_FUNC( CTRLDRAWFOCUS )
HB_FUNC( BARINVERT )  
HB_FUNC( RECTDOTTED )
 

did somebody use that function :?:
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: MaskRegion()

Postby Antonio Linares » Fri Dec 20, 2019 9:03 am

great work!

Is it working as expected ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: MaskRegion()

Postby AntoninoP » Fri Dec 20, 2019 10:58 am

I don't understand if you (Jimmy) obtain the wanted result or not, you post a C++ function, but It has not the harbour or fivewin interface...

Even I noticed that on Fivewin uses first the y or the x. I think all start from the Clipper commands like:
Code: Select all  Expand view  RUN
@ <nRow>, <nCol> SAY...

so there is before the y or row then the x or col.
But for width and heigth the order is this.
so the rectangle can be:
  • top row, left col, bottom row, right col
  • top row, left col, width, height
making confusion
AntoninoP
 
Posts: 375
Joined: Tue Feb 10, 2015 9:48 am
Location: Albenga, Italy

Re: MaskRegion()

Postby Jimmy » Fri Dec 20, 2019 8:19 pm

Antonio Linares wrote:great work!

Is it working as expected ?

YES :D
if someone like a Sample please write a Email to AUGE_OHR at WEB.DE
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: MaskRegion()

Postby Jimmy » Fri Dec 20, 2019 8:42 pm

hi,
AntoninoP wrote:making confusion

that is right but i can live with it when know it.

i have search for "CTRLDRAWFOCUS" and found it in many CLASS.
they working with o.Right and o:Bottom so all is in right order.

but as you can see in c:\fwh\source\winapi\regions.c Parameter 3 and 4 are change.
that is the Way FiveWin work and we have to respect it.

Request : please write a Comment into Source that it is "by Design"
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: MaskRegion()

Postby Jimmy » Sat Dec 21, 2019 8:49 am

hi,

i "think" i understand now why 3 and 4 are change
Code: Select all  Expand view  RUN
  DEFINE WINDOW oForm ;
       FROM nTop,nLeft TO nBottom,nRight PIXEL ;
       TITLE " Click FiveWin Version"
 

this is ROW, COL Syntax :idea:
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 89 guests