Author | Topic: XbpBitmap():draw() | |
---|---|---|
Carlos A Beling | XbpBitmap():draw() on Thu, 18 Oct 2018 17:21:35 -0300 Good evening. I am trying XbpBitmap():draw() shows its image as disabled (parameter <nState> = XBP_STATE_DISABLED) and I could not making it works. How can I accomplish this? Fraternally Beling | |
Jim Lee | Re: XbpBitmap():draw() on Thu, 18 Oct 2018 23:58:13 +0200 hi, > I am trying XbpBitmap():draw() shows its image as disabled (parameter > <nState> = XBP_STATE_DISABLED) and I could not making it works. > How can I accomplish this? you can disable a XbPart but not a Image ... you can try to convert Image to Grey-Scale using Gnter Beyes Solution IF oImage <> NIL Ausgabe nur, wenn Bitmap angegeben IF BAnd(aInfo[3], XBP_DRAWSTATE_DISABLED) == XBP_DRAWSTATE_DISABLED oImage := BMPGreyScale(::image, .T.) Graustufenbild ENDIF oImage:draw(oPS, ::imageRect) Bild malen im vorgegebenen Grenbereich ENDIF GREY_BMP.ZIP | |
Carlos A Beling | Re: XbpBitmap():draw() on Fri, 19 Oct 2018 12:26:18 -0300 Hi Jim: good afternoon. Many thanks. The same image may to be rendered enabled or disabled each time it will be used. Then, if I use this approach, I will need changing the image according to each state (enable or disable) before rendering it. I am thinking to use XbpBitmap:transparentClr for "simulate" the image's state. Fraternally Beling Em 18/10/2018 18:58, Jim Lee escreveu: > hi, > >> I am trying XbpBitmap():draw() shows its image as disabled (parameter >> <nState> = XBP_STATE_DISABLED) and I could not making it works. >> How can I accomplish this? > > you can disable a XbPart but not a Image ... > > you can try to convert Image to Grey-Scale using Günter Beyes Solution > > IF oImage <> NIL Ausgabe nur, wenn Bitmap angegeben > IF BAnd(aInfo[3], XBP_DRAWSTATE_DISABLED) == XBP_DRAWSTATE_DISABLED > oImage := BMPGreyScale(::image, .T.) Graustufenbild > ENDIF > oImage:draw(oPS, ::imageRect) Bild malen im vorgegebenen > Größenbereich > ENDIF > > > | |
Jose Antonio Diego Kereje | Re: XbpBitmap():draw() on Fri, 19 Oct 2018 17:46:56 +0200 Hi, > Then, if I use this approach, I will need changing > the image according to each state (enable or disable) > before rendering it. No, you can use this approach: ******************************** CLASS MyXbpBitmap FROM XbpBitmap ******************************** PROTECTED: VAR oDisabledBmp EXPORTED: INLINE METHOD destroy ********************* ::XbpBitmap:destroy() IF ::oDisabledBmp # nil ; ::oDisabledBmp:destroy() ; ::oDisabledBmp:= nil ; ENDIF RETURN self INLINE METHOD Draw( oPS, aTargetRect, aSourceRect, nRasterOP, nCompress, nState ) ********************************************************************************* IF nState = XBP_STATE_DISABLED IF ::oDisabledBmp = nil ::oDisabledBmp:= BMPGreyScale( self, .T. ) ENDIF RETURN ::oDisabledBmp:draw( oPS, aTargetRect, aSourceRect, nRasterOP, nCompress, XBP_STATE_NORMAL ) ENDIF RETURN ::XbpBitmap:draw( oPS, aTargetRect, aSourceRect, nRasterOP, nCompress, XBP_STATE_NORMAL ) ENDCLASS Regards. Diego | |
Carlos A Beling | Re: XbpBitmap():draw() on Fri, 19 Oct 2018 15:47:18 -0300 Hello Diego. Many thanks Very, very good. May be I make a subclass of XbpBitmap() with an iVar ::oBitmapDisable and, in the method ::draw(..., nState) I make: if <nState> == XBP_STATE_DISABLE; ::oBitmapDisable:draw(...) else; ::XbpBitmap:Draw(...) endif Fraternally Beling Em 19/10/2018 12:46, Jose Antonio Diego Kereje escreveu: > Hi, > >> Then, if I use this approach, I will need changing >> the image according to each state (enable or disable) >> before rendering it. > > No, you can use this approach: > > ******************************** > CLASS MyXbpBitmap FROM XbpBitmap > ******************************** > PROTECTED: > VAR oDisabledBmp > > EXPORTED: > INLINE METHOD destroy > ********************* > ::XbpBitmap:destroy() > IF ::oDisabledBmp # nil ; ::oDisabledBmp:destroy() ; > ::oDisabledBmp:= nil ; ENDIF > RETURN self > > INLINE METHOD Draw( oPS, aTargetRect, aSourceRect, nRasterOP, > nCompress, nState ) > > ********************************************************************************* > > IF nState = XBP_STATE_DISABLED > IF ::oDisabledBmp = nil > ::oDisabledBmp:= BMPGreyScale( self, .T. ) > ENDIF > RETURN ::oDisabledBmp:draw( oPS, aTargetRect, aSourceRect, > nRasterOP, nCompress, XBP_STATE_NORMAL ) > ENDIF > RETURN ::XbpBitmap:draw( oPS, aTargetRect, aSourceRect, nRasterOP, > nCompress, XBP_STATE_NORMAL ) > ENDCLASS > > Regards. Diego |