% Autor: Betti Oesterholz
% erstellt: 25.05.2011
% Dies ist der Handzettel mit einem Beispiel Objekts zu Fib.
%
% Copyright (c) 2011 Betti Oesterholz
%
% Permission is granted to copy, distribute and/or modify this document
% under the terms of the GNU Free Documentation License, Version 1.2 or
% any later version published by the Free Software Foundation;
% with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
%
% A copy of the license is included in the file ``fdl.tex'' .
%



\documentclass[12pt,a4paper]{article}
\pagestyle{empty} %keine Seitennummerierung
\usepackage{a4wide} % besser den Platz nutzen (kleinere R"ander)
%\usepackage{ngerman} % Silbentrennung nach neuer Rechtschreibung
\usepackage[T1]{fontenc} % Type 1 Schriften
\usepackage{times} % Da die Standard-LaTeX-Schrift bei mir mit Acrobat nicht funkt.
\usepackage[ansinew]{inputenc} % Verwendung von Umlauten
\usepackage{scrpage2} % Seitenformat
%\usepackage{titletoc}
%\usepackage{titlesec}
\usepackage{listings} % Programm-Listing
%\usepackage [usetoc]{titleref} 
\usepackage{graphicx} % Einbindung von Graphiken
\usepackage{url} % URLs durch \url{}
%\usepackage{bibgerm} % deutsche Bibliographie
%\usepackage{txfonts}%Paket fr das nat Symbol
\usepackage{multicol}
%\usepackage{makeidx}%for the index
%\usepackage{longtable}
%\usepackage{amsmath}%mathematikumgebung {equation*} usw.
\usepackage{picinpar}%Textumflossene Bilder

% Seitenstil festlegen
%\pagestyle{useheadings}%or: headings

% naehste vier Zeilen: Format des Inhaltsverzeichnisses
%\titlespacing{\section}{0pt}{5cm}{5cm}%spacing by sections {in front}{above}{below}
%\dottedcontents{section}[1.5em]{\addvspace{1.0em}}{1.3em}{0.7pc}
%\dottedcontents{subsection}[3.8em]{}{2.2em}{0.7pc}
%\dottedcontents{subsubsection}[7.0em]{}{3.1em}{0.7pc}

%\setcounter{secnumdepth}{4}%%nummerierung der Unterabschnitte bis Tiefe

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Beginn des Dokuments
%\makeindex

\begin{document}

\renewcommand{\sectionmark}[1]{\markboth{#1}{}}
\pagenumbering{arabic}
\automark{section}
\pagestyle{scrheadings} % individ. Seitenlayout
%\setheadsepline{0.4pt}
\ihead{} % Titelzeile innen
\ohead{} % Titelzeile aussen
%\chead{\slshape \headmark}  % Titelzeile mitte
\cfoot{Fib example page \thepage} % Fusszeile mitte

% Vorschlag fr Titelzeile:
% Bei umfangreicheren Dokumenten
%\ihead{\slshape \headmark } % Darstellung von Sectionnummer und -name
%\ohead{}
%\chead{}



\ \vspace{-2.5cm}
\begin{center}
   \LARGE\bf Fib example\\
\end{center}

\noindent
Fib multimedia objects can be directly stored in a readable form in the XML-format.

For a better understanding of the Fib multimedia format and to illustrate its possibilities, a relatively simple example for Fib is given below.

%\bigskip\noindent
\begin{window}[0,l,\includegraphics[scale=0.75]{./pictures/wappen.eps},{}]
The picture, for the example, is shown on the left. It is a crest-shaped object with a color gradient. The image size is 255 times 255 pixels in RGB color.

The XML description in Fib of the image is given below. For better readability it is presented somewhat excessively.

The Fib object in the compressed Fib storage format is structurally the same, but it is stored more efficiently.
In the compressed Fib storage format the image requires only 153 bytes, of which 134 bytes are used for setting up the environment (the root-element, without the ``main\_fib\_object''-element), that means, only 19 bytes are needed for the actual presentation of the crest.

\end{window}
To put this memory space in relation to other formats, the image has been saved in various formats:% and the size of the resulting files are given in the following.
\begin{itemize}
 \item Fib format: 153 bytes, of which 134 bytes are for environment and 19 bytes are for the crest
 \item Fib XML-format: around 1,900 bytes (with indentation and line breaks; see below)
 \item PNG-format: 2,500 bytes
 \item JPG-format: 4,720 bytes (using GIMP: Quality 85, optimized smoothing 0)
 \item BMP-format: 196,000 bytes
\end{itemize}



\begin{center}
   \Large\bf XML representation of the image\\
\end{center}
\begin{small}
\begin{verbatim}
<?xml version="1.0" encoding="UTF-8"?>
<fib_object xmlns:xsd="http://www.w3.org/2001/XMLSchema-instance"
   xmlns="http://www.fib-development.de/"
   xsd:schemaLocation="http://www.fib-development.de/fib.xsd">
<root>
   <domains>
      <dim count="2">
         <dimension number="1" direction="horizontal"/>
         <dimension number="2" direction="vertical"/>
         <vector elements="2">
            <naturalNumber max="255" />
            <naturalNumber max="255" />
         </vector>
      </dim>
      <property name="colorRGB" >
         <vector elements="3">
            <naturalNumber max="255" />
            <naturalNumber max="255" />
            <naturalNumber max="255" />
         </vector>
      </property>
      <area>
         <vector elements="2">
            <naturalNumber max="4" />
            <vector elements="2">
               <naturalNumber max="255" />
               <naturalNumber max="255" />
            </vector>
         </vector>
      </area>
      <subfunction>
         <naturalNumber max="255" />
      </subfunction>
   </domains>
   <main_fib_object>
      <area define_variable="1">
         <vector type="subarea">
            <value>25</value>
            <value>225</value>
         </vector>
         <function define_variable="2">
            <subfunction>
               <add>
                  <value>25</value>
                  <exp>
                     <div>
                        <sub>
                           <variable>1</variable>
                           <value>125</value>
                        </sub>
                        <value>8</value>
                     </div>
                     <value>2</value>
                  </exp>
               </add>
            </subfunction>
            <area define_variable="3">
               <vector type="subarea">
                  <value>225</value>
                  <variable>2</variable>
               </vector>
               <property>
                  <vector type="property.colorRGB">
                     <variable>3</variable>
                     <variable>2</variable>
                     <variable>1</variable>
                  </vector>
                  <point>
                     <vector type="position">
                        <variable>1</variable>
                        <variable>3</variable>
                     </vector>
                  </point>
               </property>
            </area>
         </function>
      </area>
   </main_fib_object>
</root>
</fib_object>
\end{verbatim}
\end{small}


\bigskip\noindent
\textbf{Explanations for the XML representation:}

The root-element defines the environment of the image. It contains two main parts: the specification of the different domains (\verb|<domains>|) and the actual representing Fib object (\verb|<main_fib_object>|).

The domains set the size of the image and numbers, which can be used in the elements.

The Fib object represents a crest-shaped object.
The first area element (\verb|area|) ensures that the first variable (\verb|define_variable="1"|) runs from 25 till 225 (this means it takes the values 25, 26, 27, ..., 225). This variable 1 limits the crest in the horizontal direction (you can see this at the point element \verb|point|).
In the vertical direction the crest is limited by the variable 3. It runs for each assignment to variable 1 from 225 (upper border of the crest) to a (smaller) value, which is evalued by a function (\verb|function|) of variable 1 $f(V_1)$. This function is $f(V_1) = 25 + ((V_1 - 125) / 8)^{2} $. Thus the lower border of the crest is defined by a quadratic function.

The color gradient in the crest is simply generated by the fact, that the available variables are used as color components. Likewise for the color components other functions or fixed numbers could be used.

\bigskip
This XML representation can be converted directly into the image shown above (with the crest) by the Fib converter (convertFromFib).

This makes it possible to directly create Fib representations with an text editor. Necessary for this are only a little practice with writing in the XML-format and knowledge of the Fib XML-elements.
\end{document}




