<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <!--Converted with LaTeX2HTML 2002-2-1 (1.71) original version by: Nikos Drakos, CBLU, University of Leeds * revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan * with significant contributions from: Jens Lippmann, Marek Rouchal, Martin Wilck and others --> <HTML> <HEAD> <TITLE>B.3 Sun raster files</TITLE> <META NAME="description" CONTENT="B.3 Sun raster files"> <META NAME="keywords" CONTENT="GMT_Docs"> <META NAME="resource-type" CONTENT="document"> <META NAME="distribution" CONTENT="global"> <META NAME="Generator" CONTENT="LaTeX2HTML v2002-2-1"> <META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css"> <LINK REL="STYLESHEET" HREF="GMT_Docs.css"> <LINK REL="previous" HREF="node180.html"> <LINK REL="up" HREF="node173.html"> <LINK REL="next" HREF="node188.html"> </HEAD> <BODY bgcolor="#ffffff"> <!--Navigation Panel--> <A NAME="tex2html5305" HREF="node188.html"> <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> <A NAME="tex2html5299" HREF="node173.html"> <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> <A NAME="tex2html5295" HREF="node186.html"> <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> <A NAME="tex2html5301" HREF="node1.html"> <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> <A NAME="tex2html5303" HREF="node256.html"> <IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> <BR> <B> Next:</B> <A NAME="tex2html5306" HREF="node188.html">C. Including GMT graphics</A> <B> Up:</B> <A NAME="tex2html5300" HREF="node173.html">B. GMT file formats</A> <B> Previous:</B> <A NAME="tex2html5296" HREF="node186.html">B.2.4 Native binary grid</A> <B> <A NAME="tex2html5302" HREF="node1.html">Contents</A></B> <B> <A NAME="tex2html5304" HREF="node256.html">Index</A></B> <BR> <BR> <!--End of Navigation Panel--> <H1><A NAME="SECTION001930000000000000000"></A> <A NAME="29477"></A> <BR> B.3 Sun raster files </H1> <P> The Sun raster file format consists of a header followed by a series of unsigned 1-byte integers that represents the bit-pattern. Bits are scanline oriented, and each row must contain an even number of bytes. The predefined 1-bit patterns in <A NAME="tex2html1685" HREF="http://gmt.soest.hawaii.edu"><B>GMT</B></A> have dimensions of 64 by 64, but other sizes will be accepted when using the <B>-Gp<IMG WIDTH="8" HEIGHT="31" ALIGN="MIDDLE" BORDER="0" SRC="img11.png" ALT="$\vert$">P</B> option. The Sun header structure is outline in Table <A HREF="#tbl:sunheader">B.3</A>. <P> <BR><P></P> <DIV ALIGN="CENTER"><A NAME="29506"></A> <TABLE> <CAPTION><STRONG>Table B.3:</STRONG> Structure of a Sun raster file.</CAPTION> <TR><TD> <DIV ALIGN="CENTER"></DIV> <P> <DIV ALIGN="CENTER"><TABLE CELLPADDING=3 BORDER="1"> <TR><TD ALIGN="CENTER" COLSPAN=1><I>Parameter</I></TD> <TD ALIGN="CENTER" COLSPAN=1><I>Description</I></TD> </TR> <TR><TH ALIGN="LEFT"><B>int</B> <I>ras_magic</I></TH> <TD ALIGN="LEFT">Magic number</TD> </TR> <TR><TH ALIGN="LEFT"><B>int</B> <I>ras_width</I></TH> <TD ALIGN="LEFT">Width (pixels) of image</TD> </TR> <TR><TH ALIGN="LEFT"><B>int</B> <I>ras_height</I></TH> <TD ALIGN="LEFT">Height (pixels) of image</TD> </TR> <TR><TH ALIGN="LEFT"><B>int</B> <I>ras_depth</I></TH> <TD ALIGN="LEFT">Depth (1, 8, 24, 32 bits) of pixel</TD> </TR> <TR><TH ALIGN="LEFT"><B>int</B> <I>ras_length</I></TH> <TD ALIGN="LEFT">Length (bytes) of image</TD> </TR> <TR><TH ALIGN="LEFT"><B>int</B> <I>ras_type</I></TH> <TD ALIGN="LEFT">Type of file; see RT_* below</TD> </TR> <TR><TH ALIGN="LEFT"><B>int</B> <I>ras_maptype</I></TH> <TD ALIGN="LEFT">Type of colormap; see RMT_* below</TD> </TR> <TR><TH ALIGN="LEFT"><B>int</B> <I>ras_maplength</I></TH> <TD ALIGN="LEFT">Length (bytes) of following map</TD> </TR> </TABLE> </DIV> <P> <DIV ALIGN="CENTER"> <A NAME="tbl:sunheader"></A></DIV></TD></TR> </TABLE> </DIV><P></P> <BR> <P> After the header, the color map (if <I>ras_maptype</I> is not RMT_NONE) follows for <I>ras_maplength</I> bytes, followed by an image of <I>ras_length</I> bytes. Some related definitions are given in Table <A HREF="#tbl:sundef">B.4</A>. <P> <BR><P></P> <DIV ALIGN="CENTER"><A NAME="29524"></A> <TABLE> <CAPTION><STRONG>Table B.4:</STRONG> Sun macro definitions relevant to raster files.</CAPTION> <TR><TD><A NAME="29514"></A> <DIV ALIGN="CENTER"><TABLE CELLPADDING=3 BORDER="1"> <TR><TD ALIGN="CENTER" COLSPAN=1><I>Macro name</I></TD> <TD ALIGN="CENTER" COLSPAN=1><I>Description</I></TD> </TR> <TR><TD ALIGN="LEFT">RAS_MAGIC</TD> <TD ALIGN="LEFT">0x59a66a95</TD> </TR> <TR><TD ALIGN="LEFT">RT_STANDARD</TD> <TD ALIGN="LEFT">1 (Raw pixrect image in 68000 byte order)</TD> </TR> <TR><TD ALIGN="LEFT">RT_BYTE_ENCODED</TD> <TD ALIGN="LEFT">2 (Run-length compression of bytes)</TD> </TR> <TR><TD ALIGN="LEFT">RT_FORMAT_RGB</TD> <TD ALIGN="LEFT">3 ([X]RGB instead of [X]BGR)</TD> </TR> <TR><TD ALIGN="LEFT">RMT_NONE</TD> <TD ALIGN="LEFT">0 (ras_maplength is expected to be 0)</TD> </TR> <TR><TD ALIGN="LEFT">RMT_EQUAL_RGB</TD> <TD ALIGN="LEFT">1 (red[ras_maplength/3],green[],blue[])</TD> </TR> </TABLE> </DIV> <P> <DIV ALIGN="CENTER"> <A NAME="tbl:sundef"></A></DIV></TD></TR> </TABLE> </DIV><P></P> <BR> <P> Numerous public-domain programs exist, such as <I>xv</I><A NAME="29737"></A> and <I>convert</I><A NAME="29740"></A> (in the ImageMagick package), that will translate between various raster file formats such as tiff, gif, jpeg, and Sun raster. Raster patterns may be created with <A NAME="tex2html1686" HREF="http://gmt.soest.hawaii.edu"><B>GMT</B></A> plotting tools by generating <I>PostScript</I> plots that can be rasterized by <I>ghostscript</I><A NAME="29747"></A> and translated into the right raster format. <P> <HR> <!--Navigation Panel--> <A NAME="tex2html5305" HREF="node188.html"> <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> <A NAME="tex2html5299" HREF="node173.html"> <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> <A NAME="tex2html5295" HREF="node186.html"> <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> <A NAME="tex2html5301" HREF="node1.html"> <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> <A NAME="tex2html5303" HREF="node256.html"> <IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> <BR> <B> Next:</B> <A NAME="tex2html5306" HREF="node188.html">C. Including GMT graphics</A> <B> Up:</B> <A NAME="tex2html5300" HREF="node173.html">B. GMT file formats</A> <B> Previous:</B> <A NAME="tex2html5296" HREF="node186.html">B.2.4 Native binary grid</A> <B> <A NAME="tex2html5302" HREF="node1.html">Contents</A></B> <B> <A NAME="tex2html5304" HREF="node256.html">Index</A></B> <!--End of Navigation Panel--> <ADDRESS> Paul Wessel 2010-07-14 </ADDRESS> </BODY> </HTML>