Author Topic: Trimming alpha  (Read 5553 times)

Alessaint

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 67
    • View Profile
Trimming alpha
« on: July 18, 2014, 01:36:53 AM »
I'm a bit lost as to how resizing of images stored with trimmed alpha should be handled. I have some 128x128 images with trimmed alpha. When I set their size to native 128x128 ("snap" button), they look fine. If I set size to 64x64 they are distorted - no longer 1:1 aspect even though size reads 64x64. This happens only when the images have trimmed alpha. Am I missing something or is it a bug?

Thanks


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Trimming alpha
« Reply #1 on: July 18, 2014, 06:47:24 AM »
Seems to work fine here. I just gave it a try -- added a sprite, gave it some padding (which is what trimmed alpha turns into), scaled it, and it works as expected. Make sure you're using a normal sprite, not a sliced sprite.

Alessaint

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 67
    • View Profile
Re: Trimming alpha
« Reply #2 on: July 18, 2014, 08:20:41 AM »
Hm, you were right - I did indeed overlook the sprite being set to Sliced - I'm sorry. I was wondering though that maybe you could display a warning at UISprite component when it is set to Sliced and the sprite has a zero Border rectangle (meaning it's not intended to be used this way)?

A.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Trimming alpha
« Reply #3 on: July 19, 2014, 10:43:34 AM »
When the sprite has no border information, it's always drawn as a regular sprite, even if you set it to Sliced type.

Alessaint

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 67
    • View Profile
Re: Trimming alpha
« Reply #4 on: July 20, 2014, 12:57:06 AM »
Well, that's actually my point :) - Sliced sprite with no border information is drawn as regular sprite _but_ there are obviously some features where it doesn't act like one (obviously the sizing issue) - which can be a bit misleading. I'm certainly not going to make the same mistake again (or at least I hope so :)) but for the sake of other users I believe it should either behave like regular sprite at all aspects or there should be a warning. Just my two cents, though..