Главная страница
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.03 c
15-1161603729
kan
2006-10-23 15:42
2006.11.12
Проверка диска при загрузке WinXP


1-1158760891
JohnnyRaw
2006-09-20 18:01
2006.11.12
Проблема с утечкой памяти (использую MemProof)


1-1159707242
RASkov
2006-10-01 16:54
2006.11.12
RectToObject и наоборот


2-1161706496
vegarulez
2006-10-24 20:14
2006.11.12
Как в messagebox поместить string?


2-1162186962
Sergey_b
2006-10-30 08:42
2006.11.12
MDI