func (cursor *Cursor) SaveCUR(ico io.Writer) error {
	err := binary.Write(ico, binary.LittleEndian, &cursorDirHeader{
		Type:  2,
		Count: uint16(len(cursor.images)),
	})
	if err != nil {
		return err
	}

	var (
		pos    = sizeOfCursorDirHeader
		offset = sizeOfCursorDirHeader + len(cursor.images)*sizeOfCursorFileDirEntry
	)

	cursor.order()
	for i := range cursor.images {
		err = binary.Write(ico, binary.LittleEndian, &cursorFileDirEntry{
			Width:       uint8(cursor.images[i].info.Width),
			Height:      uint8(cursor.images[i].info.Height),
			XHotSpot:    cursor.images[i].hotSpot.X,
			YHotSpot:    cursor.images[i].hotSpot.Y,
			BytesInRes:  uint32(len(cursor.images[i].image)),
			ImageOffset: uint32(offset),
		})
		if err != nil {
			return err
		}

		offset += len(cursor.images[i].image)
		pos += sizeOfCursorFileDirEntry
	}

	for i := range cursor.images {
		_, err = ico.Write(cursor.images[i].image)
		if err != nil {
			return err
		}
	}

	return nil
}
// SaveCUR saves a cursor as a CUR file.
SaveCUR saves a cursor as a CUR file.
// SaveCUR saves a cursor as a CUR file .
func (cursor *Cursor) SaveCUR(ico io.Writer) error {
	err := binary.Write(ico, binary.LittleEndian, &cursorDirHeader{
		Type:  2,
		Count: uint16(len(cursor.images)),
	})
	if err != nil {
		return err
	}
	var (
		pos    = sizeOfCursorDirHeader
		offset = sizeOfCursorDirHeader + len(cursor.images)*sizeOfCursorFileDirEntry
	)
	cursor.order()
	for i := range cursor.images {
		err = binary.Write(ico, binary.LittleEndian, &cursorFileDirEntry{
			Width:       uint8(cursor.images[i].info.Width),
			Height:      uint8(cursor.images[i].info.Height),
			XHotSpot:    cursor.images[i].hotSpot.X,
			YHotSpot:    cursor.images[i].hotSpot.Y,
			BytesInRes:  uint32(len(cursor.images[i].image)),
			ImageOffset: uint32(offset),
		})
		if err != nil {
			return err
		}
		offset += len(cursor.images[i].image)
		pos += sizeOfCursorFileDirEntry
	}
	for i := range cursor.images {
		_, err = ico.Write(cursor.images[i].image)
		if err != nil {
			return err
		}
	}
	return nil
}
func ( cursor * Cursor ) SaveCUR ( ico io . Writer ) error { err := binary . Write ( ico , binary . LittleEndian , & cursorDirHeader { Type : 2 , Count : uint16 ( len ( cursor . images ) ) , } ) if err != nil { return err } var ( pos = sizeOfCursorDirHeader offset = sizeOfCursorDirHeader + len ( cursor . images ) * sizeOfCursorFileDirEntry ) cursor . order ( ) for i := range cursor . images { err = binary . Write ( ico , binary . LittleEndian , & cursorFileDirEntry { Width : uint8 ( cursor . images [ i ] . info . Width ) , Height : uint8 ( cursor . images [ i ] . info . Height ) , XHotSpot : cursor . images [ i ] . hotSpot . X , YHotSpot : cursor . images [ i ] . hotSpot . Y , BytesInRes : uint32 ( len ( cursor . images [ i ] . image ) ) , ImageOffset : uint32 ( offset ) , } ) if err != nil { return err } offset += len ( cursor . images [ i ] . image ) pos += sizeOfCursorFileDirEntry } for i := range cursor . images { _ , err = ico . Write ( cursor . images [ i ] . image ) if err != nil { return err } } return nil }
SaveCUR saves a cursor as a CUR file.
SaveCUR saves a cursor as a CUR file .