Hello
I search documentation about AmigaOs Icon :".info" file.
I would like to read ".info" file and extract comment/Default tools, tools types and why not Image (the icon)
Where can i found this documentation ?
Best regards
Thyphoon
".info" Amiga icon file description
This could be helpful:
http://en.wikipedia.org/wiki/Amiga_Hunk
And:
Cheers,
Thalius
http://en.wikipedia.org/wiki/Amiga_Hunk
And:
EDIT: lol! Case beat me to it ! =PThe format of the Amiga .info file is as follows:
DiskObject header 78 bytes
Optional DrawerData header 56 bytes
First icon header 20 bytes
First icon data Varies
Second icon header 20 bytes
Second icon data Varies
The DiskObject header contains, among other things, the magic number (0xE310), the object width and height (inside the embedded Gadget header), and the version.
Each icon header contains the icon width and height, which can be smaller than the object width and height, and the number of bit-planes.
The icon data has the following format:
BIT-PLANE planes, each with HEIGHT rows of (WIDTH
+15) / 16 * 2 bytes length.
So if you have a 9x3x2 icon, the icon data will look like this:
aaaa aaaa a000 0000
aaaa aaaa a000 0000
aaaa aaaa a000 0000
bbbb bbbb b000 0000
bbbb bbbb b000 0000
bbbb bbbb b000 0000
where a is a bit for the first bit-plane, b is a bit for the second bit-plane, and 0 is padding.
(Ben Hutchings)
Cheers,
Thalius
Last edited by Thalius on Wed Aug 13, 2008 8:42 pm, edited 3 times in total.
"In 3D there is never enough Time to do Things right,
but there's always enough Time to make them *look* right."
"psssst! i steal signatures... don't tell anyone! "
but there's always enough Time to make them *look* right."
"psssst! i steal signatures... don't tell anyone! "
Hello
Few day i try to understand how i must to proceded but i have no result.
The most important stuff for me is to read default tools and tools type (the icon is a bonus)
I would Like to do a Windows application who can read this information.
how to calculate where are default tools and tools type information in the file?
Best regards
thyphoon
Few day i try to understand how i must to proceded but i have no result.
The most important stuff for me is to read default tools and tools type (the icon is a bonus)
I would Like to do a Windows application who can read this information.
how to calculate where are default tools and tools type information in the file?
Best regards
thyphoon
I have found a source-code that might be helpful:
Interested?IconExample.C wrote:** The following example demonstrates icon creation, icon reading and
** Tool Type parsing in the Workbench environment. When called from the
** Shell, the example creates a small data file in RAM: and creates or
** updates a project icon for the data file. The created project icon
** points to this example as its default tool. When the new project
** icon is double-clicked, Workbench will invoke the default tool (this
** example) as a Workbench process, and pass it a description of the
** project data file as a Workbench argument (WBArg) in the WBStartup
** message.
**
** iconexample.c - Workbench icon startup, creation, and parsing example
Sorry 4 my poor English, it's the only one I learned 40 years ago...
since 17.12.08: XPHome(SP3) + PB 4.30
since 17.12.08: XPHome(SP3) + PB 4.30
here's a mess of a code that read an amiga .info icon
and draw the icon
incomplete but still a start
use it with the debugger as there's nothing to quit
sorry for my bad english
and draw the icon
incomplete but still a start
use it with the debugger as there's nothing to quit
Code: Select all
; amiga .info reader
; par case 2008
;-------------------
InitSprite()
main=OpenWindow(#PB_Any,0,0,400,400,"")
OpenWindowedScreen(WindowID(main),0,0,400,400,0,0,0)
; ---- big endian related fonctions ----
Structure diskobject_struct
do_magic.w
do_version.w
do_gadget_next_gadget.l
do_Gadget_LeftEdge.w
do_Gadget_topEdge.w
do_Gadget_width.w
do_Gadget_height.w
do_Gadget_flags.w
do_Gadget_activation.w
do_Gadget_gadgettype.w
do_Gadget_gadgetrender.l
do_Gadget_selectrender.l
do_Gadget_gadgettext.l
do_Gadget_MutualExclude.l
do_Gadget_specialinfo.l
do_Gadget_gadgetid.w
do_Gadget_userdata.l
do_type.b
padding.b
do_DefaultTool.l
do_ToolTypes.l
do_CurrentX.l
do_CurrentY.l
do_DrawerData.l
do_Toolwindow.l
do_StackSize.l
EndStructure
Structure drawerdata_struct
dd_NewWindow_LeftEdge.w
dd_NewWindow_TopEdge.w
dd_NewWindow_Width.w
dd_NewWindow_Height.w
dd_NewWindow_DetailPen.b
dd_NewWindow_BlockPen.b
dd_NewWindow_IDCMPFlags.l
dd_NewWindow_Flags.l
dd_NewWindow_FirstGadget.l
dd_NewWindow_CheckMark.l
dd_NewWindow_Title.l
dd_NewWindow_Screen.l
dd_NewWindow_BitMap.l
dd_NewWindow_MinWidth.w
dd_NewWindow_MinHeight.w
dd_NewWindow_MaxWidth.w
dd_NewWindow_MaxHeight.w
dd_NewWindow_Type.w
dd_CurrentX.l
dd_CurrentY.l
;------- used for amiga os 2.x+ only
dd_Flags.l
dd_ViewModes.w
EndStructure
Structure image_struct
leftedge.w
topedge.w
width.w
height.w
depth.w
imagedata.l
planepick.b
planeonoff.b
nextimage.l
EndStructure
Declare peekbyte(adress)
Declare peekword(adress)
Declare PeekLong(adress)
Declare endianconvert(str$,*buffer1,*buffer2,offset)
; ---- function that decode an icon
Declare decodeicon(filename$)
; ---- structures ----
Declare showicon(xx,yy,buffer,offset,nfo,revision)
;********************************************
; changer la ligne suivante avec le chemin vers une icone amiga valide :)
;********************************************
adress=decodeicon("Whats_new.txt.info")
;
;********************************************
;********************************************
Global diskobject.diskobject_struct
Global drawerdata.drawerdata_struct
Global image.image_struct
Global image2.image_struct
Global offset
Global offsetpicture1.l,offsetpicture2.l
;
;-----------------------------------------PICTURE DATA---------------------
row_bytes=((image\Width + 15) >> 4) << 1 ; size in bytes of a row of pixel
planesize=row_bytes*image\height ; size in bytes of a plane
Global Dim col(11)
; wb 1
col(00)=RGB(85,170,255)
col(01)=RGB(255,255,255)
col(02)=RGB(0,0,0)
col(03)=RGB(255,136,0)
; wb 2
col(04)=RGB(149,149,149)
col(05)=RGB(0,0,0)
col(06)=RGB(255,255,255)
col(07)=RGB(59,103,162)
;
; + magic wb
col(08)=RGB(123,123,123)
col(09)=RGB(175,175,175)
col(10)=RGB(170,144,124)
col(11)=RGB(255,169,151)
;
showicon(0,0,adress,offsetpicture1,@image,diskobject\do_Gadget_userdata)
showicon(50,0,adress,offsetpicture2,@image2,diskobject\do_Gadget_userdata)
Repeat
FlipBuffers()
WaitWindowEvent(100)
ForEver
End
Procedure showicon(xx,yy,buffer,offset,*var,revision)
nfo.image_struct
CopyMemory(*var,@nfo,SizeOf(nfo))
If revision=1 ; use the wb2 palette
cbase=4
EndIf
;
row_bytes=((nfo\Width + 15) >> 4) << 1
planesize=row_bytes*nfo\height
For y=0 To nfo\height-1 ; for each line
For x=0 To row_bytes-1 ; read each bytes
For pix=1 To 8 ; decode each pixel
color=cbase
For plane=1 To nfo\depth ; read each plane
planesh=(plane-1)*planesize
;
adr=buffer+offset+(x+(y*row_bytes))+planesh
oct=PeekB(adr) & $ff
thisbit=(( (oct >> (pix-1)) & 1) << (plane-1))
color=color+thisbit
Next
StartDrawing(ScreenOutput())
If x*8+8-pix < nfo\width
Plot(xx+x*8+8-pix,yy+y,col(color))
EndIf
StopDrawing()
Next
Next
Next
EndProcedure
Procedure decodeicon(filename$)
fsize=FileSize(filename$) ; get the size of the icon
*buffer1=AllocateMemory(fsize) ; allocate memmory for the original icon in amiga big endian format
rd=ReadFile(#PB_Any,filename$) ; open the file
ReadData(rd,*buffer1,fsize) ; read the dtat of the icon to the memory
CloseFile(rd) ; close the file
*buffer2=AllocateMemory(fsize) ; allocate memory for the icon in little endian format
diskobj$ ="22422222224444424114444444" ; 1=byte,2=word,4=long
drawerdata1$ ="22221144444442222244" ; tables For each structures
drawerdata2$ ="2222114444444222224442" ;
imagestructure$="222224114" ;
;
offset=0
newoffset=endianconvert(diskobj$,*buffer1,*buffer2,offset)
CopyMemory(*buffer2+offset,@diskobject,78) : offset=newoffset
;
If diskobject\do_DrawerData<>0 ; there's a drawer data structure
; check version wb 1.x or 2.x
If diskobject\do_Gadget_userdata=0
newoffset=endianconvert(drawerdata1$,*buffer1,*buffer2,offset)
Else ; os 2.0 +
newoffset=endianconvert(drawerdata2$,*buffer1,*buffer2,offset)
EndIf
EndIf
CopyMemory(*buffer2+offset,@drawerdata,newoffset-offset):offset=newoffset
; image 1 structure
newoffset=endianconvert(imagestructure$,*buffer1,*buffer2,offset)
CopyMemory(*buffer2+offset,@image,20):offset=newoffset
offsetpicture1=offset ; definit l'adresse de l'image 1
row_bytes=((image\Width + 15) >> 4) << 1 ; size in bytes of a row of pixel
planesize=row_bytes*image\height ; size in bytes of a plane
picturesize=planesize*image\depth
CopyMemory(*buffer1+offset,*buffer2+offset,picturesize)
offset=offset+picturesize
If diskobject\do_Gadget_selectrender<>0 ; second picture
newoffset=endianconvert(imagestructure$,*buffer1,*buffer2,offset)
CopyMemory(*buffer2+offset,@image2,20):offset=newoffset
offsetpicture2=offset
row_bytes=((image2\Width + 15) >> 4) << 1 ; size in bytes of a row of pixel
planesize=row_bytes*image2\height ; size in bytes of a plane
picturesize=planesize*image2\depth
CopyMemory(*buffer1+offset,*buffer2+offset,picturesize)
offset=offset+picturesize
EndIf
CopyMemory(*buffer1,*buffer2,fsize-offset)
Debug Hex(PeekB(*buffer2+offset))
;
Repeat
a$=""
offset=offset+1
str=PeekB(*buffer2+offset)
If str<>$74 And str<>0
For a=1 To str-1
offset=offset+1
a$=a$+Chr(PeekB(*buffer2+offset))
Next a
Debug a$
EndIf
Until offset=fsize
FreeMemory(*buffer1)
ProcedureReturn *buffer2
EndProcedure
Procedure peekbyte(adress)
ProcedureReturn PeekB(adress) &255
EndProcedure
Procedure peekword(adress)
ProcedureReturn (PeekByte(adress) <<8 + PeekByte(adress+1))
EndProcedure
Procedure peeklong(adress)
ProcedureReturn PeekByte(adress)<<24 + peekbyte(adress+1)<<16+ peekbyte(adress+2)<<8+ peekbyte(adress+3)
EndProcedure
Procedure endianconvert(str$,*buffer1,*buffer2,offset)
For a=1 To Len(str$)
Select Mid(str$,a,1)
Case "2" ; WORD
PokeW(*buffer2+offset,peekWord(*buffer1+offset))
offset=offset+2
Case "4" ; LONG
PokeL(*buffer2+offset,PeekLong(*buffer1+offset))
offset=offset+4
Case "1" ; BYTE
PokeB(*buffer2+offset,PeekByte(*buffer1+offset))
offset=offset+1
EndSelect
Next
ProcedureReturn(offset)
EndProcedure
-
- New User
- Posts: 6
- Joined: Sat Dec 06, 2008 10:12 pm
Re: ".info" Amiga icon file description
here is another link for icon informationthyphoon wrote:Hello
I search documentation about AmigaOs Icon :".info" file.
I would like to read ".info" file and extract comment/Default tools, tools types and why not Image (the icon)
Where can i found this documentation ?
Best regards
Thyphoon
http://teleinfo.pb.edu.pl/~krashan/articles/amigaicons/