32 |
|
property Data: Tdata Read FData Write FData; |
33 |
|
|
34 |
|
constructor Create; |
35 |
< |
function Load(fileid: LongWord): Boolean; |
36 |
< |
function LoadFromPSpc(fileid: LongWord): Boolean; |
37 |
< |
function LoadFromTXMP(fileid: LongWord): Boolean; |
38 |
< |
function LoadFromTXMB(fileid: LongWord): Boolean; |
35 |
> |
function Load(connection: TOniData; fileid: Cardinal): Boolean; |
36 |
> |
function LoadFromPSpc(connection: TOniData; fileid: LongWord): Boolean; |
37 |
> |
function LoadFromTXMP(connection: TOniData; fileid: LongWord): Boolean; |
38 |
> |
function LoadFromTXMB(connection: TOniData; fileid: LongWord): Boolean; |
39 |
|
function GetImageDataSize(fading: Boolean): LongWord; |
40 |
|
|
41 |
|
function GetAsData: Tdata; |
302 |
|
|
303 |
|
|
304 |
|
|
305 |
< |
function TOniImage.Load(fileid: LongWord): Boolean; |
305 |
> |
function TOniImage.Load(connection: TOniData; fileid: Cardinal): Boolean; |
306 |
|
var |
307 |
|
FileInfo: TFileInfo; |
308 |
|
ext: String; |
309 |
|
begin |
310 |
< |
FileInfo := OniDataConnection.GetFileInfo(fileid); |
310 |
> |
FileInfo := connection.GetFileInfo(fileid); |
311 |
|
if FileInfo.Extension = 'PSpc' then |
312 |
< |
Result := LoadFromPSpc(fileid) |
312 |
> |
Result := LoadFromPSpc(connection, fileid) |
313 |
|
else if FileInfo.Extension = 'TXMB' then |
314 |
< |
Result := LoadFromTXMB(fileid) |
314 |
> |
Result := LoadFromTXMB(connection, fileid) |
315 |
|
else if FileInfo.Extension = 'TXMP' then |
316 |
< |
Result := LoadFromTXMP(fileid) |
316 |
> |
Result := LoadFromTXMP(connection, fileid) |
317 |
|
else |
318 |
|
Result := False; |
319 |
|
end; |
321 |
|
|
322 |
|
|
323 |
|
|
324 |
< |
function TOniImage.LoadFromPSpc(fileid: LongWord): Boolean; |
324 |
> |
function TOniImage.LoadFromPSpc(connection: TOniData; fileid: LongWord): Boolean; |
325 |
|
type |
326 |
|
TPoint = packed record |
327 |
|
X, Y: Word; |
356 |
|
rows: array[0..2] of Word; |
357 |
|
col, row: Byte; |
358 |
|
begin |
359 |
< |
OniDataConnection.LoadDatFilePart(fileid, $08, SizeOf(PSpc), @PSpc); |
359 |
> |
connection.LoadDatFilePart(fileid, $08, SizeOf(PSpc), @PSpc); |
360 |
|
PSpc.TXMP := PSpc.TXMP div 256; |
361 |
|
if PSpc.TXMP = 0 then |
362 |
|
begin |
364 |
|
Exit; |
365 |
|
end; |
366 |
|
txmpimg := TOniImage.Create; |
367 |
< |
txmpimg.LoadFromTXMP(PSpc.TXMP); |
367 |
> |
txmpimg.LoadFromTXMP(connection, PSpc.TXMP); |
368 |
|
txmpimg.DecodeImage; |
369 |
|
txmpimg.WriteToBMP('C:\file.bmp'); |
370 |
|
txmpdata := txmpimg.GetAs32bit; |
463 |
|
|
464 |
|
|
465 |
|
|
466 |
< |
function TOniImage.LoadFromTXMP(fileid: LongWord): Boolean; |
466 |
> |
function TOniImage.LoadFromTXMP(connection: TOniData; fileid: LongWord): Boolean; |
467 |
|
var |
468 |
|
img_addr: LongWord; |
469 |
|
begin |
470 |
|
Result := True; |
471 |
< |
OniDataConnection.LoadDatFilePart(fileid, $8C, SizeOf(Self.FWidth), @Self.FWidth); |
472 |
< |
OniDataConnection.LoadDatFilePart(fileid, $8E, SizeOf(Self.FHeight), @Self.FHeight); |
473 |
< |
OniDataConnection.LoadDatFilePart(fileid, $90, SizeOf(Self.FStoreType), |
471 |
> |
connection.LoadDatFilePart(fileid, $8C, SizeOf(Self.FWidth), @Self.FWidth); |
472 |
> |
connection.LoadDatFilePart(fileid, $8E, SizeOf(Self.FHeight), @Self.FHeight); |
473 |
> |
connection.LoadDatFilePart(fileid, $90, SizeOf(Self.FStoreType), |
474 |
|
@Self.FStoreType); |
475 |
< |
if not OniDataConnection.OSisMac then |
476 |
< |
OniDataConnection.LoadDatFilePart(fileid, $9C, SizeOf(img_addr), @img_addr) |
475 |
> |
if not connection.OSisMac then |
476 |
> |
connection.LoadDatFilePart(fileid, $9C, SizeOf(img_addr), @img_addr) |
477 |
|
else |
478 |
< |
OniDataConnection.LoadDatFilePart(fileid, $A0, SizeOf(img_addr), @img_addr); |
478 |
> |
connection.LoadDatFilePart(fileid, $A0, SizeOf(img_addr), @img_addr); |
479 |
|
|
480 |
|
case Self.FStoreType of |
481 |
|
0, 1, 2: |
498 |
|
Exit; |
499 |
|
end; |
500 |
|
|
501 |
< |
if not OniDataConnection.OSisMac then |
502 |
< |
OniDataConnection.LoadRawFile(fileid, $9C, @Self.FData[0]) |
501 |
> |
if not connection.OSisMac then |
502 |
> |
connection.LoadRawFile(fileid, $9C, @Self.FData[0]) |
503 |
|
else |
504 |
< |
OniDataConnection.LoadRawFile(fileid, $A0, @Self.FData[0]); |
504 |
> |
connection.LoadRawFile(fileid, $A0, @Self.FData[0]); |
505 |
|
|
506 |
|
Self.FDataType := [DT_OniReverted, DT_Oni]; |
507 |
|
end; |
509 |
|
|
510 |
|
|
511 |
|
|
512 |
< |
function TOniImage.LoadFromTXMB(fileid: LongWord): Boolean; |
512 |
> |
function TOniImage.LoadFromTXMB(connection: TOniData; fileid: LongWord): Boolean; |
513 |
|
var |
514 |
|
i, x, y, x2, y2, pixelid, imgid: LongWord; |
515 |
|
rows, cols: Word; |
518 |
|
images_decoded: array of TOniImage; |
519 |
|
x_start, y_start: LongWord; |
520 |
|
begin |
521 |
< |
OniDataConnection.LoadDatFilePart(fileid, $10, SizeOf(Self.FWidth), @Self.FWidth); |
522 |
< |
OniDataConnection.LoadDatFilePart(fileid, $12, SizeOf(Self.FHeight), @Self.FHeight); |
523 |
< |
OniDataConnection.LoadDatFilePart(fileid, $18, SizeOf(cols), @cols); |
524 |
< |
OniDataConnection.LoadDatFilePart(fileid, $1A, SizeOf(rows), @rows); |
525 |
< |
OniDataConnection.LoadDatFilePart(fileid, $1C, SizeOf(linkcount), @linkcount); |
521 |
> |
connection.LoadDatFilePart(fileid, $10, SizeOf(Self.FWidth), @Self.FWidth); |
522 |
> |
connection.LoadDatFilePart(fileid, $12, SizeOf(Self.FHeight), @Self.FHeight); |
523 |
> |
connection.LoadDatFilePart(fileid, $18, SizeOf(cols), @cols); |
524 |
> |
connection.LoadDatFilePart(fileid, $1A, SizeOf(rows), @rows); |
525 |
> |
connection.LoadDatFilePart(fileid, $1C, SizeOf(linkcount), @linkcount); |
526 |
|
SetLength(images_decoded, linkcount); |
527 |
|
for i := 0 to linkcount - 1 do |
528 |
|
begin |
529 |
< |
OniDataConnection.LoadDatFilePart(fileid, $20 + i * 4, SizeOf(link), @link); |
529 |
> |
connection.LoadDatFilePart(fileid, $20 + i * 4, SizeOf(link), @link); |
530 |
|
link := link div 256; |
531 |
|
images_decoded[i] := TOniImage.Create; |
532 |
< |
images_decoded[i].LoadFromTXMP(link); |
532 |
> |
images_decoded[i].LoadFromTXMP(connection, link); |
533 |
|
images_decoded[i].DecodeImage; |
534 |
|
images_decoded[i].RevertImage; |
535 |
|
end; |