@magnusviri, thanks for that heads up, I had changed some settings for a RSS blog reader widget and changed it to display text upto the jump point, and it is silly in the sense, that it applies that to the whole site, not the RSS Feed. Fixed now, so should not be a problem.
This is awsome! Is there any reason we'd want to use a Bitmap over this method of displaying a texture? I almost created my own MaskedBitmap class but I thought this should be part of the official API.
I think there is, this masking method is actually a shape that is filled, where as the Bitmap is a direct texture on the screen. So as the older Windows API went, you can BitBlt the bitmap onto the screen, has a lower overhead and if you want to mask the same, then one can use the shape object and fill it with the texture and adjust the texture accordingly, this is a draw method, that has a slightly higher overhead as compared to the direct blitting the bitmap onto the screen.
I would be curious to know what your approach was, when you say you wrote your own maskedBitmap class.
I guess the only problem I can see with this method is it will only act to mask a single texture, not other visible elements, nor groups of elements so, whilst it's definitely useful for simple cases, it doesn't seem to provide what's ultimately needed with either clipping or bitmap masking.
Ok, I'll explain why I'm interested in masks. You can make a homemade stereo 3d viewer by putting 2 magnifying glass lenses next to each other like eye glasses and about 3-5 inches away from a mobile phone (I used a cardboard box and tape to keep it all together). I've been playing with creating stereo split parallel views by drawing something twice, slightly offset on each side of the screen. To get this working with images, I need to have each side of the screen clip down the middle so that images from one side don't cross over to the other side.
I was thinking of making a custom MaskedBitmap class so that it autosized to the image, then if the image was ever moved to the middle, it would auto clip itself so it never crossed the boundary.
I'm thinking this would just be a messy hack and I should just wait for official clipping support and work on other things until then.
Just migrated to Gideros and found this feature painfully missing -at least I could not find anything about a masking feature in the docs :-(
As moopf explained above, the workaround explained above does not work with groups of images or combined elements, so it's funny to play with, but by no means a replacement for a missing masking feature.
@MauMau, meanwhile combined with rendertarget, now you can mask combined elements as well i think. just make your complicated sprite hierarchy with the elements, draw it on a rendertarget and then draw a shape using this rendertarget as texture./
it will display black rectangle, because it will display only w width and h height from 0,0 coordinate, and coordinate 100,100 is out of that visible area.
So most probably your internal objects inside MySprite are positioned outside this visible area. You could check it by increasing w and h values, for example like this:
From the texture stand of point yes, everything in texture should be absolutely positioned, So for RenderTarget you must have all the width from 0 to you position + width but it does not mean you can't have such offsets, as you can again apply the offset like this (taking only needed texture region):
local Img = Bitmap.new(TextureRegion.new(Tex,x,y,w,h))
Comments
My apps: http://www.yummyyellow.com
Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
Cool Vizify Profile at https://www.vizify.com/oz-apps
Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
Cool Vizify Profile at https://www.vizify.com/oz-apps
There was also talk about in this thread:
http://giderosmobile.com/forum/discussion/comment/3903#Comment_3903
I have no idea what the issues they are discussing here are. I'm not sure if I should ask in this thread or that one though...
My apps: http://www.yummyyellow.com
I would be curious to know what your approach was, when you say you wrote your own maskedBitmap class.
Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
Cool Vizify Profile at https://www.vizify.com/oz-apps
I was thinking of making a custom MaskedBitmap class so that it autosized to the image, then if the image was ever moved to the middle, it would auto clip itself so it never crossed the boundary.
I'm thinking this would just be a messy hack and I should just wait for official clipping support and work on other things until then.
Likes: DRS
My apps: http://www.yummyyellow.com
As moopf explained above, the workaround explained above does not work with groups of images or combined elements, so it's funny to play with, but by no means a replacement for a missing masking feature.
just make your complicated sprite hierarchy with the elements, draw it on a rendertarget and then draw a shape using this rendertarget as texture./
Fragmenter - animated loop machine and IKONOMIKON - the memory game
MySprite is a complex sprite with bitmaps, sprites and texts within.
Is there a *working* RenderTarget code snippet anywhere that I can test to verify if this feature works on my machine?
You might be misinterpreting the internal Sprite positioning or getBounds method, so for example, if I do this:
So most probably your internal objects inside MySprite are positioned outside this visible area. You could check it by increasing w and h values, for example like this:
So the sprite that should be drawn to a render target always needs to be positioned at 0,0?
but it does not mean you can't have such offsets, as you can again apply the offset like this (taking only needed texture region):