BitmapShaders are "pinned" relative to the window coordinates.
On Mon, Jul 2, 2012 at 7:17 AM, Alexander Alexander <[email protected]>wrote: > Ho dude, do you know that you saved a functionality of my application with > this post. > > As you said, we need to translate Bitmap pattern origin to our using a > "setLocalMatrix()" > function on the BitmapShader to translate, rotate, or even scale it. > > Example: > > Matrix localmatrix = new Matrix(); > localmatrix.setTranslate(MyCanvasXCoords, MyCanvasYCoords); // a > translation for example > MyBitmapShader.setLocalMatrix(localmatrix); > > And BAM!! Is is solved. > > Thank you again. > > This post is the one of the most useful in my list of useful posts). > > Have a very good day, > > Alexander. > > Le samedi 12 avril 2008 18:22:24 UTC+2, Rui Martins a écrit : >> >> When using BitmapShader, the results might be surprising, or look >> strange or just erroneous. >> >> This looks like a bug or problem, because the class/methods >> documentation is missing some important info. >> >> Nowhere in the documentation is stated that the bitmap will be pinned >> down to the screen absolut coords, or to be more precise: the Shader >> bitmap pattern will have it's origin pinned down to a relative >> position given by the BitmapShader Matrix, relative to the screen >> absolute coords. >> >> This is done, instead of using the drawn Object origin as origin form >> bitmap pattern. >> >> This is specialy noticeable, when we use TileMode.CLAMP for X or Y. >> and then draw somewhere besides the screen origin, (a rectangle for >> example). >> >> Intended usage or not, this is NOT state anywhere in the Docs. >> >> So, if we want to pin down the Bitmap pattern origin to our drawn >> object origin, we mast translate the BtmapShader Matrix to the same >> location as our drawn object (rectangle, path, or whatever). >> >> Hope this saves someone some frustrating time, debugging. >> >> P.S. >> I'm not shure, if the origin for the Bitmap Pattern is relative to >> Screen/Window origin, or relative to the View origin. Some further >> testing would be required to determine this. >> I fixed my problem, so if you really need this info, experiment, and >> post back with some info. >> Or maybe someone from google will hint us on the expected behaviour. > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- Romain Guy Android framework engineer [email protected] -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

