سؤال

The SWF File Format Specification Version 19 says the scale value in the MATRIX record is stored as FB, somewhere else in the specification it says the FB is a 32 bit 16.16 fixed point value, but there's a value how many bits it uses to store the value and in the example it is a 3.16 value and not a 16.16 value.

  • How can it be a 32 bit 16.16 value and a 19 bit 3.16 value at the same time?
  • How does Flash Player know wheter it's a 3.16, 4.15, 5.14, X.X value?
  • What exactly is the format of the FB?

I want to know this because I want to insert a sprite into a already compiled SWF file. I already succesfully used the PlaceObject tag once in that sprite but now I have an image that has to be scaled down, this is done in the MATRIX record too, but first I didn't need the FB because the other image already is at the right scale.

edit: I'm going to try if I can make new sprites with Sothink SWF Quicker tomorrow, if it doesn't work I'll try to make a simple swf file with the sprite in it using Adobe Flash CS 6 and then copy the DefineSprite tag into the other SWF file. If someone answers I'll first try to do the scale thing with a hex editor before I try it with Sothink SWF Quicker.

edit2: Sothink SWF Quicker crashes when I try to Import the SWF file. If copying the tag from the SWF file I'm going to create doesn't work I'll delete the image I want to place with the PlaceObject tag and then reinsert it scaled down.

edit3: I don't know how to make Flash use the DefineSprite tag, so I added a DefineBitsLossless2 tag with the image scaled down, I'll be using this image in the sprite. I don't need the FB now anymore, but it still would be nice to know how they work, so if someone know it, please answer.

هل كانت مفيدة؟

المحلول

Matrix record begins like this:

HasScale    UB[1]
NScaleBits  If HasScale=1, UB[5]
ScaleX      If HasScale=1, FB[NScaleBits]
ScaleY      If HasScale=1, FB[NScaleBits]
...

FB[NScaleBits] is indeed a fixed-point value, but not necessarily 16.16 - it all comes down to NScaleBits (so it's different from the regular fixed-point number, which is always 16.16).

The number of bits used is fixed or specified beforehand, like in case with Matrix, so Flash Player just knows.

For instance, 2.8 would be if 0x28000 in dex, and NScaleBits is 19 in this case, because we need minimum of 3 bits to represebt signed number "2" (3 + 16 = 19).

I know this is an old question. Still, someone might stumble upon it, the way I did.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top