Главная страница
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.038 c
2-1161779513
dera
2006-10-25 16:31
2006.11.12
Вопрос о форме...


15-1161284497
Cyrax
2006-10-19 23:01
2006.11.12
Поиск файлов-дубликатов


15-1161329175
Maximaxi
2006-10-20 11:26
2006.11.12
Скачать Delphi 4


15-1159624549
Eraser
2006-09-30 17:55
2006.11.12
BDS 2006, редактор кода и русские комментарии.


15-1161875174
oldman
2006-10-26 19:06
2006.11.12
Магия чисел?