lcd and "clear"
Is it possible to clear only a given region of an lcd object?
For example one could send a "clear 10 10 50 50" (left, top, bottom, right) and clear the contents of just that rectangle.
I suppose you could just draw a rectangle at those coordinates that’s the same color as your background…
why not just send a paintrect message with a color that matches your
background over the area in question?
On Feb 20, 2009, at 2:12 AM, Dunya Kirkali wrote:
> Dear All,
> Is it possible to clear only a given region of an lcd object?
> For example one could send a "clear 10 10 50 50" (left, top, bottom,
> right) and clear the contents of just that rectangle.
The main issue is that I have another picture for my background so it is not possible to cover it with a rectangle.
Well, it’s not possible to clear just a portion of LCD, and if it was, then it would probably clear that part of your picture as well. What exactly are you trying to do? if you only have to clear a certain area every so often, you could just redraw the LCD entirely, leaving out the part you want gone…
You can make the lcd background transparent (in inspector) then use sprites to do all your drawing. Then use the hidesprite and drawsprite messages when you want to cover/uncover areas of your background.
before clearing a region, first create a region.
("region" actually exist in lcd world)
but i would recommend the draw-a-rect-in-backgroundcolor method.
I tried the sprite approach. But I couldn’t get the sprite to record text "write" messages. Don’t know why yet.
I have a fpic as a background image on top of which I draw a matrix of pictures in the lcd. I want to be able to redraw any one element of the matrix so that I don’t have to redraw the whole matrix (since it takes some time…).
So I need to clear that region in order to make it transparent again so that I can see my fpic through the lcd.
I couldn’t figure out the region approach yet. I will have a look into it soon.
thanks for the replies
for text, try textbrick:
you could have the textbrick ui object(s) used for text overlaid on top of the lcd object which just draws and hides sprites or regions.
Re: sprites and ‘write’ messages, there is an issue where you need to make sure that you define the font AFTER the ‘recordsprite’ message:
----------begin_max5_patcher---------- 707.3ocwW0ziaCBD8ryuhQ9xdwcEf+t25wdn+BppV40lrgt1PjgzjzU8+d4C mMjlzTuMqSjb.w.17lGy7FxKyBBeTrgJCgOBeEBBdYVPf0jwPvv3fvtpM0sU R6xB6nRY0SzvH2bJ5Fk0dSe0Z4xdlhBFaaALBY9sagKqT0KX7mdnmVqbaHIK 9dTDTjaZwnRaW58H3aCuybAWIY+jZVtYVmU9pNFukpr3gr2nXkZmU7fUViEa hG+9GHuBjdpjxUUJlf6AljTKXvF.DAnglWgh6iq1tj5VdX3AnjW0YmH7S8rp 1PyD+Z1LSSzExq0szp9yPhokEd3Nlbe5DRh3vqEcTK55zmRmfNX0OCczywHX a.UJw1lXZIn+BgfImlQvmjQPGyHYkgWE+9yb3KUa.8gqZASBBd6VXsn+YIvl CaEqfF5bFWm6sfBFj.UyUzd3NMsH5abIl2ctbwDKoQrswNtaBYsrvqRxCkW8 XK048R3bZQoHjWZT9zpEkle0xi3z05c7HhoGThGZqaNWDAYe.Qhibxea7AZz 7QQ3sVlsgp2WpeAryPMwkkdAKkjoMXo7lSNGlFgi.aQogwQfuFSDzI9AUIz0 y0OQNsHKf.bVDr1xuKXFcpdp4CIjGv5QvQWjffzO6vTqVjqVrhq74vSpmU3I +m45lpinLzM+HZAqYzQuHrWzaQ7jF8lgu0RcxQH04BVvtZfIj+GwtwW6i79V 6aLp3t61Rvktx5Ydt1HbhjS3Dw61yCzF7+FGcd2xj560rumwsc5v.Ou1hKaV 9e7uRr9lw9gTgTrpud2NLbOeXu2oSJTLt8t9dqI6vEoycZnb+iqNVyRgFeCX fj6tVMYPFI+0QGf8n2LXME992nM9sg1KDS3If.yPNJKtvm.MitPvZTde2Q6k hoofAiwnogAMWu3cGsInhIBs4S.ZSQkiAs5A+Z1uAPoPIHF -----------end_max5_patcher-----------
I appreciate all the help.
I tried textbrick, it looks nice but it is a limited for what I am thinking of.
I also tried the sprite approach (thanks to ben I got the text to work in the sprites too). It seems to work fine. But once I want to have dynamic user interfaces with a lot of sprites in it, it still taqkes some time to hide/show sprites. It might still be because of the "write" command ("see lcd and write method" in the forum)but I haven’t tested it any further.
Thank you all.