Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2006.11.12;
Скачать: CL | DM;

Вниз

Параметры Flash-файла   Найти похожие ветки 

 
QuickFinder   (2006-04-06 17:37) [0]

Как определить оригинальную длину и оригинальную ширину фрейма в SWF-файле?


 
QuickFinder   (2006-04-06 17:38) [1]

Точнее, ширину и высоту.


 
Sapersky   (2006-04-06 18:04) [2]

Наверное, можно как-то проще - не разбирался, просто скопировал откуда-то:

Type
 TSWFHeader = packed record
   SIGN : array [0..2] of Char;
   Version : Byte;
   FileSize : Integer;
   MovieRect : TRect;
   FPS : Word;
   FramesCount : Word;
 end;

Var
   FHeader : TSWFHeader;

function IsBitSet(val, TheBit : Byte): boolean;
begin
Result := (val and (1 shl TheBit)) <> 0;
end;

function BitInString(Const HeaderS: String; TheBit: byte): boolean;
var a,b,c: byte;
begin
a:=TheBit shr 3;
b:=a shl 3;
inc(a);
c:=TheBit-b;
result:=IsBitSet(ord(HeaderS[a]),7-c);
end;

function BitOn(val: Integer; TheBit: byte): Integer;
begin
Result := val or (1 shl TheBit);
end;

function BitLenth(Const HeaderS: String) : Byte;
begin
result := ord(HeaderS[1]) shr 3;
end;

function MovieSize(const s: String): TPoint;
var i,a,b: byte;
begin
Result.x:=0; Result.y:=0;

a:=Ord(s[1]) shr 3;
b:=4 + (a shl 1);
for I := 4+a to b do begin
 If BitInString(s,i) then Result.x:=BitOn(Result.x,a);
 Dec(a);
end;

a:=Ord(s[1]) shr 3;
b:=4 + a shl 2;
for I := 4 + a * 3 to b do begin
 if BitInString(s,I) then Result.y:=BitOn(Result.y,a);
 Dec(a);
end;

Result.x:=Result.x div 20; Result.y:=Result.y div 20;
end;

function LoadHeader: Boolean;
Var fs: TFileStream;
   buf : String;
begin
fs:= TFilestream.Create( FFilename, fmOpenRead or fmShareDenyWrite );

fs.Read(FHeader,8);
SetLength(buf, 17);
fs.Readbuffer(buf[1], 17);
fs.Free;

FHeader.MovieRect.BottomRight:=MovieSize(buf);
end;



Страницы: 1 вся ветка

Текущий архив: 2006.11.12;
Скачать: CL | DM;

Наверх




Память: 0.47 MB
Время: 0.036 c
15-1161778894
Juice
2006-10-25 16:21
2006.11.12
Install в dcc32


2-1161895270
Ingwar
2006-10-27 00:41
2006.11.12
Можно ли создать событие на изменение переменной?


15-1161578184
*Стажер*
2006-10-23 08:36
2006.11.12
Возможности модема


15-1161700019
Витян
2006-10-24 18:26
2006.11.12
Из какой «оперы» слово АВИЗО?


2-1161950690
Despo
2006-10-27 16:04
2006.11.12
Использование "..."