Does TextObject uses palette by default?

Report any Hollywood bugs here
Post Reply
User avatar
lazi
Posts: 625
Joined: Thu Feb 24, 2011 11:08 pm

Does TextObject uses palette by default?

Post by lazi »

As trying to make a hardware brush with text I found that I need to RemoveBrushPalette() from the brush before CopyBrush() to hardware brush if the source brush comes from a textobject. :-)

Here is the code that tells it more understandable:

Code: Select all

@REQUIRE "glgalore"

CreateTextObject(1,"Hollywood",{align=#RIGHT,color=#GRAY})
ConvertToBrush(#TEXTOBJECT,1,1)

RemoveBrushPalette(1)

BeginDoubleBuffer(True)
CopyBrush(1,2,{hardware=True})
DisplayBrush(2,100,10)
DebugPrint(GetAttribute(#BRUSH,2,#ATTRHARDWARE))
Flip()

WaitLeftMouse        
Without the RemoveBrushPalette() Hollywood drops the message:
> test.hws:9: Wrong usage/parameters for this command!
> Read the documentation!

If CopyBrush() could handle this automatically, that would be a bit cleaner I think.

Bye
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Does TextObject uses palette by default?

Post by airsoftsoftwair »

Actually, this is a change in behaviour starting with Hollywood 9. For performance and memory efficiency reasons, single color objects like text objects are stored as palette graphics internally now. This saves a lot of memory in comparison to storing them as 32-bit RGB but of course in your specific case it's a compatibility break with previous versions because palette brushes can't be converted to hardware brushes so CopyBrush() should really do that so that Hollywood 9 behaves the same as before.
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Does TextObject uses palette by default?

Post by airsoftsoftwair »

Code: Select all

- New: CopyBrush() can now also convert palette brushes to hardware brushes
User avatar
lazi
Posts: 625
Joined: Thu Feb 24, 2011 11:08 pm

Re: Does TextObject uses palette by default?

Post by lazi »

Thanks!
Post Reply