Replacing Brushes

Find quick help here to get you started with Hollywood
djrikki
Posts: 682
Joined: Wed Apr 06, 2011 12:26 am

Replacing Brushes

Post by djrikki »

Hi,

If I want to load a brush and then change it how do I do? I noticed also if I flip, rotate or similar - it leaves remnants underneath. :S

Same goes for TextObjects, how do I update/replace a textobject?

Finally how do I check a brush/text object exists and if so clear it from the screen.

Code: Select all

LoadBrush(#IMAGEREVERT, #AISSFOLDER .. "restore", {Transparency = #FUCHSIA}) ; Restore
DisplayBrush(#IMAGEREVERT,0,0)

debugprint("here")

wait(50)

freebrush(#IMAGEREVERT)

debugprint("now here")

LoadBrush(#IMAGEREVERT, #AISSFOLDER .. "pdf", {Transparency = #FUCHSIA}) ; Restore
DisplayBrush(#IMAGEREVERT,0,0)
Evolve - Rapid GUI Development tool for MUI Royale and RapaGUI
http://myevolve.wordpress.com
User avatar
airsoftsoftwair
Posts: 5446
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Replacing Brushes

Post by airsoftsoftwair »

I guess the easiest way would be to use the powerful layers system of Hollywood. Then you can do all that with ease :)
djrikki
Posts: 682
Joined: Wed Apr 06, 2011 12:26 am

Re: Replacing Brushes

Post by djrikki »

Hi Andreas,

Having trouble getting using Layers with displays that require buttons, I keep getting this error:
A BGPic needs to be active while calling button functions!

File: imageprocessing.hws (current line: 70 - in function MakeButton)
Here is a portion of the code in question:

Code: Select all

			windowtitle = filepart(filename) .. " (" .. imageproperties.width .. "x" .. imageproperties.height .. ")"
	
			createdisplay(#IMAGEWINDOW, {active=true, width=640, height=480, title = windowtitle, layers=true, nomodeswitch=true, nohide=true})
			selectdisplay(#IMAGEWINDOW)
			movedisplay(640,515)
				
			;setfillstyle(#FILLCOLOR)
			;box(0,0,640,40, #AMIGALIGHTERGREY)
			
			createlayer(0,0,640,480, {color= #AMIGALIGHTERGREY})
			selectlayer(1)

			loadbrush(#IMAGEPREVIEW,filename)
			copybrush(#IMAGEPREVIEW,99)
			scalebrush(99,640,440)
			displaybrush(99,0,41)
			
			opendisplay(#IMAGEWINDOW)
			
			evtfunc = {OnMouseUp = p_actionToolbar, OnMouseOver = p_actionToolbar}
			
			/**********  Create toolbar *********/
			displaybrush(#IMAGEROTLEFT,400,8)
			makebutton(#IMAGEROTLEFT, #SIMPLEBUTTON,400,8,24,24, evtfunc)
Error occurs as the bottom line is called. I don't understand the error message at all. :S
Evolve - Rapid GUI Development tool for MUI Royale and RapaGUI
http://myevolve.wordpress.com
User avatar
Tuxedo
Posts: 351
Joined: Sun Feb 14, 2010 12:41 pm

Re: Replacing Brushes

Post by Tuxedo »

Hi!

Plz explain better your layer/button problem...

For the replacing brush problem with activated layers you can easly:

Code: Select all

LoadBrush(1, ...)
DisplayBrush(1, 34, 47, {Name = "foo"})

...

RemoveLayer("foo")

FreeBrush(1)
LoadBrush(1, ...
Hope to dont have forgot nothing... :P
Simone"Tuxedo"Monsignori, Perugia, ITALY.
djrikki
Posts: 682
Joined: Wed Apr 06, 2011 12:26 am

Re: Replacing Brushes

Post by djrikki »

Imagine a window, it has buttons across the top to rotate an image etc... below the buttons is an image. When I press the button it should rotate the image. Atm the image isn't on a layer so its leaves a graphic remnant underneath when rotated. So I want to move everything to layers, including the buttons as well so they depress correctly.
Evolve - Rapid GUI Development tool for MUI Royale and RapaGUI
http://myevolve.wordpress.com
User avatar
Tuxedo
Posts: 351
Joined: Sun Feb 14, 2010 12:41 pm

Re: Replacing Brushes

Post by Tuxedo »

mmm...
I think that wasnt needed.
On my app LoView I discovered that using layers slowdown the gfx update a lot...
For what you are trying to do, imho, was really better to update the whole "blitting area" whit a buffered display or and "handmade" buffered display...
So you dont have the "old" picture remnants...
For the buttons update there an example of my code on LoView:

Code: Select all

		IF	msg.id = 9
			Box(LoadPicPOS, 1, 24, 24, $DDDDDD)
			DisplayBrush(LoadPic_s, LoadPicPOS, 1)
On the above code when button "9" was pressed I blit also an "empty box" of the toolbar background color to delete the old button state so the blited button was nice and clear.
Another way to solve gfx remnants for buttons was to use non trasparent buttons...

I dunno if that was usefull to you...
Plz let me know!

Good Work!
Simone"Tuxedo"Monsignori, Perugia, ITALY.
djrikki
Posts: 682
Joined: Wed Apr 06, 2011 12:26 am

Re: Replacing Brushes

Post by djrikki »

I tried playing around with DoubleBuffering as you suggested, no luck. Are you able to upload the LoView sourcecode on to os4depot or send me it? Would be much appreciaterd.
Evolve - Rapid GUI Development tool for MUI Royale and RapaGUI
http://myevolve.wordpress.com
djrikki
Posts: 682
Joined: Wed Apr 06, 2011 12:26 am

Re: Replacing Brushes

Post by djrikki »

Hmm, made some progress, using RotateLayer() instead.
Evolve - Rapid GUI Development tool for MUI Royale and RapaGUI
http://myevolve.wordpress.com
User avatar
Tuxedo
Posts: 351
Joined: Sun Feb 14, 2010 12:41 pm

Re: Replacing Brushes

Post by Tuxedo »

Sorry but in that days I'm reall tyired from my "real" work...
About LoView source sorry but I want spread all the source code over the world...
Plz make some targeted questions and I will reply asap I can...

Happy coding!
Simone"Tuxedo"Monsignori, Perugia, ITALY.
jalih
Posts: 276
Joined: Fri Jun 18, 2010 8:08 pm
Location: Finland

Re: Replacing Brushes

Post by jalih »

djrikki wrote:Imagine a window, it has buttons across the top to rotate an image etc... below the buttons is an image. When I press the button it should rotate the image. Atm the image isn't on a layer so its leaves a graphic remnant underneath when rotated. So I want to move everything to layers, including the buttons as well so they depress correctly.
You can use my Sokoban game as an example how to work with double-buffer and buttons.

Have fun!

Available here: http://www.mediafire.com/?zdhp9d691a0k7cp
Post Reply