Главная страница
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.108 c
15-1161949686
TIF
2006-10-27 15:48
2006.11.12
Совместимость с Windows 98


15-1161695275
oldman
2006-10-24 17:07
2006.11.12
В России будет создан реестр непьющих мужчин


15-1161854336
Delphi)basic
2006-10-26 13:18
2006.11.12
Как в Java создать savepoint ?


2-1161775849
KyRo
2006-10-25 15:30
2006.11.12
Код Enter


2-1161675853
kirillrepin
2006-10-24 11:44
2006.11.12
TStringList