Skip to main content

.res file size [URGENT]

8 replies [Last post]
Anonymous

Hi,

i have a resource file of 13 KiB. When i add 4 jpg images of 92 KiB (total)
i get a resource file of 900 K. Why?
[att1.html]

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Shai Almog

The old versions of the LWUIT designer reencoded the image as a PNG.
This is not the case for the current 1.2 branch.
Unless you use indexed images in which case...
> Hi,
>
> i have a resource file of 13 KiB. When i add 4 jpg images of 92 KiB
> (total) i get a resource file of 900 K. Why?

--
Shai Almog

LWUIT Blog http://lwuit.blogspot.com/
LWUIT FAQ https://lwuit.dev.java.net/faq.html
YouTube Channel http://www.youtube.com/user/vprise
Applications in LWUIT https://lwuit.dev.java.net/nonav/featuredapp.html

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

Pablo Vagliati

Is the ResourceEditor bundled with LWUIT_1_2 a updated version of it? I have
the problem with that version.

On Thu, Sep 17, 2009 at 5:17 AM, Shai Almog wrote:

> The old versions of the LWUIT designer reencoded the image as a PNG. This
> is not the case for the current 1.2 branch.
> Unless you use indexed images in which case...
>
>> Hi,
>>
>> i have a resource file of 13 KiB. When i add 4 jpg images of 92 KiB
>> (total) i get a resource file of 900 K. Why?
>>
>
>
> --
> Shai Almog
>
> LWUIT Blog http://lwuit.blogspot.com/ LWUIT FAQ
> https://lwuit.dev.java.net/faq.html
> YouTube Channel http://www.youtube.com/user/vprise
> Applications in LWUIT https://lwuit.dev.java.net/nonav/featuredapp.html
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>
>
[att1.html]

Shai Almog

Yes, this means you probably used indexed images or something else (e.g.
bitmap fonts).
> Is the ResourceEditor bundled with LWUIT_1_2 a updated version of it?
> I have the problem with that version.
>
> On Thu, Sep 17, 2009 at 5:17 AM, Shai Almog > > wrote:
>
> The old versions of the LWUIT designer reencoded the image as a
> PNG. This is not the case for the current 1.2 branch.
> Unless you use indexed images in which case...
>
> Hi,
>
> i have a resource file of 13 KiB. When i add 4 jpg images of
> 92 KiB (total) i get a resource file of 900 K. Why?
>
>
>
> --
> Shai Almog
>
> LWUIT Blog http://lwuit.blogspot.com/ LWUIT FAQ
> https://lwuit.dev.java.net/faq.html
> YouTube Channel http://www.youtube.com/user/vprise
> Applications in LWUIT
> https://lwuit.dev.java.net/nonav/featuredapp.html
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
>
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>
>
>

--
Shai Almog

LWUIT Blog http://lwuit.blogspot.com/
LWUIT FAQ https://lwuit.dev.java.net/faq.html
YouTube Channel http://www.youtube.com/user/vprise
Applications in LWUIT https://lwuit.dev.java.net/nonav/featuredapp.html

[att1.html]

David Lucena

I don't know what Resource Manager does with images, but it may decompress them and save in raw format. What is the size of the res file once it is in a jar file?

--- El mié, 16/9/09, Pablo Vagliati escribió:

> De: Pablo Vagliati
> Asunto: .res file size [URGENT]
> Para: users@lwuit.dev.java.net
> Fecha: miércoles, 16 septiembre, 2009 11:16
> Hi,
>
> i have a resource file of 13 KiB. When i add 4 jpg images
> of 92 KiB (total) i get a resource file of 900 K. Why?
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

David Lucena

I have this piece of code for a button:

m_VoiceNoteButton = new Button( "voice note" );
m_VoiceNoteButton.setAlignment( Button.CENTER );
m_VoiceNoteButton.setPreferredW( BttnUnselectedImage.getWidth() + 2 );
m_VoiceNoteButton.setPreferredH( BttnUnselectedImage.getHeight() + 2 );

// Unselected
Style ButtonUnselectedStyle = m_VoiceNoteButton.getUnselectedStyle();
ButtonUnselectedStyle.setBgImage( BttnUnselectedImage );
ButtonUnselectedStyle.setBackgroundType( Style.BACKGROUND_IMAGE_ALIGNED, true );
ButtonUnselectedStyle.setBackgroundAlignment( Style.BACKGROUND_IMAGE_ALIGN_CENTER, true );
//ButtonUnselectedStyle.setBackgroundAlignment( (byte)( Style.BACKGROUND_IMAGE_ALIGN_TOP | Style.BACKGROUND_IMAGE_ALIGN_RIGHT ), true );
ButtonUnselectedStyle.setMargin( 0, 0, 0, 0 );
ButtonUnselectedStyle.setPadding( 1, 1, 1, 1 );
ButtonUnselectedStyle.setBorder( null );
ButtonUnselectedStyle.setBgTransparency( 0 );

// Selected
m_VoiceNoteButton.setSelectedStyle( new Style( ButtonUnselectedStyle ) );
Style ButtonSelectedStyle = m_VoiceNoteButton.getSelectedStyle();
ButtonSelectedStyle.setBgImage( BttnSelectedImage );
//ButtonSelectedStyle.setMargin( 2, 0, 2, 0 ); // A

// Pressed
m_VoiceNoteButton.setPressedStyle( new Style( ButtonSelectedStyle ) );
Style ButtonPressedStyle = m_VoiceNoteButton.getPressedStyle();
//ButtonPressedStyle.setMargin( 2, 0, 2, 0 ); // B
ButtonPressedStyle..setPadding( 2, 1, 2, 1 );

Note that the unselected image is the same dimension of the selected image.

If I let the code this way, unselected button will show in the same
position as selected button. And when pressing, the label ("voice note")
will be moved, as it is padded one pixel more in the top and the left.
So the pressed style is working in the padding case.

If I uncomment the line marked A, then the selected button will be placed
more to the right
, and the pressed
button will be placed in the same place and the label still be padded.

If I comment the line marked A, and uncomment B, then the unselected button
will be in the same place of the selected button, and the pressed button will be in the same place while it should be more to the right and to the left.

As I can deduce, Margin of the pressed button state style is affected by
Margin of the selected button state style, while Margin in the pressed
button style is ingored. Isn't this a bug?

Thanks in advance.

David.
David.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

Shai Almog

Selected/unselected have a special relationship which isn't necessarily
shared by other styles (e.g. pressed & future styles).
> I have this piece of code for a button:
>
>
> m_VoiceNoteButton = new Button( "voice note" );
> m_VoiceNoteButton.setAlignment( Button.CENTER );
> m_VoiceNoteButton.setPreferredW( BttnUnselectedImage.getWidth() + 2 );
> m_VoiceNoteButton.setPreferredH( BttnUnselectedImage.getHeight() + 2 );
>
> // Unselected
> Style ButtonUnselectedStyle = m_VoiceNoteButton.getUnselectedStyle();
> ButtonUnselectedStyle.setBgImage( BttnUnselectedImage );
> ButtonUnselectedStyle.setBackgroundType( Style.BACKGROUND_IMAGE_ALIGNED, true );
> ButtonUnselectedStyle.setBackgroundAlignment( Style.BACKGROUND_IMAGE_ALIGN_CENTER, true );
> //ButtonUnselectedStyle.setBackgroundAlignment( (byte)( Style.BACKGROUND_IMAGE_ALIGN_TOP | Style.BACKGROUND_IMAGE_ALIGN_RIGHT ), true );
> ButtonUnselectedStyle.setMargin( 0, 0, 0, 0 );
> ButtonUnselectedStyle.setPadding( 1, 1, 1, 1 );
> ButtonUnselectedStyle.setBorder( null );
> ButtonUnselectedStyle.setBgTransparency( 0 );
>
> // Selected
> m_VoiceNoteButton.setSelectedStyle( new Style( ButtonUnselectedStyle ) );
> Style ButtonSelectedStyle = m_VoiceNoteButton.getSelectedStyle();
> ButtonSelectedStyle.setBgImage( BttnSelectedImage );
> //ButtonSelectedStyle.setMargin( 2, 0, 2, 0 ); // A
>
> // Pressed
> m_VoiceNoteButton.setPressedStyle( new Style( ButtonSelectedStyle ) );
> Style ButtonPressedStyle = m_VoiceNoteButton.getPressedStyle();
> //ButtonPressedStyle.setMargin( 2, 0, 2, 0 ); // B
> ButtonPressedStyle..setPadding( 2, 1, 2, 1 );
>
>
> Note that the unselected image is the same dimension of the selected image.
>
> If I let the code this way, unselected button will show in the same
> position as selected button. And when pressing, the label ("voice note")
> will be moved, as it is padded one pixel more in the top and the left.
> So the pressed style is working in the padding case.
>
> If I uncomment the line marked A, then the selected button will be placed
> more to the right and the bottom than when is unselected, and the pressed
> button will be placed in the same place and the label still be padded.
>
> If I comment the line marked A, and uncomment B, then the unselected button
> will be in the same place of the selected button, and the pressed button will be in the same place while it should be more to the right and to the left.
>
> As I can deduce, Margin of the pressed button state style is affected by
> Margin of the selected button state style, while Margin in the pressed
> button style is ingored. Isn't this a bug?
>
> Thanks in advance.
>
>
> David.
> David.
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>
>

--
Shai Almog

LWUIT Blog http://lwuit.blogspot.com/
LWUIT FAQ https://lwuit.dev.java.net/faq.html
YouTube Channel http://www.youtube.com/user/vprise
Applications in LWUIT https://lwuit.dev.java.net/nonav/featuredapp.html

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

David Lucena

I don't really understand what are you trying to tell me, but at the moment this does not solves my problem. If the PressedStyle is considered
when the button is pressed, why margin is ignored?

--- El jue, 17/9/09, Shai Almog escribió:

> De: Shai Almog
> Asunto: Re: Button Pressed Style Margin is ignored (the margin is the one of selected style );
> Para: users@lwuit.dev.java.net
> Fecha: jueves, 17 septiembre, 2009 10:19
> Selected/unselected have a special
> relationship which isn't necessarily
> shared by other styles (e.g.. pressed & future styles).
> > I have this piece of code for a button:
> >
> >
> >     
>    m_VoiceNoteButton = new Button( "voice
> note" );
> >     
>    m_VoiceNoteButton.setAlignment(
> Button.CENTER );
> >     
>    m_VoiceNoteButton.setPreferredW(
> BttnUnselectedImage.getWidth() + 2 );
> >     
>    m_VoiceNoteButton.setPreferredH(
> BttnUnselectedImage.getHeight() + 2 );
> >
> >         // Unselected
> >         Style
> ButtonUnselectedStyle =
> m_VoiceNoteButton.getUnselectedStyle();
> >     
>    ButtonUnselectedStyle.setBgImage(
> BttnUnselectedImage );
> >     
>    ButtonUnselectedStyle.setBackgroundType(
> Style.BACKGROUND_IMAGE_ALIGNED, true );
> >     
>    ButtonUnselectedStyle.setBackgroundAlignment(
> Style.BACKGROUND_IMAGE_ALIGN_CENTER, true );
> >     
>    //ButtonUnselectedStyle.setBackgroundAlignment(
> (byte)( Style.BACKGROUND_IMAGE_ALIGN_TOP |
> Style.BACKGROUND_IMAGE_ALIGN_RIGHT ), true );
> >     
>    ButtonUnselectedStyle.setMargin( 0, 0, 0,
> 0 );
> >     
>    ButtonUnselectedStyle.setPadding( 1, 1, 1,
> 1 );
> >     
>    ButtonUnselectedStyle.setBorder( null );
> >     
>    ButtonUnselectedStyle.setBgTransparency( 0
> );
> >
> >         // Selected
> >     
>    m_VoiceNoteButton.setSelectedStyle( new
> Style( ButtonUnselectedStyle ) );
> >         Style
> ButtonSelectedStyle = m_VoiceNoteButton.getSelectedStyle();
> >     
>    ButtonSelectedStyle.setBgImage(
> BttnSelectedImage );
> >     
>    //ButtonSelect

> >         // Pressed
> >     
>    m_VoiceNoteButton.setPressedStyle( new
> Style( ButtonSelectedStyle ) );
> >         Style
> ButtonPressedStyle = m_VoiceNoteButton.getPressedStyle();
> >     
>    //ButtonPressedStyle.setMargin( 2, 0, 2, 0
> );  // B
> >     
>    ButtonPressedStyle..setPadding( 2, 1, 2, 1
> );
> > 
> >
> > Note that the unselected image is the same dimension
> of the selected image.
> >
> > If I let the code this way, unselected button will
> show in the same
> > position as selected button. And when pressing, the
> label ("voice note")
> > will be moved, as it is padded one pixel more in the
> top and the left.
> > So the pressed style is working in the padding case.
> >
> > If I uncomment the line marked A, then the selected
> button will be placed
> > more to the right and the bottom than when is
> unselected, and the pressed
> > button will be placed in the same place and the label
> still be padded.
> >
> > If I comment the line marked A, and uncomment B, then
> the unselected button
> > will be in the same place of the selected button, and
> the pressed button will be in the same place while it should
> be more to the right and to the left.
> >
> > As I can deduce, Margin of the pressed button state
> style is affected by
> > Margin of the selected button state style, while
> Margin in the pressed
> > button style is ingored. Isn't this a bug?
> >
> > Thanks in advance.
> >
> >
> > David.
> > David.
> >
> >
> >
> >
> >
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> > For additional commands, e-mail: users-help@lwuit.dev.java..net
> >
> >   
>
>
> --
> Shai Almog
>
> LWUIT Blog http://lwuit.blogspot.com/
> LWUIT FAQ https://lwuit.dev.java.net/faq.html
> YouTube Channel http://www.youtube.com/user/vprise
> Applications in LWUIT https://lwuit.dev.java.net/nonav/featuredapp.html
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail
ional commands, e-mail: users-help@lwuit.dev.java.net
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

Shai Almog

Margin is a feature of the layout, moving it around requires "reflowing"
the UI which is something we need to do explicitly and might not have a
"proper" place to put it. This is somewhat of a problem since you don't
want to reflow the UI unless absolutely necessary...

If this is a problem please provide a more concise issue in the issue
tracker: e.g. Pressed Style with different margin has no effect on the
button.
However, I'm not sure if we will be able to resolve this sort of issue
due to the performance implications of something like this.

David Lucena wrote:
> I don't really understand what are you trying to tell me, but at the moment this does not solves my problem. If the PressedStyle is considered
> when the button is pressed, why margin is ignored?
>

--
Shai Almog

LWUIT Blog http://lwuit.blogspot.com/
LWUIT FAQ https://lwuit.dev.java.net/faq.html
YouTube Channel http://www.youtube.com/user/vprise
Applications in LWUIT https://lwuit.dev.java.net/nonav/featuredapp.html

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net