Alaska Software Inc. - Bitmap problem in Browser (tdHibrow)
Username: Password:
AuthorTopic: Bitmap problem in Browser (tdHibrow)
Nestor G. TorresBitmap problem in Browser (tdHibrow)
on Sun, 27 Jan 2013 10:22:01 +0200
AUGE_ OHRRe: Bitmap problem in Browser (tdHibrow)
on Sun, 27 Jan 2013 11:23:12 +0100
hi,

*** snip ***
aCols:={;
        {{||{"bmp",{|| Bitmap_Object_Get(cPicture_Path )}}}    ,' ' 
,.F.,'',,,8,,   },  ;

Function Bitmap_Object_Get(cPicture_Path)
Local oBmp, cPicture_Path
   oBmp := XbpBitmap():new():create()
   oBmp:loadFile(cPicture_Path)
Return oBmp
*** eof ***

i guess you Picture is bigger than shown in Columne 
so i recommend to use smaller Picture or resize it

when using XBPCOL_TYPE_BITMAP or XBPCOL_TYPE_ICON
also look at o:transparency / o:transparentClr

greetings by OHR
Jimmy
p.s. use :customDrawCell and you have full Controll over your Browse
Nestor G. TorresRe: Bitmap problem in Browser (tdHibrow)
on Sun, 27 Jan 2013 12:48:12 +0200
Hi Jimmy,

Thank you for that...
My customers have hundreds of pictures so I could not make their pictures 
smaller. Is there a way of resizing
the oBMP picture in my function Bitmap_Object_Get....That is what I would 
like to do;  but I do not know how.

Kind regards,
Nestor

"AUGE_ OHR" wrote in message 
news:35c33f16$619dcdd$4b87a@news.alaska-software.com...
> hi,
>
> *** snip ***
> aCols:={;
>        {{||{"bmp",{|| Bitmap_Object_Get(cPicture_Path )}}}    ,' ' 
> ,.F.,'',,,8,,   },  ;
>
> Function Bitmap_Object_Get(cPicture_Path)
> Local oBmp, cPicture_Path
>   oBmp := XbpBitmap():new():create()
>   oBmp:loadFile(cPicture_Path)
> Return oBmp
> *** eof ***
>
> i guess you Picture is bigger than shown in Columne 
> so i recommend to use smaller Picture or resize it
>
> when using XBPCOL_TYPE_BITMAP or XBPCOL_TYPE_ICON
> also look at o:transparency / o:transparentClr
>
> greetings by OHR
> Jimmy
> p.s. use :customDrawCell and you have full Controll over your Browse
>
>
>
AUGE_ OHRRe: Bitmap problem in Browser (tdHibrow)
on Sun, 27 Jan 2013 21:51:59 +0100
hi,

> Is there a way of resizing the oBMP picture in my function
> Bitmap_Object_Get....
> That is what I would  like to do;  but I do not know how.

you can re-Size Bitmap with this Xbase++ Function

*** Code ***
FUNCTION BMP2BMP( oBMP, aXbpSize )
LOCAL oHuge
LOCAL oTiny
LOCAL oRet
LOCAL nBits
LOCAL nPlanes
LOCAL oPS := XBPPRESSPACE() :new():Create()

   IF aXbpSize[ 2 ] > 0
      oHuge    := oBMP
      nBits    := oBMP:bits
      nPlanes  := oBMP:planes

      //Create a small bitmap
      oTiny := XBPBITMAP() :New() :Create()
      if nBits > 1 .or. nPlanes > 1
         oTiny:Make( aXbpSize[ 1 ], aXbpSize[ 2 ], nPlanes, nBits )
      ELSE
         oTiny:Make( aXbpSize[ 1 ], aXbpSize[ 2 ] )
      ENDIF
      oTiny:transparentClr := oBMP:getDefaultBGColor()
      oTiny:presSpace( oPS )

      //Copie and resize the huge bitmap to the small bitmap
      oHuge:Draw( oPS, { 0, 0, aXbpSize[1]  , aXbpSize[2]   },;
                       { 0, 0, aXbpSize[1]  , aXbpSize[2]   },,
                      GRA_BLT_BBO_IGNORE  )
      oRet := oTiny
   ELSE
      oRet := oBMP
   ENDIF

RETURN oRet
*** EOF ***

or use GraBitBlt()

*** Code ***
FUNCTION Screen2Bitmap( oSourceArea, aRect)
LOCAL oTargetPS := XbpPresSpace() :new() :create()
LOCAL oBitmap   := XbpBitmap() :new() :create()
LOCAL oPS
LOCAL nSizeX    := aRect[ 3 ] - aRect[ 1 ]
LOCAL nSizeY    := aRect[ 4 ] - aRect[ 2 ]

      oPS := oSourceArea:lockPS()
      oBitmap:presSpace( oTargetPS )
      oBitmap:make( nSizeX, nSizeY )
      GraBitBlt( oTargetPS, oPS, { 0, 0, nSizeX, nSizeY }, aRect )
      oSourceArea:unLockPS( oPS )
      Sleep( 0 )
      oTargetPS:destroy()

RETURN oBitmap
*** EOF ***



but there is a other Problem with your Code :

IMHO you are loading "each Time" a new (!) Bitmap
while create XbpBitmap Object which you never destroy()

you can use a own Array to hold Xbase++ Bitmap Object
but Windows OS() does have a Solution : ImageList

Xbase++ does include a ImageList Class see :

   c:\ALASKA\XPPW32\Source\SYS\axctrls.prg
   c:\ALASKA\XPPW32\Source\SYS\activex.prg

so you can try Alaska Object Way.

else ask in Pablo's ot4xb Forum how to use a "native" ImageList.

greetings by OHR
Jimmy
Nestor G. TorresRe: Bitmap problem in Browser (tdHibrow)
on Mon, 28 Jan 2013 10:32:05 +0200
Hi Jimmy,


It worked with a small alteration (I am thinking of passing oBMP, oTiny, 
oHuge as parameters from my main pgm that way it may prevent the memory 
leak):
THANK YOU ...You have put me on a path with some light.....Kind regards, 
Nestor
FUNCTION BMP2BMP( oBMP, aXbpSize )
LOCAL oHuge
LOCAL oTiny
LOCAL oRet
LOCAL nBits
LOCAL nPlanes
LOCAL oPS := XBPPRESSPACE() :new():Create()

   IF aXbpSize[ 2 ] > 0
      oHuge    := oBMP
      nBits    := oBMP:bits
      nPlanes  := oBMP:planes

      //Create a small bitmap
      oTiny := XBPBITMAP() :New() :Create()
      if nBits > 1 .or. nPlanes > 1
         oTiny:Make( aXbpSize[ 1 ], aXbpSize[ 2 ], nPlanes, nBits )
      ELSE
         oTiny:Make( aXbpSize[ 1 ], aXbpSize[ 2 ] )
      ENDIF
      oTiny:transparentClr := oBMP:getDefaultBGColor()
      oTiny:presSpace( oPS )

      //Copie and resize the huge bitmap to the small bitmap
      oHuge:Draw( oPS, { 0, 0, aXbpSize[1]  , aXbpSize[2]   },;
                       { 0, 0, oBMP:xSize   ,oBMP:ySize   },,; 
<====must have the origin X/Y else it just takes a portion of picture
                      GRA_BLT_BBO_IGNORE  )
      oRet := oTiny
   ELSE
      oRet := oBMP
   ENDIF

RETURN oRet


"AUGE_ OHR" wrote in message 
news:288f427$269f4411$54ce7@news.alaska-software.com...
> hi,
>
>> Is there a way of resizing the oBMP picture in my function
>> Bitmap_Object_Get....
>> That is what I would  like to do;  but I do not know how.
>
> you can re-Size Bitmap with this Xbase++ Function
>
> *** Code ***
> FUNCTION BMP2BMP( oBMP, aXbpSize )
> LOCAL oHuge
> LOCAL oTiny
> LOCAL oRet
> LOCAL nBits
> LOCAL nPlanes
> LOCAL oPS := XBPPRESSPACE() :new():Create()
>
>   IF aXbpSize[ 2 ] > 0
>      oHuge    := oBMP
>      nBits    := oBMP:bits
>      nPlanes  := oBMP:planes
>
>      //Create a small bitmap
>      oTiny := XBPBITMAP() :New() :Create()
>      if nBits > 1 .or. nPlanes > 1
>         oTiny:Make( aXbpSize[ 1 ], aXbpSize[ 2 ], nPlanes, nBits )
>      ELSE
>         oTiny:Make( aXbpSize[ 1 ], aXbpSize[ 2 ] )
>      ENDIF
>      oTiny:transparentClr := oBMP:getDefaultBGColor()
>      oTiny:presSpace( oPS )
>
>      //Copie and resize the huge bitmap to the small bitmap
>      oHuge:Draw( oPS, { 0, 0, aXbpSize[1]  , aXbpSize[2]   },;
>                       { 0, 0, aXbpSize[1]  , aXbpSize[2]   },,
>                      GRA_BLT_BBO_IGNORE  )
>      oRet := oTiny
>   ELSE
>      oRet := oBMP
>   ENDIF
>
> RETURN oRet
> *** EOF ***
>
> or use GraBitBlt()
>
> *** Code ***
> FUNCTION Screen2Bitmap( oSourceArea, aRect)
> LOCAL oTargetPS := XbpPresSpace() :new() :create()
> LOCAL oBitmap   := XbpBitmap() :new() :create()
> LOCAL oPS
> LOCAL nSizeX    := aRect[ 3 ] - aRect[ 1 ]
> LOCAL nSizeY    := aRect[ 4 ] - aRect[ 2 ]
>
>      oPS := oSourceArea:lockPS()
>      oBitmap:presSpace( oTargetPS )
>      oBitmap:make( nSizeX, nSizeY )
>      GraBitBlt( oTargetPS, oPS, { 0, 0, nSizeX, nSizeY }, aRect )
>      oSourceArea:unLockPS( oPS )
>      Sleep( 0 )
>      oTargetPS:destroy()
>
> RETURN oBitmap
> *** EOF ***
>
>
>
> but there is a other Problem with your Code :
>
> IMHO you are loading "each Time" a new (!) Bitmap
> while create XbpBitmap Object which you never destroy()
>
> you can use a own Array to hold Xbase++ Bitmap Object
> but Windows OS() does have a Solution : ImageList
>
> Xbase++ does include a ImageList Class see :
>
>   c:\ALASKA\XPPW32\Source\SYS\axctrls.prg
>   c:\ALASKA\XPPW32\Source\SYS\activex.prg
>
> so you can try Alaska Object Way.
>
> else ask in Pablo's ot4xb Forum how to use a "native" ImageList.
>
> greetings by OHR
> Jimmy
>
>
>
Zupan Miran Re: Bitmap problem in Browser (tdHibrow)
on Mon, 28 Jan 2013 13:59:19 +0100
Dne 27.1.2013 9:22, piše Nestor G. Torres:

> 3) The aCols array is then used in the tdHibrow brower function
>      from the Clayton Jones's Library giving the following effect.

Hi
I also use TD library
How did you do multiline browse in tdHibrow in col "Hme Tel" ?

Best regards
Miran Zupan
Slovenia
Nestor G. TorresRe: Bitmap problem in Browser (tdHibrow)
on Tue, 29 Jan 2013 07:08:42 +0200
Hi Miran,



The TdHibrow does not allow for multiple line in a coloum. But if you use 
the tdBMPTXT you can graphics your text and get the effect:
Following is a sample of a coloum defined to tdHibrow:

{{||{"bmp",{|| 
tdTextBmp({"0832620886","Test01","Test02","Test03",cLine5},Width:=225,Hieght:=80,'10.MS 
Sans Serif',,3 )   }}}    ,'H TEL' ,.F.,'',,,10,,   },  ;

Hope the above helps explain what you saw in my example.

Kind regards,
Nestor

"Zupan Miran" <spczupan@spc-zupan.si> wrote in message 
news:cab02ed$640e565a$6d0e@news.alaska-software.com...
> Dne 27.1.2013 9:22, piše Nestor G. Torres:
>
>> 3) The aCols array is then used in the tdHibrow brower function
>>      from the Clayton Jones's Library giving the following effect.
>
> Hi
> I also use TD library
> How did you do multiline browse in tdHibrow in col "Hme Tel" ?
>
> Best regards
> Miran Zupan
> Slovenia
>
>
Nestor G. TorresRe: Bitmap problem in Browser (tdHibrow)
on Tue, 29 Jan 2013 07:12:38 +0200
Sorry I was distracted with my wife showing off what her bird can do....

The TdHibrow does not allow for multiple line in a Column. But if you use
 the tdTextBMP you can graphics your text and get the effect:
 Following is a sample of a column defined to tdHibrow:

{{||{"bmp",{||
tdTextBmp({"0832620886","Test01","Test02","Test03",cLine5},Width:=225,Hieght:=80,'10.MS
Sans Serif',,3 ) }}} ,'H TEL' ,.F.,'',,,10,, }, ;


"Nestor G. Torres" wrote in message 
news:1cca8f96$19cf6425$21bd4@news.alaska-software.com...
> Hi Miran,
>
>
>
> The TdHibrow does not allow for multiple line in a coloum. But if you use 
> the tdBMPTXT you can graphics your text and get the effect:
> Following is a sample of a coloum defined to tdHibrow:
>
> {{||{"bmp",{|| 
> tdTextBmp({"0832620886","Test01","Test02","Test03",cLine5},Width:=225,Hieght:=80,'10.MS 
> Sans Serif',,3 )   }}}    ,'H TEL' ,.F.,'',,,10,,   },  ;
>
> Hope the above helps explain what you saw in my example.
>
> Kind regards,
> Nestor
>
> "Zupan Miran" <spczupan@spc-zupan.si> wrote in message 
> news:cab02ed$640e565a$6d0e@news.alaska-software.com...
>> Dne 27.1.2013 9:22, piše Nestor G. Torres:
>>
>>> 3) The aCols array is then used in the tdHibrow brower function
>>>      from the Clayton Jones's Library giving the following effect.
>>
>> Hi
>> I also use TD library
>> How did you do multiline browse in tdHibrow in col "Hme Tel" ?
>>
>> Best regards
>> Miran Zupan
>> Slovenia
>>
>>
>
Zupan Miran Re: Bitmap problem in Browser (tdHibrow)
on Tue, 29 Jan 2013 10:08:46 +0100
Thanks
I will try with tdTextBMP

Best regards
Miran Zupan
Zupan Miran Re: Bitmap problem in Browser (tdHibrow)
on Wed, 30 Jan 2013 16:37:47 +0100
Hi Nestor

I try with tdTextBmp

aFields:= { { {||{"bmp",{||tdTextBmp2({naziv,naziv2)},280,28,;
                            "10.Times New Roman CE",,2 ) }}} ,"Naziv"  ,.F.,,,,25 },;
             { {||{"bmp",{||tdTextBmp2({ulica,naslov},280,28,;
                            "10.Times New Roman CE",,2 )}}},"Naslov" ,.F.,,,,25 },;

... and works OK & nice

I have another small question. How did you do left alignment in coloum?

I put {XBP_PP_COL_DA_CELLALIGNMENT,XBPALIGN_LEFT} in presentation parameters in browse
and olso try with change line in funktion tdTextBMP

  GraCaptionStr(oPS,{nXpos,nYpos-2}, ,aText[i], XBPALIGN_LEFT)

but with no success

Any jint ?

Best regards
Miran Zupan


Picture1.jpg
Nestor G. TorresRe: Bitmap problem in Browser (tdHibrow)
on Thu, 31 Jan 2013 07:02:32 +0200
Hi Miran,

As you said it's starting to look good ....it could look better:
      GraCaptionStr(oPS,{1,nYpos-2}, ,aText[i],XBPALIGN_BOTTOM)
***above instead of nXpos use 1 for the left most starting position of the 
text.
***also i would recommend that you send nSpc:=3 to tdTextBMP for a better 
line spacing.
***XBPALIGN_BOTTOM is so that the text is flat against the bottom of the 
graphic line area
      that way preventing a slight snake affect with different hieght text.

Kind regards,
Nestor....

"Zupan Miran" <spczupan@spc-zupan.si> wrote in message 
news:31fdf459$19e2d248$249b1@news.alaska-software.com...
>
> Hi Nestor
>
> I try with tdTextBmp
>
> aFields:= { { {||{"bmp",{||tdTextBmp2({naziv,naziv2)},280,28,;
>                            "10.Times New Roman CE",,2 ) }}} ,"Naziv" 
> ,.F.,,,,25 },;
>             { {||{"bmp",{||tdTextBmp2({ulica,naslov},280,28,;
>                            "10.Times New Roman CE",,2 )}}},"Naslov" 
> ,.F.,,,,25 },;
>
> ... and works OK & nice
>
> I have another small question. How did you do left alignment in coloum?
>
> I put {XBP_PP_COL_DA_CELLALIGNMENT,XBPALIGN_LEFT} in presentation 
> parameters in browse
> and olso try with change line in funktion tdTextBMP
>
>  GraCaptionStr(oPS,{nXpos,nYpos-2}, ,aText[i], XBPALIGN_LEFT)
>
> but with no success
>
> Any jint ?
>
> Best regards
> Miran Zupan
>
>
Zupan Miran Re: Bitmap problem in Browser (tdHibrow)
on Thu, 31 Jan 2013 09:02:33 +0100
Hi Nestor

Of course
        GraCaptionStr(oPS,{1,nYpos-2}, ,aText[i],XBPALIGN_BOTTOM)
works "super" fine  !

Many thanks for your help

Best regards
Miran Zupan