diff options
author | neodarz <neodarz@neodarz.net> | 2018-08-11 20:21:34 +0200 |
---|---|---|
committer | neodarz <neodarz@neodarz.net> | 2018-08-11 20:21:34 +0200 |
commit | 0ea5fc66924303d1bf73ba283a383e2aadee02f2 (patch) | |
tree | 2568e71a7ccc44ec23b8bb3f0ff97fb6bf2ed709 /docs/doxygen/nel/a02268.html | |
download | nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.tar.xz nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.zip |
Initial commit
Diffstat (limited to '')
-rw-r--r-- | docs/doxygen/nel/a02268.html | 6174 |
1 files changed, 6174 insertions, 0 deletions
diff --git a/docs/doxygen/nel/a02268.html b/docs/doxygen/nel/a02268.html new file mode 100644 index 00000000..ab6a1a25 --- /dev/null +++ b/docs/doxygen/nel/a02268.html @@ -0,0 +1,6174 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> +<title>NeL: NLMISC::CBitmap class Reference</title> +<link href="doxygen.css" rel="stylesheet" type="text/css"> +</head><body> +<!-- Generated by Doxygen 1.3.6 --> +<div class="qindex"> <form class="search" action="search.php" method="get"> +<a class="qindex" href="main.html">Main Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a> | <span class="search"><u>S</u>earch for <input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div> +<h1>NLMISC::CBitmap Class Reference</h1><code>#include <<a class="el" href="a05487.html">bitmap.h</a>></code> +<p> +<p>Inheritance diagram for NLMISC::CBitmap: +<p><center><img src="a02268.png" usemap="#NLMISC::CBitmap_map" border="0" alt=""></center> +<map name="NLMISC::CBitmap_map"> +<area href="a03487.html" alt="NL3D::ITexture" shape="rect" coords="0,56,150,80"> +<area href="a03486.html" alt="NL3D::CTextureBlank" shape="rect" coords="160,112,310,136"> +<area href="a03488.html" alt="NL3D::CTextureBlend" shape="rect" coords="160,168,310,192"> +<area href="a03489.html" alt="NL3D::CTextureBump" shape="rect" coords="160,224,310,248"> +<area href="a03491.html" alt="NL3D::CTextureCross" shape="rect" coords="160,280,310,304"> +<area href="a03492.html" alt="NL3D::CTextureCube" shape="rect" coords="160,336,310,360"> +<area href="a03493.html" alt="NL3D::CTextureDLM" shape="rect" coords="160,392,310,416"> +<area href="a03497.html" alt="NL3D::CTextureEmboss" shape="rect" coords="160,448,310,472"> +<area href="a03498.html" alt="NL3D::CTextureFar" shape="rect" coords="160,504,310,528"> +<area href="a03502.html" alt="NL3D::CTextureFile" shape="rect" coords="160,560,310,584"> +<area href="a03506.html" alt="NL3D::CTextureFont" shape="rect" coords="160,616,310,640"> +<area href="a03509.html" alt="NL3D::CTextureGrouped" shape="rect" coords="160,672,310,696"> +<area href="a03511.html" alt="NL3D::CTextureMem" shape="rect" coords="160,728,310,752"> +<area href="a03512.html" alt="NL3D::CTextureMultiFile" shape="rect" coords="160,784,310,808"> +<area href="a03513.html" alt="NL3D::CTextureNear" shape="rect" coords="160,840,310,864"> +</map> +<hr><a name="_details"></a><h2>Detailed Description</h2> +Class Bitmap<p> +<dl compact><dt><b>Author:</b></dt><dd>Stephane Coutelas <p> +Nevrax France </dd></dl> +<dl compact><dt><b>Date:</b></dt><dd>2000 </dd></dl> + +<p> + +<p> +Definition at line <a class="el" href="a05487.html#l00087">87</a> of file <a class="el" href="a05487.html">bitmap.h</a>.<table border=0 cellpadding=0 cellspacing=0> +<tr><td></td></tr> +<tr><td colspan=2><br><h2>[NOHEADER]</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03337.html">CRGBA</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NLMISC_1_1CBitmapz1926_0">getDXTC1Texel</a> (<a class="el" href="a04558.html#a14">sint</a> <a class="el" href="a04223.html#a572">x</a>, <a class="el" href="a04558.html#a14">sint</a> <a class="el" href="a04223.html#a573">y</a>, <a class="el" href="a04558.html#a11">uint32</a> numMipMap) const </td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03337.html">CRGBA</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NLMISC_1_1CBitmapz1926_1">getDXTC3Texel</a> (<a class="el" href="a04558.html#a14">sint</a> <a class="el" href="a04223.html#a572">x</a>, <a class="el" href="a04558.html#a14">sint</a> <a class="el" href="a04223.html#a573">y</a>, <a class="el" href="a04558.html#a11">uint32</a> numMipMap) const </td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03337.html">CRGBA</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NLMISC_1_1CBitmapz1926_2">getDXTC5Texel</a> (<a class="el" href="a04558.html#a14">sint</a> <a class="el" href="a04223.html#a572">x</a>, <a class="el" href="a04558.html#a14">sint</a> <a class="el" href="a04223.html#a573">y</a>, <a class="el" href="a04558.html#a11">uint32</a> numMipMap) const </td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03337.html">CRGBA</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NLMISC_1_1CBitmapz1926_3">getDXTCColorFromBlock</a> (const <a class="el" href="a04558.html#a7">uint8</a> *block, <a class="el" href="a04558.html#a14">sint</a> <a class="el" href="a04223.html#a572">x</a>, <a class="el" href="a04558.html#a14">sint</a> <a class="el" href="a04223.html#a573">y</a>)</td></tr> + +<tr><td colspan=2><br><h2>Public Types</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>enum </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NL3D_1_1ITexturew31">TType</a> { <br> + <a class="el" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew25">RGBA</a> = 0, +<a class="el" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw8">Luminance</a>, +<a class="el" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw0">Alpha</a>, +<a class="el" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw1">AlphaLuminance</a>, +<br> + <a class="el" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw4">DXTC1</a>, +<a class="el" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw5">DXTC1Alpha</a>, +<a class="el" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw6">DXTC3</a>, +<a class="el" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw7">DXTC5</a>, +<br> + <a class="el" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw3">DsDt</a>, +<a class="el" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew17">ModeCount</a>, +<a class="el" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew4">DonTKnow</a> = 0xffffffff +<br> + }</td></tr> + +<tr><td colspan=2><br><h2>Public Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NL3D_1_1ITexturea1">blend</a> (<a class="el" href="a02268.html">CBitmap</a> &Bm0, <a class="el" href="a02268.html">CBitmap</a> &Bm1, <a class="el" href="a04558.html#a9">uint16</a> factor, bool inputBitmapIsMutable=false)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NL3D_1_1ITexturea2">blit</a> (const <a class="el" href="a02268.html">CBitmap</a> *<a class="el" href="a04223.html#a652">src</a>, <a class="el" href="a04558.html#a10">sint32</a> <a class="el" href="a04223.html#a572">x</a>, <a class="el" href="a04558.html#a10">sint32</a> <a class="el" href="a04223.html#a573">y</a>)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NL3D_1_1ITexturea3">buildMipMaps</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top> </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NLMISC_1_1CBitmapa3">CBitmap</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NL3D_1_1ITexturea6">convertToType</a> (<a class="el" href="a02268.html#NL3D_1_1ITexturew31">TType</a> <a class="el" href="a04223.html#a581">type</a>)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NL3D_1_1ITexturea7">flipH</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NL3D_1_1ITexturea8">flipV</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03338.html">CRGBAF</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NL3D_1_1ITexturea11">getColor</a> (float <a class="el" href="a04223.html#a572">x</a>, float <a class="el" href="a04223.html#a573">y</a>) const </td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>virtual <a class="el" href="a04558.html#a11">uint32</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NL3D_1_1ITexturea12">getHeight</a> (<a class="el" href="a04558.html#a11">uint32</a> numMipMap=0) const </td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a11">uint32</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NL3D_1_1ITexturea13">getMipMapCount</a> () const </td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03337.html">CRGBA</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NL3D_1_1ITexturea14">getPixelColor</a> (<a class="el" href="a04558.html#a14">sint</a> <a class="el" href="a04223.html#a572">x</a>, <a class="el" href="a04558.html#a14">sint</a> <a class="el" href="a04223.html#a573">y</a>, <a class="el" href="a04558.html#a11">uint32</a> numMipMap=0) const </td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02268.html#NL3D_1_1ITexturew31">TType</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NL3D_1_1ITexturea15">getPixelFormat</a> () const </td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a11">uint32</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NL3D_1_1ITexturea19">getSize</a> (<a class="el" href="a04558.html#a11">uint32</a> numMipMap=0) const </td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>virtual <a class="el" href="a04558.html#a11">uint32</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NL3D_1_1ITexturea20">getWidth</a> (<a class="el" href="a04558.html#a11">uint32</a> numMipMap=0) const </td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NL3D_1_1ITexturea23">isGrayscaleAsAlpha</a> () const </td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a7">uint8</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NL3D_1_1ITexturea25">load</a> (<a class="el" href="a02270.html">NLMISC::IStream</a> &f, <a class="el" href="a04558.html#a15">uint</a> mipMapSkip=0)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NL3D_1_1ITexturea26">loadGrayscaleAsAlpha</a> (bool loadAsAlpha)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NL3D_1_1ITexturea27">makeDummy</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NL3D_1_1ITexturea30">releaseMipMaps</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NL3D_1_1ITexturea31">resample</a> (<a class="el" href="a04558.html#a10">sint32</a> nNewWidth, <a class="el" href="a04558.html#a10">sint32</a> nNewHeight)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NL3D_1_1ITexturea32">reset</a> (<a class="el" href="a02268.html#NL3D_1_1ITexturew31">TType</a> <a class="el" href="a04223.html#a581">type</a>=RGBA)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NL3D_1_1ITexturea33">resize</a> (<a class="el" href="a04558.html#a10">sint32</a> nNewWidth, <a class="el" href="a04558.html#a10">sint32</a> nNewHeight, <a class="el" href="a02268.html#NL3D_1_1ITexturew31">TType</a> newType=DonTKnow, bool resetTo0=true)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NL3D_1_1ITexturea34">resizeMipMap</a> (<a class="el" href="a04558.html#a11">uint32</a> numMipMap, <a class="el" href="a04558.html#a10">sint32</a> nNewWidth, <a class="el" href="a04558.html#a10">sint32</a> nNewHeight, bool resetTo0=true)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NL3D_1_1ITexturea35">rot90CCW</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NL3D_1_1ITexturea36">rot90CW</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NL3D_1_1ITexturea37">rotateCCW</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NL3D_1_1ITexturea40">setMipMapCount</a> (<a class="el" href="a04558.html#a11">uint32</a> mmc)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NL3D_1_1ITexturea48">writeJPG</a> (<a class="el" href="a02270.html">NLMISC::IStream</a> &f, <a class="el" href="a04558.html#a7">uint8</a> quality=80)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NL3D_1_1ITexturea49">writeTGA</a> (<a class="el" href="a02270.html">NLMISC::IStream</a> &f, <a class="el" href="a04558.html#a11">uint32</a> d, bool upsideDown=false)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>virtual </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NLMISC_1_1CBitmapa29">~CBitmap</a> ()</td></tr> + +<tr><td colspan=2><br><h2>Static Public Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NL3D_1_1ITexturee0">loadSize</a> (const std::string &path, <a class="el" href="a04558.html#a11">uint32</a> &retWidth, <a class="el" href="a04558.html#a11">uint32</a> &retHeight)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NL3D_1_1ITexturee1">loadSize</a> (<a class="el" href="a02270.html">NLMISC::IStream</a> &f, <a class="el" href="a04558.html#a11">uint32</a> &<a class="el" href="a04223.html#a632">width</a>, <a class="el" href="a04558.html#a11">uint32</a> &<a class="el" href="a04223.html#a633">height</a>)</td></tr> + +<tr><td colspan=2><br><h2>Data Fields</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>enum <a class="el" href="a02268.html#NL3D_1_1ITexturew31">NLMISC::CBitmap::TType</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a></td></tr> + +<tr><td colspan=2><br><h2>Static Public Attributes</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>const <a class="el" href="a04558.html#a11">uint32</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NL3D_1_1ITextures0">bitPerPixels</a> [ModeCount]</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>const <a class="el" href="a04558.html#a11">uint32</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NL3D_1_1ITextures1">DXTC1HEADER</a> = NL_MAKEFOURCC('D','X', 'T', '1')</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>const <a class="el" href="a04558.html#a11">uint32</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NL3D_1_1ITextures2">DXTC3HEADER</a> = NL_MAKEFOURCC('D','X', 'T', '3')</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>const <a class="el" href="a04558.html#a11">uint32</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NL3D_1_1ITextures3">DXTC5HEADER</a> = NL_MAKEFOURCC('D','X', 'T', '5')</td></tr> + +<tr><td colspan=2><br><h2>Protected Attributes</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03000.html">CObjectVector</a>< <a class="el" href="a04558.html#a7">uint8</a> > </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NL3D_1_1ITexturep0">_Data</a> [<a class="el" href="a05378.html#a43">MAX_MIPMAP</a>]</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a11">uint32</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NL3D_1_1ITexturep1">_Height</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NL3D_1_1ITexturep2">_LoadGrayscaleAsAlpha</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a7">uint8</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NL3D_1_1ITexturep3">_MipMapCount</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a11">uint32</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NL3D_1_1ITexturep5">_Width</a></td></tr> + +<tr><td colspan=2><br><h2>Private Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a11">uint32</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NLMISC_1_1CBitmapd0">blend</a> (<a class="el" href="a04558.html#a11">uint32</a> &n0, <a class="el" href="a04558.html#a11">uint32</a> &n1, <a class="el" href="a04558.html#a11">uint32</a> coef0)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NLMISC_1_1CBitmapd1">decompressDXT1</a> (bool <a class="el" href="a04223.html#a663">alpha</a>)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NLMISC_1_1CBitmapd2">decompressDXT3</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NLMISC_1_1CBitmapd3">decompressDXT5</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>float </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NLMISC_1_1CBitmapd4">getColorInterp</a> (float <a class="el" href="a04223.html#a572">x</a>, float <a class="el" href="a04223.html#a573">y</a>, float xy00, float xy01, float xy10, float xy11) const </td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03337.html">CRGBA</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NLMISC_1_1CBitmapd5">getRGBAPixel</a> (<a class="el" href="a04558.html#a14">sint</a> <a class="el" href="a04223.html#a572">x</a>, <a class="el" href="a04558.html#a14">sint</a> <a class="el" href="a04223.html#a573">y</a>, <a class="el" href="a04558.html#a11">uint32</a> numMipMap) const </td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a7">uint8</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NLMISC_1_1CBitmapd6">readDDS</a> (<a class="el" href="a02270.html">NLMISC::IStream</a> &f, <a class="el" href="a04558.html#a15">uint</a> mipMapSkip)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a7">uint8</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NLMISC_1_1CBitmapd7">readTGA</a> (<a class="el" href="a02270.html">NLMISC::IStream</a> &f)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NLMISC_1_1CBitmapd8">resamplePicture32</a> (const <a class="el" href="a03337.html">NLMISC::CRGBA</a> *pSrc, <a class="el" href="a03337.html">NLMISC::CRGBA</a> *pDest, <a class="el" href="a04558.html#a10">sint32</a> nSrcWidth, <a class="el" href="a04558.html#a10">sint32</a> nSrcHeight, <a class="el" href="a04558.html#a10">sint32</a> nDestWidth, <a class="el" href="a04558.html#a10">sint32</a> nDestHeight)</td></tr> + +<tr><td colspan="2"><div class="groupHeader"></div></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NLMISC_1_1CBitmapz1925_0">alphaLuminanceToAlpha</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NLMISC_1_1CBitmapz1925_1">alphaLuminanceToLuminance</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NLMISC_1_1CBitmapz1925_2">alphaLuminanceToRGBA</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NLMISC_1_1CBitmapz1925_3">alphaToAlphaLuminance</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NLMISC_1_1CBitmapz1925_4">alphaToLuminance</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NLMISC_1_1CBitmapz1925_5">alphaToRGBA</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NLMISC_1_1CBitmapz1925_6">convertToAlpha</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NLMISC_1_1CBitmapz1925_7">convertToAlphaLuminance</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NLMISC_1_1CBitmapz1925_8">convertToDXTC5</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NLMISC_1_1CBitmapz1925_9">convertToLuminance</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NLMISC_1_1CBitmapz1925_10">convertToRGBA</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NLMISC_1_1CBitmapz1925_11">luminanceToAlpha</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NLMISC_1_1CBitmapz1925_12">luminanceToAlphaLuminance</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NLMISC_1_1CBitmapz1925_13">luminanceToRGBA</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NLMISC_1_1CBitmapz1925_14">rgbaToAlpha</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NLMISC_1_1CBitmapz1925_15">rgbaToAlphaLuminance</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NLMISC_1_1CBitmapz1925_16">rgbaToLuminance</a> ()</td></tr> + +<tr><td colspan=2><br><h2>Static Private Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02268.html#NLMISC_1_1CBitmaph0">uncompress</a> (<a class="el" href="a04558.html#a9">uint16</a> color, <a class="el" href="a03337.html">NLMISC::CRGBA</a> &)</td></tr> + +</table> +<hr><h2>Member Enumeration Documentation</h2> +<a class="anchor" name="NL3D_1_1ITexturew31" doxytag="NLMISC::CBitmap::TType" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> enum <a class="el" href="a02268.html#NL3D_1_1ITexturew31">NLMISC::CBitmap::TType</a> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +<dl compact><dt><b>Enumeration values: </b></dt><dd> +<table border=0 cellspacing=2 cellpadding=0> +<tr><td valign=top><em><a class="anchor" name="NL3D_1_1ITexturew31NL3D_1_1ITexturew25" doxytag="RGBA" ></a>RGBA</em> </td><td> +</td></tr> +<tr><td valign=top><em><a class="anchor" name="NL3D_1_1ITexturew31NLMISC_1_1CBitmapw8" doxytag="Luminance" ></a>Luminance</em> </td><td> +</td></tr> +<tr><td valign=top><em><a class="anchor" name="NL3D_1_1ITexturew31NLMISC_1_1CBitmapw0" doxytag="Alpha" ></a>Alpha</em> </td><td> +</td></tr> +<tr><td valign=top><em><a class="anchor" name="NL3D_1_1ITexturew31NLMISC_1_1CBitmapw1" doxytag="AlphaLuminance" ></a>AlphaLuminance</em> </td><td> +</td></tr> +<tr><td valign=top><em><a class="anchor" name="NL3D_1_1ITexturew31NLMISC_1_1CBitmapw4" doxytag="DXTC1" ></a>DXTC1</em> </td><td> +</td></tr> +<tr><td valign=top><em><a class="anchor" name="NL3D_1_1ITexturew31NLMISC_1_1CBitmapw5" doxytag="DXTC1Alpha" ></a>DXTC1Alpha</em> </td><td> +</td></tr> +<tr><td valign=top><em><a class="anchor" name="NL3D_1_1ITexturew31NLMISC_1_1CBitmapw6" doxytag="DXTC3" ></a>DXTC3</em> </td><td> +</td></tr> +<tr><td valign=top><em><a class="anchor" name="NL3D_1_1ITexturew31NLMISC_1_1CBitmapw7" doxytag="DXTC5" ></a>DXTC5</em> </td><td> +</td></tr> +<tr><td valign=top><em><a class="anchor" name="NL3D_1_1ITexturew31NLMISC_1_1CBitmapw3" doxytag="DsDt" ></a>DsDt</em> </td><td> +</td></tr> +<tr><td valign=top><em><a class="anchor" name="NL3D_1_1ITexturew31NL3D_1_1ITexturew17" doxytag="ModeCount" ></a>ModeCount</em> </td><td> +</td></tr> +<tr><td valign=top><em><a class="anchor" name="NL3D_1_1ITexturew31NL3D_1_1ITexturew4" doxytag="DonTKnow" ></a>DonTKnow</em> </td><td> +</td></tr> +</table> +</dl> + +<p> +Definition at line <a class="el" href="a05487.html#l00234">234</a> of file <a class="el" href="a05487.html">bitmap.h</a>. +<p> +<div class="fragment"><pre>00235 { +00236 <a class="code" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew25">RGBA</a>=0, +00237 <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw8">Luminance</a>, +00238 <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw0">Alpha</a>, +00239 <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw1">AlphaLuminance</a>, +00240 <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw4">DXTC1</a>, +00241 <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw5">DXTC1Alpha</a>, +00242 <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw6">DXTC3</a>, +00243 <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw7">DXTC5</a>, +00244 <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw3">DsDt</a>, +00245 <a class="code" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew17">ModeCount</a>, +00246 <a class="code" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew4">DonTKnow</a>=0xffffffff +00247 } <a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>; +</pre></div> </td> + </tr> +</table> +<hr><h2>Constructor & Destructor Documentation</h2> +<a class="anchor" name="NLMISC_1_1CBitmapa3" doxytag="NLMISC::CBitmap::CBitmap" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> NLMISC::CBitmap::CBitmap </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [inline]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05487.html#l00254">254</a> of file <a class="el" href="a05487.html">bitmap.h</a>. +<p> +References <a class="el" href="a05487.html#l00094">_LoadGrayscaleAsAlpha</a>, <a class="el" href="a05487.html#l00093">_MipMapCount</a>, <a class="el" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>, and <a class="el" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew25">RGBA</a>. +<p> +<div class="fragment"><pre>00255 { +00256 <a class="code" href="a02268.html#NL3D_1_1ITexturep3">_MipMapCount</a> = 1; +00257 <a class="code" href="a02268.html#NL3D_1_1ITexturep5">_Width</a> = 0; +00258 <a class="code" href="a02268.html#NL3D_1_1ITexturep1">_Height</a> = 0; +00259 <a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a> = <a class="code" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew25">RGBA</a>; +00260 <a class="code" href="a02268.html#NL3D_1_1ITexturep2">_LoadGrayscaleAsAlpha</a> = <span class="keyword">true</span>; +00261 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBitmapa29" doxytag="NLMISC::CBitmap::~CBitmap" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> virtual NLMISC::CBitmap::~<a class="el" href="a02268.html">CBitmap</a> </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [inline, virtual]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05487.html#l00263">263</a> of file <a class="el" href="a05487.html">bitmap.h</a>. +<p> +<div class="fragment"><pre>00263 { } +</pre></div> </td> + </tr> +</table> +<hr><h2>Member Function Documentation</h2> +<a class="anchor" name="NLMISC_1_1CBitmapz1925_0" doxytag="NLMISC::CBitmap::alphaLuminanceToAlpha" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLMISC::CBitmap::alphaLuminanceToAlpha </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05486.html#l00762">762</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +References <a class="el" href="a05487.html#l00093">_MipMapCount</a>, <a class="el" href="a05587.html#l00141">NLMISC::contReset()</a>, <a class="el" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>, <a class="el" href="a06116.html#l00142">NLMISC::CObjectVector< T, EnableObjectBehavior >::resize()</a>, <a class="el" href="a06116.html#l00184">NLMISC::CObjectVector< uint8 >::size()</a>, <a class="el" href="a05538.html#l02935">size</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00100">uint32</a>, and <a class="el" href="a05981.html#l00096">uint8</a>. +<p> +Referenced by <a class="el" href="a05486.html#l00821">convertToAlpha()</a>. +<p> +<div class="fragment"><pre>00763 { +00764 <a class="code" href="a04558.html#a11">uint32</a> i; +00765 +00766 <span class="keywordflow">if</span>(<a class="code" href="a02268.html#NL3D_1_1ITexturep5">_Width</a>*<a class="code" href="a02268.html#NL3D_1_1ITexturep1">_Height</a> == 0) <span class="keywordflow">return</span> <span class="keyword">false</span>; +00767 +00768 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a7">uint8</a> m= 0; m<<a class="code" href="a02268.html#NL3D_1_1ITexturep3">_MipMapCount</a>; m++) +00769 { +00770 CObjectVector<uint8> dataTmp; +00771 dataTmp.resize(_Data[m].<a class="code" href="a04115.html#a94">size</a>()/2); +00772 <a class="code" href="a04558.html#a15">uint</a> dstId= 0; +00773 +00774 <span class="keywordflow">for</span>(i=0; i<<a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[m].size(); i+=2) +00775 { +00776 dataTmp[dstId++]= _Data[m][i+1]; +00777 } +00778 <a class="code" href="a05378.html#a381">NLMISC::contReset</a>(_Data[m]); +00779 _Data[m].resize(0); +00780 _Data[m] = dataTmp; +00781 } +00782 <a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a> = <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw0">Alpha</a>; +00783 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00784 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBitmapz1925_1" doxytag="NLMISC::CBitmap::alphaLuminanceToLuminance" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLMISC::CBitmap::alphaLuminanceToLuminance </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05486.html#l00677">677</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +References <a class="el" href="a05487.html#l00093">_MipMapCount</a>, <a class="el" href="a05587.html#l00141">NLMISC::contReset()</a>, <a class="el" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>, <a class="el" href="a06116.html#l00142">NLMISC::CObjectVector< T, EnableObjectBehavior >::resize()</a>, <a class="el" href="a06116.html#l00184">NLMISC::CObjectVector< uint8 >::size()</a>, <a class="el" href="a05538.html#l02935">size</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00100">uint32</a>, and <a class="el" href="a05981.html#l00096">uint8</a>. +<p> +Referenced by <a class="el" href="a05486.html#l00790">convertToLuminance()</a>. +<p> +<div class="fragment"><pre>00678 { +00679 <a class="code" href="a04558.html#a11">uint32</a> i; +00680 +00681 <span class="keywordflow">if</span>(<a class="code" href="a02268.html#NL3D_1_1ITexturep5">_Width</a>*<a class="code" href="a02268.html#NL3D_1_1ITexturep1">_Height</a> == 0) <span class="keywordflow">return</span> <span class="keyword">false</span>; +00682 +00683 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a7">uint8</a> m= 0; m<<a class="code" href="a02268.html#NL3D_1_1ITexturep3">_MipMapCount</a>; m++) +00684 { +00685 CObjectVector<uint8> dataTmp; +00686 dataTmp.resize(_Data[m].<a class="code" href="a04115.html#a94">size</a>()/2); +00687 <a class="code" href="a04558.html#a15">uint</a> dstId= 0; +00688 +00689 <span class="keywordflow">for</span>(i=0; i<<a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[m].size(); i+=2) +00690 { +00691 dataTmp[dstId++]= 0; +00692 dataTmp[dstId++]= 0; +00693 dataTmp[dstId++]= 0; +00694 dataTmp[dstId++]= _Data[m][i]; +00695 } +00696 <a class="code" href="a05378.html#a381">NLMISC::contReset</a>(_Data[m]); +00697 _Data[m].resize(0); +00698 _Data[m] = dataTmp; +00699 } +00700 <a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a> = <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw8">Luminance</a>; +00701 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00702 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBitmapz1925_2" doxytag="NLMISC::CBitmap::alphaLuminanceToRGBA" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLMISC::CBitmap::alphaLuminanceToRGBA </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05486.html#l00519">519</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +References <a class="el" href="a05487.html#l00093">_MipMapCount</a>, <a class="el" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>, <a class="el" href="a06116.html#l00142">NLMISC::CObjectVector< T, EnableObjectBehavior >::resize()</a>, <a class="el" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew25">RGBA</a>, <a class="el" href="a06116.html#l00184">NLMISC::CObjectVector< uint8 >::size()</a>, <a class="el" href="a05538.html#l02935">size</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00100">uint32</a>, and <a class="el" href="a05981.html#l00096">uint8</a>. +<p> +Referenced by <a class="el" href="a05486.html#l00882">convertToRGBA()</a>. +<p> +<div class="fragment"><pre>00520 { +00521 <a class="code" href="a04558.html#a11">uint32</a> i; +00522 +00523 <span class="keywordflow">if</span>(<a class="code" href="a02268.html#NL3D_1_1ITexturep5">_Width</a>*<a class="code" href="a02268.html#NL3D_1_1ITexturep1">_Height</a> == 0) <span class="keywordflow">return</span> <span class="keyword">false</span>; +00524 +00525 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a7">uint8</a> m= 0; m<<a class="code" href="a02268.html#NL3D_1_1ITexturep3">_MipMapCount</a>; m++) +00526 { +00527 CObjectVector<uint8> dataTmp; +00528 dataTmp.resize(_Data[m].<a class="code" href="a04115.html#a94">size</a>()*2); +00529 <a class="code" href="a04558.html#a15">uint</a> dstId= 0; +00530 +00531 <span class="keywordflow">for</span>(i=0; i<<a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[m].size(); i+=2) +00532 { +00533 dataTmp[dstId++]= _Data[m][i]; +00534 dataTmp[dstId++]= _Data[m][i]; +00535 dataTmp[dstId++]= _Data[m][i]; +00536 dataTmp[dstId++]= _Data[m][i+1]; +00537 } +00538 _Data[m] = dataTmp; +00539 } +00540 <a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a> = <a class="code" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew25">RGBA</a>; +00541 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00542 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBitmapz1925_3" doxytag="NLMISC::CBitmap::alphaToAlphaLuminance" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLMISC::CBitmap::alphaToAlphaLuminance </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05486.html#l00607">607</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +References <a class="el" href="a05487.html#l00093">_MipMapCount</a>, <a class="el" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>, <a class="el" href="a06116.html#l00142">NLMISC::CObjectVector< T, EnableObjectBehavior >::resize()</a>, <a class="el" href="a06116.html#l00184">NLMISC::CObjectVector< uint8 >::size()</a>, <a class="el" href="a05538.html#l02935">size</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00100">uint32</a>, and <a class="el" href="a05981.html#l00096">uint8</a>. +<p> +Referenced by <a class="el" href="a05486.html#l00852">convertToAlphaLuminance()</a>. +<p> +<div class="fragment"><pre>00608 { +00609 <a class="code" href="a04558.html#a11">uint32</a> i; +00610 +00611 <span class="keywordflow">if</span>(<a class="code" href="a02268.html#NL3D_1_1ITexturep5">_Width</a>*<a class="code" href="a02268.html#NL3D_1_1ITexturep1">_Height</a> == 0) <span class="keywordflow">return</span> <span class="keyword">false</span>; +00612 +00613 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a7">uint8</a> m= 0; m<<a class="code" href="a02268.html#NL3D_1_1ITexturep3">_MipMapCount</a>; m++) +00614 { +00615 CObjectVector<uint8> dataTmp; +00616 dataTmp.resize(_Data[m].<a class="code" href="a04115.html#a94">size</a>()*2); +00617 <a class="code" href="a04558.html#a15">uint</a> dstId= 0; +00618 +00619 <span class="keywordflow">for</span>(i=0; i<<a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[m].size(); i++) +00620 { +00621 dataTmp[dstId++]= 0; +00622 dataTmp[dstId++]= _Data[m][i]; +00623 } +00624 _Data[m] = dataTmp; +00625 } +00626 <a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a> = <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw1">AlphaLuminance</a>; +00627 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00628 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBitmapz1925_4" doxytag="NLMISC::CBitmap::alphaToLuminance" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLMISC::CBitmap::alphaToLuminance </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05486.html#l00664">664</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +References <a class="el" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>. +<p> +Referenced by <a class="el" href="a05486.html#l00790">convertToLuminance()</a>. +<p> +<div class="fragment"><pre>00665 { +00666 <span class="keywordflow">if</span>(<a class="code" href="a02268.html#NL3D_1_1ITexturep5">_Width</a>*<a class="code" href="a02268.html#NL3D_1_1ITexturep1">_Height</a> == 0) <span class="keywordflow">return</span> <span class="keyword">false</span>; +00667 +00668 <a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a> = <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw8">Luminance</a>; +00669 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00670 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBitmapz1925_5" doxytag="NLMISC::CBitmap::alphaToRGBA" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLMISC::CBitmap::alphaToRGBA </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05486.html#l00490">490</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +References <a class="el" href="a05487.html#l00093">_MipMapCount</a>, <a class="el" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>, <a class="el" href="a06116.html#l00142">NLMISC::CObjectVector< T, EnableObjectBehavior >::resize()</a>, <a class="el" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew25">RGBA</a>, <a class="el" href="a06116.html#l00184">NLMISC::CObjectVector< uint8 >::size()</a>, <a class="el" href="a05538.html#l02935">size</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00100">uint32</a>, and <a class="el" href="a05981.html#l00096">uint8</a>. +<p> +Referenced by <a class="el" href="a05486.html#l00882">convertToRGBA()</a>. +<p> +<div class="fragment"><pre>00491 { +00492 <a class="code" href="a04558.html#a11">uint32</a> i; +00493 +00494 <span class="keywordflow">if</span>(<a class="code" href="a02268.html#NL3D_1_1ITexturep5">_Width</a>*<a class="code" href="a02268.html#NL3D_1_1ITexturep1">_Height</a> == 0) <span class="keywordflow">return</span> <span class="keyword">false</span>; +00495 +00496 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a7">uint8</a> m= 0; m<<a class="code" href="a02268.html#NL3D_1_1ITexturep3">_MipMapCount</a>; m++) +00497 { +00498 CObjectVector<uint8> dataTmp; +00499 dataTmp.resize(_Data[m].<a class="code" href="a04115.html#a94">size</a>()*4); +00500 <a class="code" href="a04558.html#a15">uint</a> dstId= 0; +00501 +00502 <span class="keywordflow">for</span>(i=0; i<<a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[m].size(); i++) +00503 { +00504 dataTmp[dstId++]= 255; +00505 dataTmp[dstId++]= 255; +00506 dataTmp[dstId++]= 255; +00507 dataTmp[dstId++]= _Data[m][i]; +00508 } +00509 _Data[m] = dataTmp; +00510 } +00511 <a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a> = <a class="code" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew25">RGBA</a>; +00512 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00513 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1ITexturea1" doxytag="NLMISC::CBitmap::blend" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CBitmap::blend </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02268.html">CBitmap</a> & </td> + <td class="mdname" nowrap> <em>Bm0</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a02268.html">CBitmap</a> & </td> + <td class="mdname" nowrap> <em>Bm1</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a9">uint16</a> </td> + <td class="mdname" nowrap> <em>factor</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>bool </td> + <td class="mdname" nowrap> <em>inputBitmapIsMutable</em> = false</td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Set this bitmap as the result of the blend bewteen 2 bitmap REQUIRE : - Bm0 and Bm1 should have the same size.<ul> +<li>Both bitmap should be convertible to RGBA pixel format. The result is a RGBA bitmap. NB: this just works with the first mipmaps <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign=top><em>factor</em> </td><td>The blend factor. 0 means the result is equal to Bm0, 256 means the result is equal to Bm1 </td></tr> + <tr><td valign=top><em>inputBitmapIsMutable</em> </td><td>when true, bitmap can be converted in place when needed (no copy done)</td></tr> + </table> +</dl> +</li></ul> + +<p> +Definition at line <a class="el" href="a05486.html#l02817">2817</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +References <a class="el" href="a05487.html#l00090">_Data</a>, <a class="el" href="a05487.html#l00096">_Height</a>, <a class="el" href="a05487.html#l00095">_Width</a>, <a class="el" href="a05486.html#l00882">convertToRGBA()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>, <a class="el" href="a05486.html#l01545">resize()</a>, <a class="el" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew25">RGBA</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00098">uint16</a>, <a class="el" href="a05981.html#l00102">uint64</a>, and <a class="el" href="a05981.html#l00096">uint8</a>. +<p> +<div class="fragment"><pre>02818 { +02819 <a class="code" href="a04199.html#a6">nlassert</a>(factor <= 256); +02820 +02821 <a class="code" href="a04199.html#a6">nlassert</a>(Bm0._Width != 0 && Bm0._Height != 0 +02822 && Bm1._Width != 0 && Bm1._Height != 0); +02823 +02824 <a class="code" href="a04199.html#a6">nlassert</a>(Bm0._Width == Bm1._Width); <span class="comment">// the bitmap should have the same size</span> +02825 <a class="code" href="a04199.html#a6">nlassert</a>(Bm0._Height == Bm1._Height); +02826 +02827 <span class="keyword">const</span> <a class="code" href="a02268.html#NLMISC_1_1CBitmapa3">CBitmap</a> *nBm0, *nBm1; <span class="comment">// pointer to the bitmap that is used for blending, or to a copy is a conversion wa required</span> +02828 +02829 <a class="code" href="a02268.html#NLMISC_1_1CBitmapa3">CBitmap</a> cp0, cp1; <span class="comment">// these bitmap are copies of Bm1 and Bm0 if a conversion was needed</span> +02830 +02831 <span class="keywordflow">if</span> (Bm0.PixelFormat != <a class="code" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew25">RGBA</a>) +02832 { +02833 <span class="keywordflow">if</span> (inputBitmapIsMutable) +02834 { +02835 Bm0.convertToRGBA(); +02836 nBm0 = &Bm0; +02837 } +02838 <span class="keywordflow">else</span> +02839 { +02840 cp0 = Bm0; +02841 cp0.convertToRGBA(); +02842 nBm0 = &cp0; +02843 } +02844 } +02845 <span class="keywordflow">else</span> +02846 { +02847 nBm0 = &Bm0; +02848 } +02849 +02850 +02851 <span class="keywordflow">if</span> (Bm1.PixelFormat != <a class="code" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew25">RGBA</a>) +02852 { +02853 <span class="keywordflow">if</span> (inputBitmapIsMutable) +02854 { +02855 Bm1.convertToRGBA(); +02856 nBm1 = &Bm1; +02857 } +02858 <span class="keywordflow">else</span> +02859 { +02860 cp1 = Bm1; +02861 cp1.convertToRGBA(); +02862 nBm1 = &cp1; +02863 } +02864 } +02865 <span class="keywordflow">else</span> +02866 { +02867 nBm1 = &Bm1; +02868 } +02869 +02870 this-><a class="code" href="a02268.html#NL3D_1_1ITexturea33">resize</a>(Bm0._Width, Bm0._Height, RGBA); +02871 +02872 <a class="code" href="a04558.html#a15">uint</a> numPix = <a class="code" href="a02268.html#NL3D_1_1ITexturep5">_Width</a> * <a class="code" href="a02268.html#NL3D_1_1ITexturep1">_Height</a>; <span class="comment">// 4 component per pixels</span> +02873 +02874 +02875 <span class="keyword">const</span> <a class="code" href="a04558.html#a7">uint8</a> *src0 = &(nBm0->_Data[0][0]); +02876 <span class="keyword">const</span> <a class="code" href="a04558.html#a7">uint8</a> *src1 = &(nBm1->_Data[0][0]); +02877 <a class="code" href="a04558.html#a7">uint8</a> *dest = &(this-><a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[0][0]); +02878 +02879 +02880 <span class="preprocessor"> #ifdef NL_OS_WINDOWS </span> +02881 <span class="preprocessor"></span> <span class="keywordflow">if</span> (CSystemInfo::hasMMX()) +02882 { +02883 <span class="comment">// On a P4 2GHz, with a 256x256 texture, I got the following results :</span> +02884 <span class="comment">// without mmx : 5.2 ms</span> +02885 <span class="comment">// with mmx : 1.7 ms</span> +02886 <span class="comment">// I'm sure this can be further optimized..</span> +02887 +02888 <a class="code" href="a04558.html#a15">uint</a> numPixLeft = numPix & 1; <span class="comment">// process 2 pixels at once, so special case for odd number</span> +02889 numPix = numPix & ~1; +02890 <span class="comment">// do fast blend with mmx</span> +02891 <a class="code" href="a04558.html#a13">uint64</a> blendFactor0; +02892 <a class="code" href="a04558.html#a13">uint64</a> blendFactor1; +02893 <a class="code" href="a04558.html#a9">uint16</a> *bf0 = (<a class="code" href="a04558.html#a9">uint16</a> *) &blendFactor0; +02894 <a class="code" href="a04558.html#a9">uint16</a> *bf1 = (<a class="code" href="a04558.html#a9">uint16</a> *) &blendFactor1; +02895 bf0[0] = bf0[1] = bf0[2] = bf0[3] = factor; +02896 bf1[0] = bf1[1] = bf1[2] = bf1[3] = 256 - factor; +02897 __asm +02898 { +02899 mov esi, src0 +02900 mov eax, src1 +02901 mov edi, dest +02902 mov ebx, -8 +02903 mov ecx, numPix +02904 shr ecx, 1 <span class="comment">// process pixels 2 by 2</span> +02905 movq mm1, blendFactor0 +02906 movq mm0, blendFactor1 +02907 +02908 myLoop: +02909 pxor mm6, mm6 +02910 lea ebx, [ebx + 8] <span class="comment">// points next location</span> +02911 pxor mm7, mm7 +02912 movq mm2, [esi + ebx] +02913 movq mm3, [eax + ebx] +02914 <span class="comment">// do blend </span> +02915 punpckhbw mm7, mm2 <span class="comment">// mm7 contains src0 color 0 in high bytes</span> +02916 punpckhbw mm6, mm3 <span class="comment">// mm6 contains src1 color 0 in high bytes</span> +02917 psrl mm7, 1 +02918 pxor mm4, mm4 <span class="comment">// mm4 = 0 </span> +02919 psrl mm6, 1 +02920 pmulhw mm7, mm0 <span class="comment">// src0 = src0 * blendFactor</span> +02921 pxor mm5, mm5 <span class="comment">// mm5 = 0</span> +02922 pmulhw mm6, mm1 <span class="comment">// src1 = src1 * (1 - blendfactor)</span> +02923 punpcklbw mm4, mm2 <span class="comment">// mm4 contains src0 color 1 in high bytes</span> +02924 paddusw mm6, mm7 <span class="comment">// mm6 = src0[0] blended with src1[0]</span> +02925 psrl mm4, 1 +02926 punpcklbw mm5, mm3 <span class="comment">// mm4 contains src1 color 1 in high bytes</span> +02927 psll mm6, 1 +02928 psrl mm5, 1 +02929 pmulhw mm4, mm0 <span class="comment">// src0 = src0 * blendFactor</span> +02930 pmulhw mm5, mm1 <span class="comment">// src1 = src1 * (1 - blendfactor)</span> +02931 paddusw mm4, mm5 <span class="comment">// mm6 = src0[1] blended with src1[1]</span> +02932 psll mm4, 1 +02933 <span class="comment">// pack result</span> +02934 packuswb mm4, mm6 +02935 dec ecx +02936 movq [edi + ebx], mm4 <span class="comment">// store result</span> +02937 jne myLoop +02938 emms +02939 } +02940 <span class="keywordflow">if</span> (numPixLeft) +02941 { +02942 <span class="comment">// case of odd number of pixels</span> +02943 src0 += 4 * numPix; +02944 src1 += 4 * numPix; +02945 dest += 4 * numPix; +02946 <a class="code" href="a04558.html#a15">uint</a> blendFact = (<a class="code" href="a04558.html#a15">uint</a>) factor; +02947 <a class="code" href="a04558.html#a15">uint</a> invblendFact = 256 - blendFact; +02948 *dest = (<a class="code" href="a04558.html#a7">uint8</a>) (((blendFact * *src1) + (invblendFact * *src0)) >> 8); +02949 *(dest + 1) = (<a class="code" href="a04558.html#a7">uint8</a>) (((blendFact * *(src1 + 1)) + (invblendFact * *(src0 + 1))) >> 8); +02950 *(dest + 2) = (<a class="code" href="a04558.html#a7">uint8</a>) (((blendFact * *(src1 + 2)) + (invblendFact * *(src0 + 2))) >> 8); +02951 *(dest + 3) = (<a class="code" href="a04558.html#a7">uint8</a>) (((blendFact * *(src1 + 3)) + (invblendFact * *(src0 + 3))) >> 8); +02952 } +02953 } +02954 <span class="keywordflow">else</span> +02955 <span class="preprocessor"> #endif //#ifdef NL_OS_WINDOWS </span> +02956 <span class="preprocessor"></span> { +02957 <a class="code" href="a04558.html#a7">uint8</a> *endPix = dest + (numPix << 2); +02958 <span class="comment">// no mmx version</span> +02959 <a class="code" href="a04558.html#a15">uint</a> blendFact = (<a class="code" href="a04558.html#a15">uint</a>) factor; +02960 <a class="code" href="a04558.html#a15">uint</a> invblendFact = 256 - blendFact; +02961 <span class="keywordflow">do</span> +02962 { +02964 *dest = (<a class="code" href="a04558.html#a7">uint8</a>) (((blendFact * *src1) + (invblendFact * *src0)) >> 8); +02965 *(dest + 1) = (<a class="code" href="a04558.html#a7">uint8</a>) (((blendFact * *(src1 + 1)) + (invblendFact * *(src0 + 1))) >> 8); +02966 *(dest + 2) = (<a class="code" href="a04558.html#a7">uint8</a>) (((blendFact * *(src1 + 2)) + (invblendFact * *(src0 + 2))) >> 8); +02967 *(dest + 3) = (<a class="code" href="a04558.html#a7">uint8</a>) (((blendFact * *(src1 + 3)) + (invblendFact * *(src0 + 3))) >> 8); +02968 +02969 src0 = src0 + 4; +02970 src1 = src1 + 4; +02971 dest = dest + 4; +02972 } +02973 <span class="keywordflow">while</span> (dest != endPix); +02974 } +02975 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBitmapd0" doxytag="NLMISC::CBitmap::blend" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a11">uint32</a> NLMISC::CBitmap::blend </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a11">uint32</a> & </td> + <td class="mdname" nowrap> <em>n0</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a11">uint32</a> & </td> + <td class="mdname" nowrap> <em>n1</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a11">uint32</a> </td> + <td class="mdname" nowrap> <em>coef0</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +blend 2 integers between 0 and 255 . <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign=top><em>n0</em> </td><td>first integer </td></tr> + <tr><td valign=top><em>n1</em> </td><td>second integer </td></tr> + <tr><td valign=top><em>coef</em> </td><td>coefficient for the first integer (must be in [0,256])</td></tr> + </table> +</dl> + +<p> +Definition at line <a class="el" href="a05486.html#l01338">1338</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +References <a class="el" href="a05981.html#l00100">uint32</a>. +<p> +Referenced by <a class="el" href="a05486.html#l01200">decompressDXT5()</a>, and <a class="el" href="a06509.html#l00102">NL3D::CTextureBlend::doGenerate()</a>. +<p> +<div class="fragment"><pre>01339 { +01340 <span class="keywordtype">int</span> a0 = coef0; +01341 <span class="keywordtype">int</span> a1 = 256-a0; +01342 <span class="keywordflow">return</span> ((n0*a0 + n1*a1) >>8); +01343 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1ITexturea2" doxytag="NLMISC::CBitmap::blit" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLMISC::CBitmap::blit </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a02268.html">CBitmap</a> * </td> + <td class="mdname" nowrap> <em>src</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a10">sint32</a> </td> + <td class="mdname" nowrap> <em>x</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a10">sint32</a> </td> + <td class="mdname" nowrap> <em>y</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Perform a simple blit from the source to this bitmap at the (x, y) pos The dimension of the original bitmap are preserved For now, this texture and the source must have the same format With DXTC format, the dest coordinates must be a multiple of 4 mipmap are not rebuild when present <dl compact><dt><b>Returns:</b></dt><dd>true if the params were corrects and if the blit occures. In debug build there's an assertion</dd></dl> + +<p> +Definition at line <a class="el" href="a05486.html#l02332">2332</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +References <a class="el" href="a05486.html#l00070">bitPerPixels</a>, <a class="el" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew4">DonTKnow</a>, <a class="el" href="a05646.html#l01013">height</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a05981.html#l00099">sint32</a>, <a class="el" href="a05646.html#l01124">src</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00096">uint8</a>, <a class="el" href="a05646.html#l01013">width</a>, <a class="el" href="a05646.html#l00236">x</a>, and <a class="el" href="a05646.html#l00236">y</a>. +<p> +Referenced by <a class="el" href="a06525.html#l00178">NL3D::CTextureGrouped::doGenerate()</a>, and <a class="el" href="a05567.html#l00367">NL3D::CCoarseMeshBuild::expand()</a>. +<p> +<div class="fragment"><pre>02333 { +02334 +02335 <a class="code" href="a04199.html#a6">nlassert</a>(this->PixelFormat == <a class="code" href="a04223.html#a652">src</a>->PixelFormat); +02336 <span class="keywordflow">if</span> (this-><a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a> != <a class="code" href="a04223.html#a652">src</a>->PixelFormat) +02337 { +02338 <span class="keywordflow">return</span> <span class="keyword">false</span>; +02339 } +02340 +02341 +02342 <span class="comment">// check for dxtc use</span> +02343 +02344 <span class="keyword">const</span> <span class="keywordtype">bool</span> useDXTC = <a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a> == <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw4">DXTC1</a> || PixelFormat == <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw5">DXTC1Alpha</a> || PixelFormat == <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw6">DXTC3</a> || PixelFormat == <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw7">DXTC5</a>; +02345 +02346 <span class="comment">// number of bits for a 4x4 pix block</span> +02347 <span class="keyword">const</span> <a class="code" href="a04558.html#a15">uint</a> dxtcNumBits = PixelFormat == <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw4">DXTC1</a> || PixelFormat == <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw5">DXTC1Alpha</a> ? 64 : 128; +02348 +02349 +02350 <span class="keywordflow">if</span> (useDXTC) +02351 { +02352 <span class="comment">// blit pos must be multiple of 4</span> +02353 +02354 <a class="code" href="a04199.html#a6">nlassert</a>(! (x & 3 || y & 3) ); +02355 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a572">x</a> & 3 || <a class="code" href="a04223.html#a573">y</a> & 3) <span class="keywordflow">return</span> <span class="keyword">false</span>; +02356 +02357 } +02358 +02359 <a class="code" href="a04199.html#a6">nlassert</a>(PixelFormat != DonTKnow); +02360 +02361 <span class="comment">// the width to copy</span> +02362 <a class="code" href="a04558.html#a14">sint</a> <a class="code" href="a04223.html#a632">width</a> = <a class="code" href="a04223.html#a652">src</a>->_Width; +02363 <span class="comment">// the height to copy</span> +02364 <a class="code" href="a04558.html#a14">sint</a> <a class="code" href="a04223.html#a633">height</a> = <a class="code" href="a04223.html#a652">src</a>->_Height; +02365 +02366 <a class="code" href="a04558.html#a15">uint</a> destStartX, destStartY; +02367 <a class="code" href="a04558.html#a15">uint</a> srcStartX, srcStartY; +02368 +02369 +02370 <span class="comment">// clip against left</span> +02371 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a572">x</a> < 0) +02372 { +02373 <a class="code" href="a04223.html#a632">width</a> += <a class="code" href="a04223.html#a572">x</a>; +02374 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a632">width</a> <= 0) <span class="keywordflow">return</span> <span class="keyword">true</span>; +02375 destStartX = 0; +02376 srcStartX = -<a class="code" href="a04223.html#a572">x</a>; +02377 } +02378 <span class="keywordflow">else</span> +02379 { +02380 destStartX = <a class="code" href="a04223.html#a572">x</a>; +02381 srcStartX = 0; +02382 } +02383 +02384 <span class="comment">// clip against top</span> +02385 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a573">y</a> < 0) +02386 { +02387 <a class="code" href="a04223.html#a633">height</a> += <a class="code" href="a04223.html#a573">y</a>; +02388 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a633">height</a> <= 0) <span class="keywordflow">return</span> <span class="keyword">true</span>; +02389 srcStartY = -<a class="code" href="a04223.html#a573">y</a>; +02390 destStartY = 0; +02391 } +02392 <span class="keywordflow">else</span> +02393 { +02394 destStartY = <a class="code" href="a04223.html#a573">y</a>; +02395 srcStartY = 0; +02396 } +02397 +02398 <span class="comment">// clip against right</span> +02399 <span class="keywordflow">if</span> ((destStartX + <a class="code" href="a04223.html#a632">width</a> - 1) >= <a class="code" href="a02268.html#NL3D_1_1ITexturep5">_Width</a>) +02400 { +02401 <a class="code" href="a04223.html#a632">width</a> = <a class="code" href="a02268.html#NL3D_1_1ITexturep5">_Width</a> - destStartX; +02402 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a632">width</a> <= 0) <span class="keywordflow">return</span> <span class="keyword">true</span>; +02403 } +02404 +02405 <span class="comment">// clip against bottom</span> +02406 <span class="keywordflow">if</span> ((destStartY + <a class="code" href="a04223.html#a633">height</a> - 1) >= <a class="code" href="a02268.html#NL3D_1_1ITexturep1">_Height</a>) +02407 { +02408 <a class="code" href="a04223.html#a633">height</a> = <a class="code" href="a02268.html#NL3D_1_1ITexturep1">_Height</a> - destStartY; +02409 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a632">width</a> <= 0) <span class="keywordflow">return</span> <span class="keyword">true</span>; +02410 } +02411 +02412 +02413 <span class="comment">// divide all distance by 4 when using DXTC</span> +02414 <span class="keywordflow">if</span> (useDXTC) +02415 { +02416 destStartX >>= 2; +02417 destStartY >>= 2; +02418 srcStartX >>= 2; +02419 srcStartY >>= 2; +02420 <a class="code" href="a04223.html#a632">width</a> >>= 2; +02421 <a class="code" href="a04223.html#a633">height</a> >>= 2; +02422 } +02423 +02424 +02425 <span class="comment">// bytes per pixs is for either one pixel or 16 (a 4x4 block in DXTC)</span> +02426 <span class="keyword">const</span> <a class="code" href="a04558.html#a15">uint</a> bytePerPixs = ( useDXTC ? dxtcNumBits : <a class="code" href="a02268.html#NL3D_1_1ITextures0">bitPerPixels</a>[PixelFormat] ) >> 3 <span class="comment">/* divide by 8 to get the number of bytes */</span>; +02427 +02428 +02429 <span class="keyword">const</span> <a class="code" href="a04558.html#a15">uint</a> destRealWidth = useDXTC ? (<a class="code" href="a02268.html#NL3D_1_1ITexturep5">_Width</a> >> 2) : <a class="code" href="a02268.html#NL3D_1_1ITexturep5">_Width</a>; +02430 <span class="keyword">const</span> <a class="code" href="a04558.html#a15">uint</a> srcRealWidth = useDXTC ? (<a class="code" href="a04223.html#a652">src</a>->_Width >> 2) : <a class="code" href="a04223.html#a652">src</a>->_Width; +02431 +02432 +02433 <span class="comment">// size to go to the next line in the destination</span> +02434 <span class="keyword">const</span> <a class="code" href="a04558.html#a15">uint</a> destStride = destRealWidth * bytePerPixs; +02435 +02436 <span class="comment">// size to go to the next line in the source</span> +02437 <span class="keyword">const</span> <a class="code" href="a04558.html#a15">uint</a> srcStride = srcRealWidth * bytePerPixs; +02438 +02439 <span class="comment">// length in bytes of a line to copy</span> +02440 <span class="keyword">const</span> <a class="code" href="a04558.html#a15">uint</a> lineLength = <a class="code" href="a04223.html#a632">width</a> * bytePerPixs; +02441 +02442 +02443 <a class="code" href="a04558.html#a7">uint8</a> *destPos = &(<a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[0][0]) + destStride * destStartY + bytePerPixs * destStartX; +02444 <span class="keyword">const</span> <a class="code" href="a04558.html#a7">uint8</a> *srcPos = &(<a class="code" href="a04223.html#a652">src</a>->_Data[0][0]) + srcStride * srcStartY + bytePerPixs * srcStartX; +02445 +02446 <span class="comment">// copy each hline</span> +02447 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a14">sint</a> k = 0; k < <a class="code" href="a04223.html#a633">height</a>; ++k) +02448 { +02449 ::memcpy(destPos, srcPos, lineLength); +02450 destPos += destStride; +02451 srcPos += srcStride; +02452 } +02453 +02454 +02455 <span class="keywordflow">return</span> <span class="keyword">true</span>; +02456 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1ITexturea3" doxytag="NLMISC::CBitmap::buildMipMaps" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CBitmap::buildMipMaps </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Build the mipmaps of the bitmap if they don't exist. Work only in RGBA mode... <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="a02268.html#NL3D_1_1ITexturea30">releaseMipMaps()</a>.</dd></dl> + +<p> +Definition at line <a class="el" href="a05486.html#l01422">1422</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +References <a class="el" href="a05487.html#l00093">_MipMapCount</a>, <a class="el" href="a06340.html#l00340">NLMISC::CRGBA::A</a>, <a class="el" href="a06340.html#l00338">NLMISC::CRGBA::B</a>, <a class="el" href="a06340.html#l00336">NLMISC::CRGBA::G</a>, <a class="el" href="a05586.html#l00371">NLMISC::isPowerOf2()</a>, <a class="el" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>, <a class="el" href="a06340.html#l00334">NLMISC::CRGBA::R</a>, <a class="el" href="a06116.html#l00142">NLMISC::CObjectVector< uint8 >::resize()</a>, <a class="el" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew25">RGBA</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a05981.html#l00100">uint32</a>, and <a class="el" href="a05646.html#l00236">w</a>. +<p> +Referenced by <a class="el" href="a05790.html#l00152">NL3D::CHLSColorTexture::addMask()</a>, <a class="el" href="a06527.html#l00045">NL3D::CTextureMem::doGenerate()</a>, <a class="el" href="a05486.html#l02682">flipH()</a>, <a class="el" href="a05486.html#l02714">flipV()</a>, <a class="el" href="a05486.html#l01508">resample()</a>, <a class="el" href="a05486.html#l02781">rot90CCW()</a>, <a class="el" href="a05486.html#l02746">rot90CW()</a>, and <a class="el" href="a05652.html#l00361">NL3D::CDriverGL::setupTextureEx()</a>. +<p> +<div class="fragment"><pre>01423 { +01424 <a class="code" href="a04558.html#a11">uint32</a> i,j; +01425 +01426 <span class="keywordflow">if</span>(<a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>!=<a class="code" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew25">RGBA</a>) <span class="keywordflow">return</span>; +01427 <span class="keywordflow">if</span>(<a class="code" href="a02268.html#NL3D_1_1ITexturep3">_MipMapCount</a>!=1) <span class="keywordflow">return</span>; +01428 <span class="keywordflow">if</span>(!<a class="code" href="a05378.html#a264">NLMISC::isPowerOf2</a>(_Width)) <span class="keywordflow">return</span>; +01429 <span class="keywordflow">if</span>(!<a class="code" href="a05378.html#a264">NLMISC::isPowerOf2</a>(_Height)) <span class="keywordflow">return</span>; +01430 +01431 <a class="code" href="a04558.html#a11">uint32</a> <a class="code" href="a04223.html#a575">w</a> = <a class="code" href="a02268.html#NL3D_1_1ITexturep5">_Width</a>; +01432 <a class="code" href="a04558.html#a11">uint32</a> h = <a class="code" href="a02268.html#NL3D_1_1ITexturep1">_Height</a>; +01433 +01434 <span class="keywordflow">while</span>(<a class="code" href="a04223.html#a575">w</a>>1 || h>1) +01435 { +01436 <a class="code" href="a04558.html#a11">uint32</a> precw = <a class="code" href="a04223.html#a575">w</a>; +01437 <a class="code" href="a04558.html#a11">uint32</a> prech = h; +01438 <a class="code" href="a04223.html#a575">w</a> = (<a class="code" href="a04223.html#a575">w</a>+1)/2; +01439 h = (h+1)/2; +01440 <a class="code" href="a04558.html#a11">uint32</a> mulw= precw/<a class="code" href="a04223.html#a575">w</a>; +01441 <a class="code" href="a04558.html#a11">uint32</a> mulh= prech/h; +01442 +01443 <a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[<a class="code" href="a02268.html#NL3D_1_1ITexturep3">_MipMapCount</a>].resize(w*h*4); +01444 +01445 +01446 <a class="code" href="a03337.html">NLMISC::CRGBA</a> *pRgba = (<a class="code" href="a03337.html">NLMISC::CRGBA</a>*)&<a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[<a class="code" href="a02268.html#NL3D_1_1ITexturep3">_MipMapCount</a>][0]; +01447 <a class="code" href="a03337.html">NLMISC::CRGBA</a> *pRgbaPrev = (<a class="code" href="a03337.html">NLMISC::CRGBA</a>*)&<a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[<a class="code" href="a02268.html#NL3D_1_1ITexturep3">_MipMapCount</a>-1][0]; +01448 <span class="keywordflow">for</span>(i=0; i<h; i++) +01449 { +01450 <a class="code" href="a04558.html#a14">sint</a> i0= mulh*i; +01451 <a class="code" href="a04558.html#a14">sint</a> i1= mulh*i+1; +01452 <span class="keywordflow">if</span>(mulh==1) +01453 i1=i0; +01454 i0*=precw; +01455 i1*=precw; +01456 <span class="keywordflow">for</span>(j=0; j<<a class="code" href="a04223.html#a575">w</a>; j++) +01457 { +01458 <a class="code" href="a04558.html#a14">sint</a> j0= mulw*j; +01459 <a class="code" href="a04558.html#a14">sint</a> j1= mulw*j+1; +01460 <span class="keywordflow">if</span>(mulh==1) +01461 j1=j0; +01462 CRGBA &c0= pRgbaPrev[i0+j0]; +01463 CRGBA &c1= pRgbaPrev[i0+j1]; +01464 CRGBA &c2= pRgbaPrev[i1+j0]; +01465 CRGBA &c3= pRgbaPrev[i1+j1]; +01466 pRgba[i*<a class="code" href="a04223.html#a575">w</a> + j].<a class="code" href="a03337.html#NLMISC_1_1CRGBAo3">R</a> = (c0.R + +01467 c1.R + +01468 c2.R + +01469 c3.R + 2 ) /4; +01470 pRgba[i*<a class="code" href="a04223.html#a575">w</a> + j].<a class="code" href="a03337.html#NLMISC_1_1CRGBAo2">G</a> = (c0.G + +01471 c1.G + +01472 c2.G + +01473 c3.G + 2 ) /4; +01474 pRgba[i*<a class="code" href="a04223.html#a575">w</a> + j].<a class="code" href="a03337.html#NLMISC_1_1CRGBAo1">B</a> = (c0.B + +01475 c1.B + +01476 c2.B + +01477 c3.B + 2 ) /4; +01478 pRgba[i*<a class="code" href="a04223.html#a575">w</a> + j].<a class="code" href="a03337.html#NLMISC_1_1CRGBAo0">A</a> = (c0.A + +01479 c1.A + +01480 c2.A + +01481 c3.A + 2 ) /4; +01482 } +01483 } +01484 +01485 <a class="code" href="a02268.html#NL3D_1_1ITexturep3">_MipMapCount</a>++; +01486 } +01487 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBitmapz1925_6" doxytag="NLMISC::CBitmap::convertToAlpha" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLMISC::CBitmap::convertToAlpha </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05486.html#l00821">821</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +References <a class="el" href="a05486.html#l00762">alphaLuminanceToAlpha()</a>, <a class="el" href="a05486.html#l00736">luminanceToAlpha()</a>, <a class="el" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>, <a class="el" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew25">RGBA</a>, and <a class="el" href="a05486.html#l00708">rgbaToAlpha()</a>. +<p> +Referenced by <a class="el" href="a05486.html#l00926">convertToType()</a>. +<p> +<div class="fragment"><pre>00822 { +00823 <span class="keywordflow">switch</span>(<a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>) +00824 { +00825 <span class="keywordflow">case</span> <a class="code" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew25">RGBA</a> : +00826 <span class="keywordflow">return</span> <a class="code" href="a02268.html#NLMISC_1_1CBitmapz1925_14">rgbaToAlpha</a>(); +00827 <span class="keywordflow">break</span>; +00828 +00829 <span class="keywordflow">case</span> <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw8">Luminance</a> : +00830 <span class="keywordflow">return</span> <a class="code" href="a02268.html#NLMISC_1_1CBitmapz1925_11">luminanceToAlpha</a>(); +00831 <span class="keywordflow">break</span>; +00832 +00833 <span class="keywordflow">case</span> <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw0">Alpha</a> : +00834 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00835 <span class="keywordflow">break</span>; +00836 +00837 <span class="keywordflow">case</span> <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw1">AlphaLuminance</a> : +00838 <span class="keywordflow">return</span> <a class="code" href="a02268.html#NLMISC_1_1CBitmapz1925_0">alphaLuminanceToAlpha</a>(); +00839 <span class="keywordflow">break</span>; +00840 +00841 <span class="keywordflow">default</span>: +00842 <span class="keywordflow">break</span>; +00843 } +00844 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00845 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBitmapz1925_7" doxytag="NLMISC::CBitmap::convertToAlphaLuminance" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLMISC::CBitmap::convertToAlphaLuminance </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05486.html#l00852">852</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +References <a class="el" href="a05486.html#l00607">alphaToAlphaLuminance()</a>, <a class="el" href="a05486.html#l00579">luminanceToAlphaLuminance()</a>, <a class="el" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>, <a class="el" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew25">RGBA</a>, and <a class="el" href="a05486.html#l00550">rgbaToAlphaLuminance()</a>. +<p> +Referenced by <a class="el" href="a05486.html#l00926">convertToType()</a>. +<p> +<div class="fragment"><pre>00853 { +00854 <span class="keywordflow">switch</span>(<a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>) +00855 { +00856 <span class="keywordflow">case</span> <a class="code" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew25">RGBA</a> : +00857 <span class="keywordflow">return</span> <a class="code" href="a02268.html#NLMISC_1_1CBitmapz1925_15">rgbaToAlphaLuminance</a>(); +00858 <span class="keywordflow">break</span>; +00859 +00860 <span class="keywordflow">case</span> <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw8">Luminance</a> : +00861 <span class="keywordflow">return</span> <a class="code" href="a02268.html#NLMISC_1_1CBitmapz1925_12">luminanceToAlphaLuminance</a>(); +00862 <span class="keywordflow">break</span>; +00863 +00864 <span class="keywordflow">case</span> <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw0">Alpha</a> : +00865 <span class="keywordflow">return</span> <a class="code" href="a02268.html#NLMISC_1_1CBitmapz1925_3">alphaToAlphaLuminance</a>(); +00866 <span class="keywordflow">break</span>; +00867 +00868 <span class="keywordflow">case</span> <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw1">AlphaLuminance</a> : +00869 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00870 <span class="keywordflow">break</span>; +00871 +00872 <span class="keywordflow">default</span>: +00873 <span class="keywordflow">break</span>; +00874 } +00875 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00876 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBitmapz1925_8" doxytag="NLMISC::CBitmap::convertToDXTC5" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLMISC::CBitmap::convertToDXTC5 </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Change bitmap format<p> +about DXTC1 to DXTC5 : Does nothing if the format is not DXTC1 about alpha encoding : alpha0 == alpha1 code(x,y) == 7 for every (x,y)<p> +about luminance to alpha and alpha to luminance : the buffer keeps unchanged +<p> +Definition at line <a class="el" href="a05486.html#l00415">415</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +Referenced by <a class="el" href="a05486.html#l00926">convertToType()</a>. +<p> +<div class="fragment"><pre>00416 { +00417 <span class="comment">/* Yoyo: RGB encoding for DXTC1 and DXTC5/3 are actually different!!</span> +00418 <span class="comment"> DXTC3/5 don't rely on sign of color0>color1 to setup special encoding (ie use a special compression for Black)</span> +00419 <span class="comment"> Since this can arise if the src is DXTC1 , we can't simply compress it into DXTC5 without doing a </span> +00420 <span class="comment"> heavy compression...</span> +00421 <span class="comment"> (the inverse is false: DXTC5 to DXTC1 is possible, with maybe swap color0/color1 and bits).</span> +00422 <span class="comment"> */</span> +00423 +00424 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00425 +00426 <span class="comment">/* uint32 i,j;</span> +00427 <span class="comment"></span> +00428 <span class="comment"> if(PixelFormat!=DXTC1) return false;</span> +00429 <span class="comment"></span> +00430 <span class="comment"> for(uint8 m= 0; m<_MipMapCount; m++)</span> +00431 <span class="comment"> {</span> +00432 <span class="comment"> CObjectVector<uint8> dataTmp;</span> +00433 <span class="comment"> dataTmp.resize(2*_Data[m].size());</span> +00434 <span class="comment"> uint dstId= 0;</span> +00435 <span class="comment"></span> +00436 <span class="comment"> for(i=0; i<_Data[m].size(); i+=8)</span> +00437 <span class="comment"> {</span> +00438 <span class="comment"> //64 bits alpha</span> +00439 <span class="comment"> for(j=0; j<8; j++)</span> +00440 <span class="comment"> {</span> +00441 <span class="comment"> dataTmp[dstId++]= 255;</span> +00442 <span class="comment"> }</span> +00443 <span class="comment"></span> +00444 <span class="comment"> //64 bits RGB</span> +00445 <span class="comment"> for(j=0; j<8; j++)</span> +00446 <span class="comment"> {</span> +00447 <span class="comment"> dataTmp[dstId++]= _Data[m][i+j];</span> +00448 <span class="comment"> }</span> +00449 <span class="comment"> }</span> +00450 <span class="comment"> _Data[m] = dataTmp;</span> +00451 <span class="comment"> }</span> +00452 <span class="comment"> PixelFormat = DXTC5;</span> +00453 <span class="comment"> return true;</span> +00454 <span class="comment">*/</span> +00455 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBitmapz1925_9" doxytag="NLMISC::CBitmap::convertToLuminance" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLMISC::CBitmap::convertToLuminance </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05486.html#l00790">790</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +References <a class="el" href="a05486.html#l00677">alphaLuminanceToLuminance()</a>, <a class="el" href="a05486.html#l00664">alphaToLuminance()</a>, <a class="el" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>, <a class="el" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew25">RGBA</a>, and <a class="el" href="a05486.html#l00635">rgbaToLuminance()</a>. +<p> +Referenced by <a class="el" href="a05486.html#l00926">convertToType()</a>. +<p> +<div class="fragment"><pre>00791 { +00792 <span class="keywordflow">switch</span>(<a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>) +00793 { +00794 <span class="keywordflow">case</span> <a class="code" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew25">RGBA</a> : +00795 <span class="keywordflow">return</span> <a class="code" href="a02268.html#NLMISC_1_1CBitmapz1925_16">rgbaToLuminance</a>(); +00796 <span class="keywordflow">break</span>; +00797 +00798 <span class="keywordflow">case</span> <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw8">Luminance</a> : +00799 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00800 <span class="keywordflow">break</span>; +00801 +00802 <span class="keywordflow">case</span> <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw0">Alpha</a> : +00803 <span class="keywordflow">return</span> <a class="code" href="a02268.html#NLMISC_1_1CBitmapz1925_4">alphaToLuminance</a>(); +00804 <span class="keywordflow">break</span>; +00805 +00806 <span class="keywordflow">case</span> <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw1">AlphaLuminance</a> : +00807 <span class="keywordflow">return</span> <a class="code" href="a02268.html#NLMISC_1_1CBitmapz1925_1">alphaLuminanceToLuminance</a>(); +00808 <span class="keywordflow">break</span>; +00809 +00810 <span class="keywordflow">default</span>: +00811 <span class="keywordflow">break</span>; +00812 } +00813 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00814 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBitmapz1925_10" doxytag="NLMISC::CBitmap::convertToRGBA" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLMISC::CBitmap::convertToRGBA </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05486.html#l00882">882</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +References <a class="el" href="a05486.html#l00519">alphaLuminanceToRGBA()</a>, <a class="el" href="a05486.html#l00490">alphaToRGBA()</a>, <a class="el" href="a05486.html#l00965">decompressDXT1()</a>, <a class="el" href="a05486.html#l01090">decompressDXT3()</a>, <a class="el" href="a05486.html#l01200">decompressDXT5()</a>, <a class="el" href="a05486.html#l00462">luminanceToRGBA()</a>, <a class="el" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>, and <a class="el" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew25">RGBA</a>. +<p> +Referenced by <a class="el" href="a05486.html#l02817">blend()</a>, and <a class="el" href="a05486.html#l00926">convertToType()</a>. +<p> +<div class="fragment"><pre>00883 { +00884 <span class="keywordflow">switch</span>(<a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>) +00885 { +00886 <span class="keywordflow">case</span> <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw4">DXTC1</a> : +00887 <span class="keywordflow">return</span> <a class="code" href="a02268.html#NLMISC_1_1CBitmapd1">decompressDXT1</a>(<span class="keyword">false</span>); +00888 <span class="keywordflow">break</span>; +00889 +00890 <span class="keywordflow">case</span> <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw5">DXTC1Alpha</a> : +00891 <span class="keywordflow">return</span> <a class="code" href="a02268.html#NLMISC_1_1CBitmapd1">decompressDXT1</a>(<span class="keyword">true</span>); +00892 <span class="keywordflow">break</span>; +00893 +00894 <span class="keywordflow">case</span> <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw6">DXTC3</a> : +00895 <span class="keywordflow">return</span> <a class="code" href="a02268.html#NLMISC_1_1CBitmapd2">decompressDXT3</a>(); +00896 <span class="keywordflow">break</span>; +00897 +00898 <span class="keywordflow">case</span> <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw7">DXTC5</a> : +00899 <span class="keywordflow">return</span> <a class="code" href="a02268.html#NLMISC_1_1CBitmapd3">decompressDXT5</a>(); +00900 <span class="keywordflow">break</span>; +00901 +00902 <span class="keywordflow">case</span> <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw8">Luminance</a> : +00903 <span class="keywordflow">return</span> <a class="code" href="a02268.html#NLMISC_1_1CBitmapz1925_13">luminanceToRGBA</a>(); +00904 <span class="keywordflow">break</span>; +00905 +00906 <span class="keywordflow">case</span> <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw0">Alpha</a> : +00907 <span class="keywordflow">return</span> <a class="code" href="a02268.html#NLMISC_1_1CBitmapz1925_5">alphaToRGBA</a>(); +00908 <span class="keywordflow">break</span>; +00909 +00910 <span class="keywordflow">case</span> <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw1">AlphaLuminance</a> : +00911 <span class="keywordflow">return</span> <a class="code" href="a02268.html#NLMISC_1_1CBitmapz1925_2">alphaLuminanceToRGBA</a>(); +00912 <span class="keywordflow">break</span>; +00913 <span class="keywordflow">case</span> <a class="code" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew25">RGBA</a>: +00914 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00915 <span class="keywordflow">break</span>; +00916 <span class="keywordflow">default</span>: +00917 <span class="keywordflow">break</span>; +00918 } +00919 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00920 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1ITexturea6" doxytag="NLMISC::CBitmap::convertToType" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLMISC::CBitmap::convertToType </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02268.html#NL3D_1_1ITexturew31">TType</a> </td> + <td class="mdname1" valign="top" nowrap> <em>type</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Convert bitmap to another type conversion to rgba always work. No-op if already rgba. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign=top><em>type</em> </td><td>new type for the bitmap </td></tr> + </table> +</dl> +<dl compact><dt><b>Returns:</b></dt><dd>true if conversion succeeded, false else</dd></dl> + +<p> +Definition at line <a class="el" href="a05486.html#l00926">926</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +References <a class="el" href="a05486.html#l00821">convertToAlpha()</a>, <a class="el" href="a05486.html#l00852">convertToAlphaLuminance()</a>, <a class="el" href="a05486.html#l00415">convertToDXTC5()</a>, <a class="el" href="a05486.html#l00790">convertToLuminance()</a>, <a class="el" href="a05486.html#l00882">convertToRGBA()</a>, <a class="el" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>, <a class="el" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew25">RGBA</a>, and <a class="el" href="a05646.html#l00244">type</a>. +<p> +Referenced by <a class="el" href="a05790.html#l00152">NL3D::CHLSColorTexture::addMask()</a>, <a class="el" href="a05935.html#l00809">NL3D::CLodCharacterTmpBitmap::build()</a>, <a class="el" href="a05567.html#l00070">NL3D::CCoarseMeshBuild::buildBitmap()</a>, <a class="el" href="a06521.html#l00041">NL3D::CTextureFile::buildBitmapFromFile()</a>, <a class="el" href="a05785.html#l00049">NL3D::CHeightMap::buildFromBitmap()</a>, <a class="el" href="a05463.html#l00059">NL3D::CAsyncTextureManager::CTextureEntry::createCoarseBitmap()</a>, <a class="el" href="a06768.html#l01820">NL3D::CZoneLighter::getTexture()</a>, <a class="el" href="a06536.html#l00442">NL3D::CTileBank::getTileNoiseMap()</a>, and <a class="el" href="a05652.html#l00361">NL3D::CDriverGL::setupTextureEx()</a>. +<p> +<div class="fragment"><pre>00927 { +00928 <span class="keywordflow">if</span>(<a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>==<a class="code" href="a04223.html#a581">type</a>) <span class="keywordflow">return</span> <span class="keyword">true</span>; +00929 +00930 <span class="keywordflow">switch</span>(<a class="code" href="a04223.html#a581">type</a>) +00931 { +00932 <span class="keywordflow">case</span> <a class="code" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew25">RGBA</a> : +00933 <span class="keywordflow">return</span> <a class="code" href="a02268.html#NLMISC_1_1CBitmapz1925_10">convertToRGBA</a>(); +00934 <span class="keywordflow">break</span>; +00935 +00936 <span class="keywordflow">case</span> <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw7">DXTC5</a> : +00937 <span class="keywordflow">return</span> <a class="code" href="a02268.html#NLMISC_1_1CBitmapz1925_8">convertToDXTC5</a>(); +00938 <span class="keywordflow">break</span>; +00939 +00940 <span class="keywordflow">case</span> <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw8">Luminance</a> : +00941 <span class="keywordflow">return</span> <a class="code" href="a02268.html#NLMISC_1_1CBitmapz1925_9">convertToLuminance</a>(); +00942 <span class="keywordflow">break</span>; +00943 +00944 <span class="keywordflow">case</span> <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw0">Alpha</a> : +00945 <span class="keywordflow">return</span> <a class="code" href="a02268.html#NLMISC_1_1CBitmapz1925_6">convertToAlpha</a>(); +00946 <span class="keywordflow">break</span>; +00947 +00948 <span class="keywordflow">case</span> <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw1">AlphaLuminance</a> : +00949 <span class="keywordflow">return</span> <a class="code" href="a02268.html#NLMISC_1_1CBitmapz1925_7">convertToAlphaLuminance</a>(); +00950 <span class="keywordflow">break</span>; +00951 +00952 <span class="keywordflow">default</span>: +00953 <span class="keywordflow">break</span>; +00954 } +00955 +00956 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00957 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBitmapd1" doxytag="NLMISC::CBitmap::decompressDXT1" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLMISC::CBitmap::decompressDXT1 </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">bool </td> + <td class="mdname1" valign="top" nowrap> <em>alpha</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Decompress bitmap compressed with S3TC DXT1 algorithm. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign=top><em>alpha</em> </td><td>if alpha is true there's alpha.</td></tr> + </table> +</dl> + +<p> +Definition at line <a class="el" href="a05486.html#l00965">965</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +References <a class="el" href="a05487.html#l00093">_MipMapCount</a>, <a class="el" href="a06340.html#l00340">NLMISC::CRGBA::A</a>, <a class="el" href="a05646.html#l01173">alpha</a>, <a class="el" href="a06340.html#l00104">NLMISC::CRGBA::blendFromui()</a>, <a class="el" href="a05646.html#l01013">height</a>, <a class="el" href="a05487.html#l00070">NLMISC::MAX_MIPMAP</a>, <a class="el" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>, <a class="el" href="a06340.html#l00334">NLMISC::CRGBA::R</a>, <a class="el" href="a06116.html#l00142">NLMISC::CObjectVector< T, EnableObjectBehavior >::resize()</a>, <a class="el" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew25">RGBA</a>, <a class="el" href="a06339.html#l00066">NLMISC::CRGBA::set()</a>, <a class="el" href="a06116.html#l00184">NLMISC::CObjectVector< uint8 >::size()</a>, <a class="el" href="a06116.html#l00184">NLMISC::CObjectVector< T, EnableObjectBehavior >::size()</a>, <a class="el" href="a05646.html#l01124">src</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00098">uint16</a>, <a class="el" href="a05981.html#l00100">uint32</a>, <a class="el" href="a05981.html#l00096">uint8</a>, <a class="el" href="a05486.html#l01350">uncompress()</a>, <a class="el" href="a05646.html#l01013">width</a>, <a class="el" href="a05646.html#l00236">x</a>, and <a class="el" href="a05646.html#l00236">y</a>. +<p> +Referenced by <a class="el" href="a05486.html#l00882">convertToRGBA()</a>. +<p> +<div class="fragment"><pre>00966 { +00967 <a class="code" href="a04558.html#a11">uint32</a> i,j,k; +00968 <a class="code" href="a03337.html">NLMISC::CRGBA</a> c[4]; +00969 CObjectVector<uint8> dataTmp[<a class="code" href="a05378.html#a43">MAX_MIPMAP</a>]; +00970 +00971 <a class="code" href="a04558.html#a11">uint32</a> <a class="code" href="a04223.html#a632">width</a>= <a class="code" href="a02268.html#NL3D_1_1ITexturep5">_Width</a>; +00972 <a class="code" href="a04558.html#a11">uint32</a> <a class="code" href="a04223.html#a633">height</a>= <a class="code" href="a02268.html#NL3D_1_1ITexturep1">_Height</a>; +00973 +00974 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a7">uint8</a> m= 0; m<<a class="code" href="a02268.html#NL3D_1_1ITexturep3">_MipMapCount</a>; m++) +00975 { +00976 <a class="code" href="a04558.html#a11">uint32</a> wtmp, htmp; +00977 <span class="keywordflow">if</span>(<a class="code" href="a04223.html#a632">width</a><4) +00978 wtmp = 4; +00979 <span class="keywordflow">else</span> +00980 wtmp = <a class="code" href="a04223.html#a632">width</a>; +00981 <span class="keywordflow">if</span>(<a class="code" href="a04223.html#a633">height</a> < 4) +00982 htmp = 4; +00983 <span class="keywordflow">else</span> +00984 htmp = <a class="code" href="a04223.html#a633">height</a>; +00985 <a class="code" href="a04558.html#a11">uint32</a> mipMapSz = wtmp*htmp*4; +00986 dataTmp[m].resize(mipMapSz); +00987 <span class="keywordflow">if</span>(dataTmp[m].size()<mipMapSz) +00988 { +00989 <span class="keywordflow">throw</span> EAllocationFailure(); +00990 } +00991 <a class="code" href="a04558.html#a11">uint32</a> wBlockCount= wtmp/4; +00992 +00993 +00994 +00995 <span class="keywordflow">for</span>(i=0; i < <a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[m].size(); i+=8) +00996 { +00997 <a class="code" href="a04558.html#a9">uint16</a> color0; +00998 <a class="code" href="a04558.html#a9">uint16</a> color1; +00999 <a class="code" href="a04558.html#a11">uint32</a> bits; +01000 memcpy(&color0,&_Data[m][i],2); +01001 memcpy(&color1,&_Data[m][i+2],2); +01002 memcpy(&bits,&_Data[m][i+4],4); +01003 +01004 <a class="code" href="a02268.html#NLMISC_1_1CBitmaph0">uncompress</a>(color0,c[0]); +01005 <a class="code" href="a02268.html#NLMISC_1_1CBitmaph0">uncompress</a>(color1,c[1]); +01006 +01007 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a663">alpha</a>) +01008 { +01009 c[0].<a class="code" href="a03337.html#NLMISC_1_1CRGBAo0">A</a>= 0; +01010 c[1].<a class="code" href="a03337.html#NLMISC_1_1CRGBAo0">A</a>= 0; +01011 c[2].<a class="code" href="a03337.html#NLMISC_1_1CRGBAo0">A</a>= 0; +01012 c[3].<a class="code" href="a03337.html#NLMISC_1_1CRGBAo0">A</a>= 0; +01013 } +01014 <span class="keywordflow">else</span> +01015 { +01016 c[0].<a class="code" href="a03337.html#NLMISC_1_1CRGBAo0">A</a>= 255; +01017 c[1].<a class="code" href="a03337.html#NLMISC_1_1CRGBAo0">A</a>= 255; +01018 c[2].<a class="code" href="a03337.html#NLMISC_1_1CRGBAo0">A</a>= 255; +01019 c[3].<a class="code" href="a03337.html#NLMISC_1_1CRGBAo0">A</a>= 255; +01020 } +01021 +01022 <span class="keywordflow">if</span>(color0>color1) +01023 { +01024 c[2].<a class="code" href="a03337.html#NLMISC_1_1CRGBAa3">blendFromui</a>(c[0],c[1],85); +01025 <span class="keywordflow">if</span>(<a class="code" href="a04223.html#a663">alpha</a>) c[2].<a class="code" href="a03337.html#NLMISC_1_1CRGBAo0">A</a>= 255; +01026 +01027 c[3].<a class="code" href="a03337.html#NLMISC_1_1CRGBAa3">blendFromui</a>(c[0],c[1],171); +01028 <span class="keywordflow">if</span>(<a class="code" href="a04223.html#a663">alpha</a>) c[3].<a class="code" href="a03337.html#NLMISC_1_1CRGBAo0">A</a>= 255; +01029 } +01030 <span class="keywordflow">else</span> +01031 { +01032 c[2].<a class="code" href="a03337.html#NLMISC_1_1CRGBAa3">blendFromui</a>(c[0],c[1],128); +01033 <span class="keywordflow">if</span>(<a class="code" href="a04223.html#a663">alpha</a>) c[2].<a class="code" href="a03337.html#NLMISC_1_1CRGBAo0">A</a>= 255; +01034 +01035 c[3].<a class="code" href="a03337.html#NLMISC_1_1CRGBAa14">set</a>(0,0,0,0); +01036 } +01037 +01038 <span class="comment">// computing the 16 RGBA of the block</span> +01039 +01040 <a class="code" href="a04558.html#a11">uint32</a> blockNum= i/8; <span class="comment">//(64 bits)</span> +01041 <span class="comment">// <previous blocks in above lines> * 4 (rows) * _Width (columns) + 4pix*4rgba*<same line previous blocks></span> +01042 <a class="code" href="a04558.html#a11">uint32</a> pixelsCount= 4*(blockNum/wBlockCount)*wtmp*4 + 4*4*(blockNum%wBlockCount); +01043 <span class="keywordflow">for</span>(j=0; j<4; j++) +01044 { +01045 <span class="keywordflow">for</span>(k=0; k<4; k++) +01046 { +01047 dataTmp[m][pixelsCount + j*wtmp*4 + 4*k]= c[bits&3].<a class="code" href="a03337.html#NLMISC_1_1CRGBAo3">R</a>; +01048 dataTmp[m][pixelsCount + j*wtmp*4 + 4*k+1]= c[bits&3].G; +01049 dataTmp[m][pixelsCount + j*wtmp*4 + 4*k+2]= c[bits&3].B; +01050 dataTmp[m][pixelsCount + j*wtmp*4 + 4*k+3]= c[bits&3].A; +01051 bits>>=2; +01052 } +01053 } +01054 } +01055 +01056 <span class="comment">// Copy result into the mipmap level.</span> +01057 <span class="keywordflow">if</span>(wtmp==<a class="code" href="a04223.html#a632">width</a> && htmp==<a class="code" href="a04223.html#a633">height</a>) +01058 { +01059 <span class="comment">// For mipmaps level >4 pixels.</span> +01060 _Data[m]= dataTmp[m]; +01061 } +01062 <span class="keywordflow">else</span> +01063 { +01064 <span class="comment">// For last mipmaps, level <4 pixels.</span> +01065 _Data[m].resize(width*height*4); +01066 CRGBA *<a class="code" href="a04223.html#a652">src</a>= (CRGBA*)&dataTmp[m][0]; +01067 CRGBA *dst= (CRGBA*)&_Data[m][0]; +01068 <a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a572">x</a>,<a class="code" href="a04223.html#a573">y</a>; +01069 <span class="keywordflow">for</span>(<a class="code" href="a04223.html#a573">y</a>=0;<a class="code" href="a04223.html#a573">y</a><<a class="code" href="a04223.html#a633">height</a>;<a class="code" href="a04223.html#a573">y</a>++) +01070 { +01071 <span class="keywordflow">for</span>(<a class="code" href="a04223.html#a572">x</a>=0;<a class="code" href="a04223.html#a572">x</a><<a class="code" href="a04223.html#a632">width</a>;<a class="code" href="a04223.html#a572">x</a>++) +01072 dst[<a class="code" href="a04223.html#a573">y</a>*<a class="code" href="a04223.html#a632">width</a>+<a class="code" href="a04223.html#a572">x</a>]= <a class="code" href="a04223.html#a652">src</a>[<a class="code" href="a04223.html#a573">y</a>*wtmp+<a class="code" href="a04223.html#a572">x</a>]; +01073 } +01074 } +01075 +01076 <span class="comment">// Next mipmap size.</span> +01077 <a class="code" href="a04223.html#a632">width</a> = (<a class="code" href="a04223.html#a632">width</a>+1)/2; +01078 <a class="code" href="a04223.html#a633">height</a> = (<a class="code" href="a04223.html#a633">height</a>+1)/2; +01079 } +01080 <a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a> = <a class="code" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew25">RGBA</a>; +01081 <span class="keywordflow">return</span> <span class="keyword">true</span>; +01082 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBitmapd2" doxytag="NLMISC::CBitmap::decompressDXT3" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLMISC::CBitmap::decompressDXT3 </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Decompress bitmap compressed with S3TC DXT3 algorithm. <dl compact><dt><b>Exceptions:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign=top><em>EAllocationFailure</em> </td><td>: can't allocate memory.</td></tr> + </table> +</dl> + +<p> +Definition at line <a class="el" href="a05486.html#l01090">1090</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +References <a class="el" href="a05487.html#l00093">_MipMapCount</a>, <a class="el" href="a05646.html#l01173">alpha</a>, <a class="el" href="a06340.html#l00104">NLMISC::CRGBA::blendFromui()</a>, <a class="el" href="a05646.html#l01013">height</a>, <a class="el" href="a05487.html#l00070">NLMISC::MAX_MIPMAP</a>, <a class="el" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>, <a class="el" href="a06340.html#l00334">NLMISC::CRGBA::R</a>, <a class="el" href="a06116.html#l00142">NLMISC::CObjectVector< T, EnableObjectBehavior >::resize()</a>, <a class="el" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew25">RGBA</a>, <a class="el" href="a06116.html#l00184">NLMISC::CObjectVector< uint8 >::size()</a>, <a class="el" href="a06116.html#l00184">NLMISC::CObjectVector< T, EnableObjectBehavior >::size()</a>, <a class="el" href="a05646.html#l01124">src</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00098">uint16</a>, <a class="el" href="a05981.html#l00100">uint32</a>, <a class="el" href="a05981.html#l00102">uint64</a>, <a class="el" href="a05981.html#l00096">uint8</a>, <a class="el" href="a05486.html#l01350">uncompress()</a>, <a class="el" href="a05646.html#l01013">width</a>, <a class="el" href="a05646.html#l00236">x</a>, and <a class="el" href="a05646.html#l00236">y</a>. +<p> +Referenced by <a class="el" href="a05486.html#l00882">convertToRGBA()</a>. +<p> +<div class="fragment"><pre>01091 { +01092 <a class="code" href="a04558.html#a11">uint32</a> i,j,k; +01093 <a class="code" href="a03337.html">NLMISC::CRGBA</a> c[4]; +01094 CObjectVector<uint8> dataTmp[<a class="code" href="a05378.html#a43">MAX_MIPMAP</a>]; +01095 +01096 <a class="code" href="a04558.html#a11">uint32</a> <a class="code" href="a04223.html#a632">width</a>= <a class="code" href="a02268.html#NL3D_1_1ITexturep5">_Width</a>; +01097 <a class="code" href="a04558.html#a11">uint32</a> <a class="code" href="a04223.html#a633">height</a>= <a class="code" href="a02268.html#NL3D_1_1ITexturep1">_Height</a>; +01098 +01099 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a7">uint8</a> m= 0; m<<a class="code" href="a02268.html#NL3D_1_1ITexturep3">_MipMapCount</a>; m++) +01100 { +01101 <a class="code" href="a04558.html#a11">uint32</a> wtmp, htmp; +01102 <span class="keywordflow">if</span>(<a class="code" href="a04223.html#a632">width</a><4) +01103 wtmp = 4; +01104 <span class="keywordflow">else</span> +01105 wtmp = <a class="code" href="a04223.html#a632">width</a>; +01106 <span class="keywordflow">if</span>(<a class="code" href="a04223.html#a633">height</a> < 4) +01107 htmp = 4; +01108 <span class="keywordflow">else</span> +01109 htmp = <a class="code" href="a04223.html#a633">height</a>; +01110 <a class="code" href="a04558.html#a11">uint32</a> mipMapSz = wtmp*htmp*4; +01111 dataTmp[m].resize(mipMapSz); +01112 <span class="keywordflow">if</span>(dataTmp[m].size()<mipMapSz) +01113 { +01114 <span class="keywordflow">throw</span> EAllocationFailure(); +01115 } +01116 <a class="code" href="a04558.html#a11">uint32</a> wBlockCount= wtmp/4; +01117 +01118 +01119 <span class="keywordflow">for</span>(i=0; i < <a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[m].size(); i+=16) +01120 { +01121 <a class="code" href="a04558.html#a7">uint8</a> <a class="code" href="a04223.html#a663">alpha</a>[16]; +01122 <a class="code" href="a04558.html#a13">uint64</a> alphatmp; +01123 memcpy(&alphatmp,&_Data[m][i],8); +01124 +01125 <span class="keywordflow">for</span>(j=0; j<16; j++) +01126 { +01127 <a class="code" href="a04558.html#a7">uint8</a> a= (<a class="code" href="a04558.html#a7">uint8</a>)(alphatmp&15); +01128 <span class="comment">// expand to 0-255.</span> +01129 <a class="code" href="a04223.html#a663">alpha</a>[j]= a+(a<<4); +01130 alphatmp>>=4; +01131 } +01132 +01133 +01134 <a class="code" href="a04558.html#a9">uint16</a> color0; +01135 <a class="code" href="a04558.html#a9">uint16</a> color1; +01136 <a class="code" href="a04558.html#a11">uint32</a> bits; +01137 memcpy(&color0,&_Data[m][i+8],2); +01138 memcpy(&color1,&_Data[m][i+10],2); +01139 memcpy(&bits,&_Data[m][i+12],4); +01140 +01141 <a class="code" href="a02268.html#NLMISC_1_1CBitmaph0">uncompress</a>(color0,c[0]); +01142 <a class="code" href="a02268.html#NLMISC_1_1CBitmaph0">uncompress</a>(color1,c[1]); +01143 +01144 <span class="comment">// ignore color0>color1 for DXT3 and DXT5.</span> +01145 c[2].<a class="code" href="a03337.html#NLMISC_1_1CRGBAa3">blendFromui</a>(c[0],c[1],85); +01146 c[3].<a class="code" href="a03337.html#NLMISC_1_1CRGBAa3">blendFromui</a>(c[0],c[1],171); +01147 +01148 <span class="comment">// computing the 16 RGBA of the block</span> +01149 +01150 <a class="code" href="a04558.html#a11">uint32</a> blockNum= i/16; <span class="comment">//(128 bits)</span> +01151 <span class="comment">// <previous blocks in above lines> * 4 (rows) * wtmp (columns) + 4pix*4rgba*<same line previous blocks></span> +01152 <a class="code" href="a04558.html#a11">uint32</a> pixelsCount= 4*(blockNum/wBlockCount)*wtmp*4 + 4*4*(blockNum%wBlockCount); +01153 <span class="keywordflow">for</span>(j=0; j<4; j++) +01154 { +01155 <span class="keywordflow">for</span>(k=0; k<4; k++) +01156 { +01157 dataTmp[m][pixelsCount + j*wtmp*4 + 4*k]= c[bits&3].<a class="code" href="a03337.html#NLMISC_1_1CRGBAo3">R</a>; +01158 dataTmp[m][pixelsCount + j*wtmp*4 + 4*k+1]= c[bits&3].G; +01159 dataTmp[m][pixelsCount + j*wtmp*4 + 4*k+2]= c[bits&3].B; +01160 dataTmp[m][pixelsCount + j*wtmp*4 + 4*k+3]= <a class="code" href="a04223.html#a663">alpha</a>[4*j+k]; +01161 bits>>=2; +01162 } +01163 } +01164 } +01165 +01166 <span class="comment">// Copy result into the mipmap level.</span> +01167 <span class="keywordflow">if</span>(wtmp==<a class="code" href="a04223.html#a632">width</a> && htmp==<a class="code" href="a04223.html#a633">height</a>) +01168 { +01169 <span class="comment">// For mipmaps level >4 pixels.</span> +01170 _Data[m]= dataTmp[m]; +01171 } +01172 <span class="keywordflow">else</span> +01173 { +01174 <span class="comment">// For last mipmaps, level <4 pixels.</span> +01175 _Data[m].resize(width*height*4); +01176 CRGBA *<a class="code" href="a04223.html#a652">src</a>= (CRGBA*)&dataTmp[m][0]; +01177 CRGBA *dst= (CRGBA*)&_Data[m][0]; +01178 <a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a572">x</a>,<a class="code" href="a04223.html#a573">y</a>; +01179 <span class="keywordflow">for</span>(<a class="code" href="a04223.html#a573">y</a>=0;<a class="code" href="a04223.html#a573">y</a><<a class="code" href="a04223.html#a633">height</a>;<a class="code" href="a04223.html#a573">y</a>++) +01180 { +01181 <span class="keywordflow">for</span>(<a class="code" href="a04223.html#a572">x</a>=0;<a class="code" href="a04223.html#a572">x</a><<a class="code" href="a04223.html#a632">width</a>;<a class="code" href="a04223.html#a572">x</a>++) +01182 dst[<a class="code" href="a04223.html#a573">y</a>*<a class="code" href="a04223.html#a632">width</a>+<a class="code" href="a04223.html#a572">x</a>]= <a class="code" href="a04223.html#a652">src</a>[<a class="code" href="a04223.html#a573">y</a>*wtmp+<a class="code" href="a04223.html#a572">x</a>]; +01183 } +01184 } +01185 +01186 <span class="comment">// Next mipmap size.</span> +01187 <a class="code" href="a04223.html#a632">width</a> = (<a class="code" href="a04223.html#a632">width</a>+1)/2; +01188 <a class="code" href="a04223.html#a633">height</a> = (<a class="code" href="a04223.html#a633">height</a>+1)/2; +01189 } +01190 <a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a> = <a class="code" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew25">RGBA</a>; +01191 <span class="keywordflow">return</span> <span class="keyword">true</span>; +01192 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBitmapd3" doxytag="NLMISC::CBitmap::decompressDXT5" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLMISC::CBitmap::decompressDXT5 </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Decompress bitmap compressed with S3TC DXT3 algorithm. <dl compact><dt><b>Exceptions:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign=top><em>EAllocationFailure</em> </td><td>: can't allocate memory.</td></tr> + </table> +</dl> + +<p> +Definition at line <a class="el" href="a05486.html#l01200">1200</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +References <a class="el" href="a05487.html#l00093">_MipMapCount</a>, <a class="el" href="a05646.html#l01173">alpha</a>, <a class="el" href="a05486.html#l01338">blend()</a>, <a class="el" href="a06340.html#l00104">NLMISC::CRGBA::blendFromui()</a>, <a class="el" href="a05646.html#l01013">height</a>, <a class="el" href="a05487.html#l00070">NLMISC::MAX_MIPMAP</a>, <a class="el" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>, <a class="el" href="a06340.html#l00334">NLMISC::CRGBA::R</a>, <a class="el" href="a06116.html#l00142">NLMISC::CObjectVector< T, EnableObjectBehavior >::resize()</a>, <a class="el" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew25">RGBA</a>, <a class="el" href="a06116.html#l00184">NLMISC::CObjectVector< uint8 >::size()</a>, <a class="el" href="a06116.html#l00184">NLMISC::CObjectVector< T, EnableObjectBehavior >::size()</a>, <a class="el" href="a05646.html#l01124">src</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00098">uint16</a>, <a class="el" href="a05981.html#l00100">uint32</a>, <a class="el" href="a05981.html#l00102">uint64</a>, <a class="el" href="a05981.html#l00096">uint8</a>, <a class="el" href="a05486.html#l01350">uncompress()</a>, <a class="el" href="a05646.html#l01013">width</a>, <a class="el" href="a05646.html#l00236">x</a>, and <a class="el" href="a05646.html#l00236">y</a>. +<p> +Referenced by <a class="el" href="a05486.html#l00882">convertToRGBA()</a>. +<p> +<div class="fragment"><pre>01201 { +01202 <a class="code" href="a04558.html#a11">uint32</a> i,j,k; +01203 <a class="code" href="a03337.html">NLMISC::CRGBA</a> c[4]; +01204 CObjectVector<uint8> dataTmp[<a class="code" href="a05378.html#a43">MAX_MIPMAP</a>]; +01205 +01206 <a class="code" href="a04558.html#a11">uint32</a> <a class="code" href="a04223.html#a632">width</a>= <a class="code" href="a02268.html#NL3D_1_1ITexturep5">_Width</a>; +01207 <a class="code" href="a04558.html#a11">uint32</a> <a class="code" href="a04223.html#a633">height</a>= <a class="code" href="a02268.html#NL3D_1_1ITexturep1">_Height</a>; +01208 +01209 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a7">uint8</a> m= 0; m<<a class="code" href="a02268.html#NL3D_1_1ITexturep3">_MipMapCount</a>; m++) +01210 { +01211 <a class="code" href="a04558.html#a11">uint32</a> wtmp, htmp; +01212 <span class="keywordflow">if</span>(<a class="code" href="a04223.html#a632">width</a><4) +01213 wtmp = 4; +01214 <span class="keywordflow">else</span> +01215 wtmp = <a class="code" href="a04223.html#a632">width</a>; +01216 <span class="keywordflow">if</span>(<a class="code" href="a04223.html#a633">height</a> < 4) +01217 htmp = 4; +01218 <span class="keywordflow">else</span> +01219 htmp = <a class="code" href="a04223.html#a633">height</a>; +01220 <a class="code" href="a04558.html#a11">uint32</a> mipMapSz = wtmp*htmp*4; +01221 dataTmp[m].resize(mipMapSz); +01222 <span class="keywordflow">if</span>(dataTmp[m].size()<mipMapSz) +01223 { +01224 <span class="keywordflow">throw</span> EAllocationFailure(); +01225 } +01226 <a class="code" href="a04558.html#a11">uint32</a> wBlockCount= wtmp/4; +01227 +01228 +01229 +01230 <span class="keywordflow">for</span>(i=0; i < <a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[m].size(); i+=16) +01231 { +01232 <a class="code" href="a04558.html#a13">uint64</a> bitsAlpha; +01233 memcpy(&bitsAlpha,&_Data[m][i],8); +01234 bitsAlpha>>= 16; +01235 +01236 <a class="code" href="a04558.html#a11">uint32</a> <a class="code" href="a04223.html#a663">alpha</a>[8]; +01237 <a class="code" href="a04223.html#a663">alpha</a>[0]= _Data[m][i+0]; +01238 <a class="code" href="a04223.html#a663">alpha</a>[1]= _Data[m][i+1]; +01239 +01240 <span class="keywordflow">if</span>(<a class="code" href="a04223.html#a663">alpha</a>[0]><a class="code" href="a04223.html#a663">alpha</a>[1]) +01241 { +01242 <a class="code" href="a04223.html#a663">alpha</a>[2]= <a class="code" href="a02268.html#NLMISC_1_1CBitmapd0">blend</a>(alpha[0], alpha[1], 219); +01243 <a class="code" href="a04223.html#a663">alpha</a>[3]= <a class="code" href="a02268.html#NLMISC_1_1CBitmapd0">blend</a>(alpha[0], alpha[1], 183); +01244 <a class="code" href="a04223.html#a663">alpha</a>[4]= <a class="code" href="a02268.html#NLMISC_1_1CBitmapd0">blend</a>(alpha[0], alpha[1], 146); +01245 <a class="code" href="a04223.html#a663">alpha</a>[5]= <a class="code" href="a02268.html#NLMISC_1_1CBitmapd0">blend</a>(alpha[0], alpha[1], 110); +01246 <a class="code" href="a04223.html#a663">alpha</a>[6]= <a class="code" href="a02268.html#NLMISC_1_1CBitmapd0">blend</a>(alpha[0], alpha[1], 73); +01247 <a class="code" href="a04223.html#a663">alpha</a>[7]= <a class="code" href="a02268.html#NLMISC_1_1CBitmapd0">blend</a>(alpha[0], alpha[1], 37); +01248 } +01249 <span class="keywordflow">else</span> +01250 { +01251 <a class="code" href="a04223.html#a663">alpha</a>[2]= <a class="code" href="a02268.html#NLMISC_1_1CBitmapd0">blend</a>(alpha[0], alpha[1], 204); +01252 <a class="code" href="a04223.html#a663">alpha</a>[3]= <a class="code" href="a02268.html#NLMISC_1_1CBitmapd0">blend</a>(alpha[0], alpha[1], 154); +01253 <a class="code" href="a04223.html#a663">alpha</a>[4]= <a class="code" href="a02268.html#NLMISC_1_1CBitmapd0">blend</a>(alpha[0], alpha[1], 102); +01254 <a class="code" href="a04223.html#a663">alpha</a>[5]= <a class="code" href="a02268.html#NLMISC_1_1CBitmapd0">blend</a>(alpha[0], alpha[1], 51); +01255 <a class="code" href="a04223.html#a663">alpha</a>[6]= 0; +01256 <a class="code" href="a04223.html#a663">alpha</a>[7]= 255; +01257 } +01258 +01259 <a class="code" href="a04558.html#a7">uint8</a> codeAlpha[16]; +01260 <span class="keywordflow">for</span>(j=0; j<16; j++) +01261 { +01262 codeAlpha[j] = (<a class="code" href="a04558.html#a7">uint8</a>)bitsAlpha & 7; +01263 bitsAlpha>>=3; +01264 } +01265 +01266 +01267 <a class="code" href="a04558.html#a9">uint16</a> color0; +01268 <a class="code" href="a04558.html#a9">uint16</a> color1; +01269 <a class="code" href="a04558.html#a11">uint32</a> bits; +01270 memcpy(&color0,&_Data[m][i+8],2); +01271 memcpy(&color1,&_Data[m][i+10],2); +01272 memcpy(&bits,&_Data[m][i+12],4); +01273 +01274 <a class="code" href="a02268.html#NLMISC_1_1CBitmaph0">uncompress</a>(color0,c[0]); +01275 <a class="code" href="a02268.html#NLMISC_1_1CBitmaph0">uncompress</a>(color1,c[1]); +01276 +01277 <span class="comment">// ignore color0>color1 for DXT3 and DXT5.</span> +01278 c[2].<a class="code" href="a03337.html#NLMISC_1_1CRGBAa3">blendFromui</a>(c[0],c[1],85); +01279 c[3].<a class="code" href="a03337.html#NLMISC_1_1CRGBAa3">blendFromui</a>(c[0],c[1],171); +01280 +01281 <span class="comment">// computing the 16 RGBA of the block</span> +01282 +01283 <a class="code" href="a04558.html#a11">uint32</a> blockNum= i/16; <span class="comment">//(128 bits)</span> +01284 +01285 <span class="comment">// <previous blocks in above lines> * 4 (rows) * wtmp (columns) + 4pix*<same line previous blocks></span> +01286 <a class="code" href="a04558.html#a11">uint32</a> pixelsCount= (blockNum/wBlockCount)*wtmp*4 + 4*(blockNum%wBlockCount); +01287 <span class="comment">// *sizeof(RGBA)</span> +01288 pixelsCount*=4; +01289 <span class="keywordflow">for</span>(j=0; j<4; j++) +01290 { +01291 <span class="keywordflow">for</span>(k=0; k<4; k++) +01292 { +01293 dataTmp[m][pixelsCount + (j*wtmp+k)*4 +0]= c[bits&3].<a class="code" href="a03337.html#NLMISC_1_1CRGBAo3">R</a>; +01294 dataTmp[m][pixelsCount + (j*wtmp+k)*4 +1]= c[bits&3].G; +01295 dataTmp[m][pixelsCount + (j*wtmp+k)*4 +2]= c[bits&3].B; +01296 dataTmp[m][pixelsCount + (j*wtmp+k)*4 +3]= (<a class="code" href="a04558.html#a7">uint8</a>) <a class="code" href="a04223.html#a663">alpha</a>[codeAlpha[4*j+k]]; +01297 bits>>=2; +01298 } +01299 } +01300 +01301 } +01302 +01303 <span class="comment">// Copy result into the mipmap level.</span> +01304 <span class="keywordflow">if</span>(wtmp==<a class="code" href="a04223.html#a632">width</a> && htmp==<a class="code" href="a04223.html#a633">height</a>) +01305 { +01306 <span class="comment">// For mipmaps level >4 pixels.</span> +01307 _Data[m]= dataTmp[m]; +01308 } +01309 <span class="keywordflow">else</span> +01310 { +01311 <span class="comment">// For last mipmaps, level <4 pixels.</span> +01312 _Data[m].resize(width*height*4); +01313 CRGBA *<a class="code" href="a04223.html#a652">src</a>= (CRGBA*)&dataTmp[m][0]; +01314 CRGBA *dst= (CRGBA*)&_Data[m][0]; +01315 <a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a572">x</a>,<a class="code" href="a04223.html#a573">y</a>; +01316 <span class="keywordflow">for</span>(<a class="code" href="a04223.html#a573">y</a>=0;<a class="code" href="a04223.html#a573">y</a><<a class="code" href="a04223.html#a633">height</a>;<a class="code" href="a04223.html#a573">y</a>++) +01317 { +01318 <span class="keywordflow">for</span>(<a class="code" href="a04223.html#a572">x</a>=0;<a class="code" href="a04223.html#a572">x</a><<a class="code" href="a04223.html#a632">width</a>;<a class="code" href="a04223.html#a572">x</a>++) +01319 dst[<a class="code" href="a04223.html#a573">y</a>*<a class="code" href="a04223.html#a632">width</a>+<a class="code" href="a04223.html#a572">x</a>]= <a class="code" href="a04223.html#a652">src</a>[<a class="code" href="a04223.html#a573">y</a>*wtmp+<a class="code" href="a04223.html#a572">x</a>]; +01320 } +01321 } +01322 +01323 <span class="comment">// Next mipmap size.</span> +01324 <a class="code" href="a04223.html#a632">width</a> = (<a class="code" href="a04223.html#a632">width</a>+1)/2; +01325 <a class="code" href="a04223.html#a633">height</a> = (<a class="code" href="a04223.html#a633">height</a>+1)/2; +01326 } +01327 <a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a> = <a class="code" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew25">RGBA</a>; +01328 <span class="keywordflow">return</span> <span class="keyword">true</span>; +01329 +01330 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1ITexturea7" doxytag="NLMISC::CBitmap::flipH" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CBitmap::flipH </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Horizontal flip (all the columns are flipped) +<p> +Definition at line <a class="el" href="a05486.html#l02682">2682</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +References <a class="el" href="a05487.html#l00093">_MipMapCount</a>, <a class="el" href="a05486.html#l01422">buildMipMaps()</a>, <a class="el" href="a05486.html#l01388">getHeight()</a>, <a class="el" href="a05486.html#l01363">getWidth()</a>, <a class="el" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>, <a class="el" href="a05486.html#l01493">releaseMipMaps()</a>, <a class="el" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew25">RGBA</a>, and <a class="el" href="a05981.html#l00099">sint32</a>. +<p> +<div class="fragment"><pre>02683 { +02684 <span class="keywordflow">if</span> (<a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a> != <a class="code" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew25">RGBA</a>) +02685 <span class="keywordflow">return</span>; +02686 +02687 <a class="code" href="a04558.html#a10">sint32</a> nWidth = <a class="code" href="a02268.html#NL3D_1_1ITexturea20">getWidth</a>(0); +02688 <a class="code" href="a04558.html#a10">sint32</a> nHeight = <a class="code" href="a02268.html#NL3D_1_1ITexturea12">getHeight</a>(0); +02689 <a class="code" href="a04558.html#a10">sint32</a> i, j; +02690 <a class="code" href="a03337.html">NLMISC::CRGBA</a> *pBitmap = (<a class="code" href="a03337.html">NLMISC::CRGBA</a>*)&<a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[0][0]; +02691 <span class="keywordtype">bool</span> needRebuild = <span class="keyword">false</span>; +02692 CRGBA temp; +02693 +02694 <span class="keywordflow">if</span>(<a class="code" href="a02268.html#NL3D_1_1ITexturep3">_MipMapCount</a>>1) +02695 needRebuild = <span class="keyword">true</span>; +02696 <a class="code" href="a02268.html#NL3D_1_1ITexturea30">releaseMipMaps</a>(); +02697 +02698 <span class="keywordflow">for</span>( i = 0; i < nHeight; ++i ) +02699 <span class="keywordflow">for</span>( j = 0; j < nWidth/2; ++j ) +02700 { +02701 temp = pBitmap[i*nWidth+j]; +02702 pBitmap[i*nWidth+j] = pBitmap[i*nWidth+nWidth-j-1]; +02703 pBitmap[i*nWidth+nWidth-j-1] = temp; +02704 } +02705 +02706 <span class="comment">// Rebuilding mipmaps</span> +02707 <span class="keywordflow">if</span>(needRebuild) +02708 { +02709 <a class="code" href="a02268.html#NL3D_1_1ITexturea3">buildMipMaps</a>(); +02710 } +02711 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1ITexturea8" doxytag="NLMISC::CBitmap::flipV" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CBitmap::flipV </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Vertical flip (all the rows are flipped) +<p> +Definition at line <a class="el" href="a05486.html#l02714">2714</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +References <a class="el" href="a05487.html#l00093">_MipMapCount</a>, <a class="el" href="a05486.html#l01422">buildMipMaps()</a>, <a class="el" href="a05486.html#l01388">getHeight()</a>, <a class="el" href="a05486.html#l01363">getWidth()</a>, <a class="el" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>, <a class="el" href="a05486.html#l01493">releaseMipMaps()</a>, <a class="el" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew25">RGBA</a>, and <a class="el" href="a05981.html#l00099">sint32</a>. +<p> +<div class="fragment"><pre>02715 { +02716 <span class="keywordflow">if</span> (<a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a> != <a class="code" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew25">RGBA</a>) +02717 <span class="keywordflow">return</span>; +02718 +02719 <a class="code" href="a04558.html#a10">sint32</a> nWidth = <a class="code" href="a02268.html#NL3D_1_1ITexturea20">getWidth</a>(0); +02720 <a class="code" href="a04558.html#a10">sint32</a> nHeight = <a class="code" href="a02268.html#NL3D_1_1ITexturea12">getHeight</a>(0); +02721 <a class="code" href="a04558.html#a10">sint32</a> i, j; +02722 <a class="code" href="a03337.html">NLMISC::CRGBA</a> *pBitmap = (<a class="code" href="a03337.html">NLMISC::CRGBA</a>*)&<a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[0][0]; +02723 <span class="keywordtype">bool</span> needRebuild = <span class="keyword">false</span>; +02724 CRGBA temp; +02725 +02726 <span class="keywordflow">if</span>(<a class="code" href="a02268.html#NL3D_1_1ITexturep3">_MipMapCount</a>>1) +02727 needRebuild = <span class="keyword">true</span>; +02728 <a class="code" href="a02268.html#NL3D_1_1ITexturea30">releaseMipMaps</a>(); +02729 +02730 <span class="keywordflow">for</span>( j = 0; j < nHeight/2; ++j ) +02731 <span class="keywordflow">for</span>( i = 0; i < nWidth; ++i ) +02732 { +02733 temp = pBitmap[j*nWidth+i]; +02734 pBitmap[j*nWidth+i] = pBitmap[(nHeight-j-1)*nWidth+i]; +02735 pBitmap[(nHeight-j-1)*nWidth+i] = temp; +02736 } +02737 +02738 <span class="comment">// Rebuilding mipmaps</span> +02739 <span class="keywordflow">if</span>(needRebuild) +02740 { +02741 <a class="code" href="a02268.html#NL3D_1_1ITexturea3">buildMipMaps</a>(); +02742 } +02743 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1ITexturea11" doxytag="NLMISC::CBitmap::getColor" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03338.html">CRGBAF</a> NLMISC::CBitmap::getColor </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">float </td> + <td class="mdname" nowrap> <em>x</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>float </td> + <td class="mdname" nowrap> <em>y</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"> const</td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Get the color in the bitmap given a pixel size The mipmaps must be built. If not just return the bilinear at the given point. The input x and y must be clamped between 0 and 1 +<p> +Definition at line <a class="el" href="a05486.html#l02470">2470</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +References <a class="el" href="a06340.html#l00661">NLMISC::CRGBAF::A</a>, <a class="el" href="a06340.html#l00659">NLMISC::CRGBAF::B</a>, <a class="el" href="a06340.html#l00657">NLMISC::CRGBAF::G</a>, <a class="el" href="a05486.html#l02459">getColorInterp()</a>, <a class="el" href="a05486.html#l01388">getHeight()</a>, <a class="el" href="a05486.html#l03134">getPixelColor()</a>, <a class="el" href="a05487.html#l00308">getPixels()</a>, <a class="el" href="a05486.html#l01363">getWidth()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>, <a class="el" href="a06340.html#l00655">NLMISC::CRGBAF::R</a>, <a class="el" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew25">RGBA</a>, <a class="el" href="a05981.html#l00099">sint32</a>, <a class="el" href="a05981.html#l00100">uint32</a>, <a class="el" href="a05646.html#l00236">x</a>, and <a class="el" href="a05646.html#l00236">y</a>. +<p> +<div class="fragment"><pre>02471 { +02472 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a572">x</a> < 0.0f) <a class="code" href="a04223.html#a572">x</a> = 0.0f; +02473 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a572">x</a> > 1.0f) <a class="code" href="a04223.html#a572">x</a> = 1.0f; +02474 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a573">y</a> < 0.0f) <a class="code" href="a04223.html#a573">y</a> = 0.0f; +02475 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a573">y</a> > 1.0f) <a class="code" href="a04223.html#a573">y</a> = 1.0f; +02476 +02477 <a class="code" href="a04558.html#a10">sint32</a> nWidth = <a class="code" href="a02268.html#NL3D_1_1ITexturea20">getWidth</a>(0); +02478 <a class="code" href="a04558.html#a10">sint32</a> nHeight = <a class="code" href="a02268.html#NL3D_1_1ITexturea12">getHeight</a>(0); +02479 +02480 <span class="keywordflow">if</span> (nWidth == 0 || nHeight == 0) <span class="keywordflow">return</span> CRGBAF(0, 0, 0, 0); +02481 +02482 <span class="keyword">const</span> CObjectVector<uint8> &rBitmap = <a class="code" href="a02268.html#NL3D_1_1ITexturez1927_1">getPixels</a>(0); +02483 <a class="code" href="a04558.html#a10">sint32</a> nX[4], nY[4]; +02484 +02485 <a class="code" href="a04223.html#a572">x</a> *= nWidth-1; +02486 <a class="code" href="a04223.html#a573">y</a> *= nHeight-1; +02487 +02488 <span class="comment">// Integer part of (x,y)</span> +02489 <span class="comment">//nX[0] = ((sint32)floor(x-0.5f));</span> +02490 <span class="comment">//nY[0] = ((sint32)floor(y-0.5f));</span> +02491 nX[0] = ((<a class="code" href="a04558.html#a10">sint32</a>)floor(x)); +02492 nY[0] = ((<a class="code" href="a04558.html#a10">sint32</a>)floor(y)); +02493 +02494 nX[1] = (nX[0] < (nWidth-1) ? nX[0]+1 : nX[0]); +02495 nY[1] = nY[0]; +02496 +02497 nX[2] = nX[0]; +02498 nY[2] = (nY[0] < (nHeight-1) ? nY[0]+1 : nY[0]); +02499 +02500 nX[3] = nX[1]; +02501 nY[3] = nY[2]; +02502 +02503 <a class="code" href="a04558.html#a11">uint32</a> i; +02504 +02505 <span class="keywordflow">for</span> (i = 0; i < 4; ++i) +02506 { +02507 <a class="code" href="a04199.html#a6">nlassert</a> (nX[i] >= 0); +02508 <a class="code" href="a04199.html#a6">nlassert</a> (nY[i] >= 0 ); +02509 <a class="code" href="a04199.html#a6">nlassert</a> (nX[i] < nWidth); +02510 <a class="code" href="a04199.html#a6">nlassert</a> (nY[i] < nHeight); +02511 } +02512 +02513 <span class="comment">// Decimal part of (x,y)</span> +02514 <a class="code" href="a04223.html#a572">x</a> = <a class="code" href="a04223.html#a572">x</a> - (<span class="keywordtype">float</span>)nX[0]; +02515 <a class="code" href="a04223.html#a573">y</a> = <a class="code" href="a04223.html#a573">y</a> - (<span class="keywordtype">float</span>)nY[0]; +02516 +02517 <span class="keywordflow">switch</span> (this-><a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>) +02518 { +02519 <span class="keywordflow">case</span> <a class="code" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew25">RGBA</a>: +02520 <span class="keywordflow">case</span> <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw4">DXTC1</a>: +02521 <span class="keywordflow">case</span> <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw5">DXTC1Alpha</a>: +02522 <span class="keywordflow">case</span> <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw6">DXTC3</a>: +02523 <span class="keywordflow">case</span> <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw7">DXTC5</a>: +02524 { +02525 CRGBAF finalVal; +02526 CRGBA val[4]; +02527 +02528 <span class="keywordflow">if</span> (this-><a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a> == <a class="code" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew25">RGBA</a>) +02529 { +02530 <span class="keywordflow">for</span> (i = 0; i < 4; ++i) +02531 { +02532 val[i] = CRGBA (rBitmap[(nX[i]+nY[i]*nWidth)*4+0], +02533 rBitmap[(nX[i]+nY[i]*nWidth)*4+1], +02534 rBitmap[(nX[i]+nY[i]*nWidth)*4+2], +02535 rBitmap[(nX[i]+nY[i]*nWidth)*4+3]); +02536 } +02537 } +02538 <span class="keywordflow">else</span> +02539 { +02540 <span class="comment">// slower version : get from DXT</span> +02541 <span class="keywordflow">for</span> (i = 0; i < 4; ++i) +02542 { +02543 val[i] = <a class="code" href="a02268.html#NL3D_1_1ITexturea14">getPixelColor</a>(nX[i], nY[i]); +02544 } +02545 } +02546 +02547 finalVal.R = <a class="code" href="a02268.html#NLMISC_1_1CBitmapd4">getColorInterp</a> (x, y, val[0].R, val[1].R, val[2].R, val[3].R); +02548 finalVal.G = <a class="code" href="a02268.html#NLMISC_1_1CBitmapd4">getColorInterp</a> (x, y, val[0].G, val[1].G, val[2].G, val[3].G); +02549 finalVal.B = <a class="code" href="a02268.html#NLMISC_1_1CBitmapd4">getColorInterp</a> (x, y, val[0].B, val[1].B, val[2].B, val[3].B); +02550 finalVal.A = <a class="code" href="a02268.html#NLMISC_1_1CBitmapd4">getColorInterp</a> (x, y, val[0].A, val[1].A, val[2].A, val[3].A); +02551 finalVal /= 255.f; +02552 +02553 <span class="keywordflow">return</span> finalVal; +02554 } +02555 <span class="keywordflow">break</span>; +02556 <span class="keywordflow">case</span> <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw0">Alpha</a>: +02557 <span class="keywordflow">case</span> <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw8">Luminance</a>: +02558 { +02559 +02560 <span class="keywordtype">float</span> finalVal; +02561 <span class="keywordtype">float</span> val[4]; +02562 +02563 <span class="keywordflow">for</span> (i = 0; i < 4; ++i) +02564 val[i] = rBitmap[(nX[i]+nY[i]*nWidth)]; +02565 +02566 finalVal = <a class="code" href="a02268.html#NLMISC_1_1CBitmapd4">getColorInterp</a> (x, y, val[0], val[1], val[2], val[3]); +02567 finalVal /= 255.f; +02568 +02569 <span class="keywordflow">if</span> (this-><a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a> == <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw0">Alpha</a>) +02570 <span class="keywordflow">return</span> CRGBAF (1.f, 1.f, 1.f, finalVal); +02571 <span class="keywordflow">else</span> <span class="comment">// Luminance</span> +02572 <span class="keywordflow">return</span> CRGBAF (finalVal, finalVal, finalVal, 1.f); +02573 } +02574 <span class="keywordflow">break</span>; +02575 <span class="keywordflow">default</span>: <span class="keywordflow">break</span>; +02576 } +02577 +02578 <span class="keywordflow">return</span> CRGBAF (0.0f, 0.0f, 0.0f, 0.0f); +02579 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBitmapd4" doxytag="NLMISC::CBitmap::getColorInterp" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> float NLMISC::CBitmap::getColorInterp </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">float </td> + <td class="mdname" nowrap> <em>x</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>float </td> + <td class="mdname" nowrap> <em>y</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>float </td> + <td class="mdname" nowrap> <em>xy00</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>float </td> + <td class="mdname" nowrap> <em>xy01</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>float </td> + <td class="mdname" nowrap> <em>xy10</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>float </td> + <td class="mdname" nowrap> <em>xy11</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"> const<code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Quadratic interpolator <dl compact><dt><b>Returns:</b></dt><dd>the interpolation in (x,y) of the values (xy**)</dd></dl> + +<p> +Definition at line <a class="el" href="a05486.html#l02459">2459</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +References <a class="el" href="a05587.html#l00115">NLMISC::clamp()</a>, <a class="el" href="a05646.html#l01119">res</a>, <a class="el" href="a05646.html#l00236">x</a>, and <a class="el" href="a05646.html#l00236">y</a>. +<p> +Referenced by <a class="el" href="a05486.html#l02470">getColor()</a>. +<p> +<div class="fragment"><pre>02460 { +02461 <span class="keywordtype">float</span> <a class="code" href="a04223.html#a643">res</a> = colorInXY00*(1.0f-<a class="code" href="a04223.html#a572">x</a>)*(1.0f-<a class="code" href="a04223.html#a573">y</a>) + +02462 colorInXY10*( <a class="code" href="a04223.html#a572">x</a>)*(1.0f-<a class="code" href="a04223.html#a573">y</a>) + +02463 colorInXY01*(1.0f-<a class="code" href="a04223.html#a572">x</a>)*( <a class="code" href="a04223.html#a573">y</a>) + +02464 colorInXY11*( <a class="code" href="a04223.html#a572">x</a>)*( <a class="code" href="a04223.html#a573">y</a>); +02465 <a class="code" href="a05378.html#a374">clamp</a> (res, 0.0f, 255.0f); +02466 <span class="keywordflow">return</span> <a class="code" href="a04223.html#a643">res</a>; +02467 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBitmapz1926_0" doxytag="NLMISC::CBitmap::getDXTC1Texel" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03337.html">CRGBA</a> NLMISC::CBitmap::getDXTC1Texel </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a14">sint</a> </td> + <td class="mdname" nowrap> <em>x</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a> </td> + <td class="mdname" nowrap> <em>y</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a11">uint32</a> </td> + <td class="mdname" nowrap> <em>numMipMap</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"> const<code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05486.html#l03048">3048</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +References <a class="el" href="a05486.html#l02990">getDXTCColorFromBlock()</a>, <a class="el" href="a05486.html#l01388">getHeight()</a>, <a class="el" href="a05487.html#l00308">getPixels()</a>, <a class="el" href="a05486.html#l01363">getWidth()</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00100">uint32</a>, <a class="el" href="a05981.html#l00096">uint8</a>, <a class="el" href="a05646.html#l00236">w</a>, <a class="el" href="a05646.html#l00236">x</a>, and <a class="el" href="a05646.html#l00236">y</a>. +<p> +Referenced by <a class="el" href="a05486.html#l03134">getPixelColor()</a>. +<p> +<div class="fragment"><pre>03049 { +03050 <a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a575">w</a> = <a class="code" href="a02268.html#NL3D_1_1ITexturea20">getWidth</a>(numMipMap); +03051 <a class="code" href="a04558.html#a15">uint</a> h = <a class="code" href="a02268.html#NL3D_1_1ITexturea12">getHeight</a>(numMipMap); +03052 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a575">w</a> == 0 || h == 0 || (<a class="code" href="a04558.html#a15">uint</a>) <a class="code" href="a04223.html#a572">x</a> >= <a class="code" href="a04223.html#a575">w</a> || (<a class="code" href="a04558.html#a15">uint</a>) <a class="code" href="a04223.html#a573">y</a> >= h) <span class="keywordflow">return</span> CRGBA::Black; <span class="comment">// include negative cases </span> +03053 <a class="code" href="a04558.html#a15">uint</a> numRowBlocks = std::max((w + 3) >> 2, 1u); +03054 <span class="keyword">const</span> <a class="code" href="a04558.html#a7">uint8</a> *pix = &<a class="code" href="a02268.html#NL3D_1_1ITexturez1927_1">getPixels</a>(numMipMap)[0]; +03055 <span class="keyword">const</span> <a class="code" href="a04558.html#a7">uint8</a> *block = pix + ((<a class="code" href="a04223.html#a573">y</a> >> 2) * (numRowBlocks << 3) + ((x >> 2) << 3)); +03056 <span class="keywordflow">return</span> <a class="code" href="a02268.html#NLMISC_1_1CBitmapz1926_3">getDXTCColorFromBlock</a>(block, x, y); +03057 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBitmapz1926_1" doxytag="NLMISC::CBitmap::getDXTC3Texel" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03337.html">CRGBA</a> NLMISC::CBitmap::getDXTC3Texel </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a14">sint</a> </td> + <td class="mdname" nowrap> <em>x</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a> </td> + <td class="mdname" nowrap> <em>y</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a11">uint32</a> </td> + <td class="mdname" nowrap> <em>numMipMap</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"> const<code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05486.html#l03061">3061</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +References <a class="el" href="a06340.html#l00340">NLMISC::CRGBA::A</a>, <a class="el" href="a05486.html#l02990">getDXTCColorFromBlock()</a>, <a class="el" href="a05486.html#l01388">getHeight()</a>, <a class="el" href="a05487.html#l00308">getPixels()</a>, <a class="el" href="a05486.html#l01363">getWidth()</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00100">uint32</a>, <a class="el" href="a05981.html#l00096">uint8</a>, <a class="el" href="a05646.html#l00236">w</a>, <a class="el" href="a05646.html#l00236">x</a>, and <a class="el" href="a05646.html#l00236">y</a>. +<p> +Referenced by <a class="el" href="a05486.html#l03134">getPixelColor()</a>. +<p> +<div class="fragment"><pre>03062 { +03063 <a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a575">w</a> = <a class="code" href="a02268.html#NL3D_1_1ITexturea20">getWidth</a>(numMipMap); +03064 <a class="code" href="a04558.html#a15">uint</a> h = <a class="code" href="a02268.html#NL3D_1_1ITexturea12">getHeight</a>(numMipMap); +03065 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a575">w</a> == 0 || h == 0 || (<a class="code" href="a04558.html#a15">uint</a>) <a class="code" href="a04223.html#a572">x</a> >= <a class="code" href="a04223.html#a575">w</a> || (<a class="code" href="a04558.html#a15">uint</a>) <a class="code" href="a04223.html#a573">y</a> >= h) <span class="keywordflow">return</span> CRGBA::Black; <span class="comment">// include negative cases </span> +03066 <a class="code" href="a04558.html#a15">uint</a> numRowBlocks = std::max((w + 3) >> 2, 1u); +03067 <span class="keyword">const</span> <a class="code" href="a04558.html#a7">uint8</a> *pix = &<a class="code" href="a02268.html#NL3D_1_1ITexturez1927_1">getPixels</a>(numMipMap)[0]; +03068 <span class="keyword">const</span> <a class="code" href="a04558.html#a7">uint8</a> *block = pix + ((<a class="code" href="a04223.html#a573">y</a> >> 2) * (numRowBlocks << 4) + ((x >> 2) << 4)); +03069 CRGBA result = <a class="code" href="a02268.html#NLMISC_1_1CBitmapz1926_3">getDXTCColorFromBlock</a>(block + 8, x, y); +03070 <span class="comment">// get alpha part</span> +03071 <a class="code" href="a04558.html#a7">uint8</a> alphaByte = block[((<a class="code" href="a04223.html#a573">y</a> & 3) << 1) + ((<a class="code" href="a04223.html#a572">x</a> & 2) >> 1)]; +03072 result.A = (<a class="code" href="a04223.html#a572">x</a> & 1) ? (alphaByte & 0xf0) : (alphaByte << 4); +03073 <span class="keywordflow">return</span> result; +03074 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBitmapz1926_2" doxytag="NLMISC::CBitmap::getDXTC5Texel" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03337.html">CRGBA</a> NLMISC::CBitmap::getDXTC5Texel </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a14">sint</a> </td> + <td class="mdname" nowrap> <em>x</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a> </td> + <td class="mdname" nowrap> <em>y</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a11">uint32</a> </td> + <td class="mdname" nowrap> <em>numMipMap</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"> const<code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05486.html#l03077">3077</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +References <a class="el" href="a06340.html#l00340">NLMISC::CRGBA::A</a>, <a class="el" href="a05486.html#l02990">getDXTCColorFromBlock()</a>, <a class="el" href="a05486.html#l01388">getHeight()</a>, <a class="el" href="a05487.html#l00308">getPixels()</a>, <a class="el" href="a05486.html#l01363">getWidth()</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00100">uint32</a>, <a class="el" href="a05981.html#l00096">uint8</a>, <a class="el" href="a05646.html#l00236">w</a>, <a class="el" href="a05646.html#l00236">x</a>, and <a class="el" href="a05646.html#l00236">y</a>. +<p> +Referenced by <a class="el" href="a05486.html#l03134">getPixelColor()</a>. +<p> +<div class="fragment"><pre>03078 { +03079 <a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a575">w</a> = <a class="code" href="a02268.html#NL3D_1_1ITexturea20">getWidth</a>(numMipMap); +03080 <a class="code" href="a04558.html#a15">uint</a> h = <a class="code" href="a02268.html#NL3D_1_1ITexturea12">getHeight</a>(numMipMap); +03081 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a575">w</a> == 0 || h == 0 || (<a class="code" href="a04558.html#a15">uint</a>) <a class="code" href="a04223.html#a572">x</a> >= <a class="code" href="a04223.html#a575">w</a> || (<a class="code" href="a04558.html#a15">uint</a>) <a class="code" href="a04223.html#a573">y</a> >= h) <span class="keywordflow">return</span> CRGBA::Black; <span class="comment">// include negative cases </span> +03082 <a class="code" href="a04558.html#a15">uint</a> numRowBlocks = std::max((w + 3) >> 2, 1u); +03083 <span class="keyword">const</span> <a class="code" href="a04558.html#a7">uint8</a> *pix = &<a class="code" href="a02268.html#NL3D_1_1ITexturez1927_1">getPixels</a>(numMipMap)[0]; +03084 <span class="keyword">const</span> <a class="code" href="a04558.html#a7">uint8</a> *block = pix + ((<a class="code" href="a04223.html#a573">y</a> >> 2) * (numRowBlocks << 4) + ((x >> 2) << 4)); +03085 CRGBA result = <a class="code" href="a02268.html#NLMISC_1_1CBitmapz1926_3">getDXTCColorFromBlock</a>(block + 8, x, y); +03086 <span class="comment">// get alpha part</span> +03087 <a class="code" href="a04558.html#a7">uint8</a> alpha0 = block[0]; +03088 <a class="code" href="a04558.html#a7">uint8</a> alpha1 = block[1]; +03089 +03090 <a class="code" href="a04558.html#a15">uint</a> alphaIndex; +03091 <a class="code" href="a04558.html#a15">uint</a> tripletIndex = (<a class="code" href="a04223.html#a572">x</a> & 3) + ((<a class="code" href="a04223.html#a573">y</a> & 3) << 2); +03092 <span class="keywordflow">if</span> (tripletIndex < 8) +03093 { +03094 alphaIndex = (((<a class="code" href="a04558.html#a11">uint32</a> &) block[2]) >> (tripletIndex * 3)) & 7; +03095 } +03096 <span class="keywordflow">else</span> +03097 { +03098 alphaIndex = (((<a class="code" href="a04558.html#a11">uint32</a> &) block[5]) >> ((tripletIndex - 8) * 3)) & 7; <span class="comment">// we can read a dword there because there are color datas following he alpha datas</span> +03099 } +03100 +03101 <span class="keywordflow">if</span> (alpha0 > alpha1) +03102 { +03103 <span class="keywordflow">switch</span> (alphaIndex) +03104 { +03105 <span class="keywordflow">case</span> 0: result.A = alpha0; <span class="keywordflow">break</span>; +03106 <span class="keywordflow">case</span> 1: result.A = alpha1; <span class="keywordflow">break</span>; +03107 <span class="keywordflow">case</span> 2: result.A = (<a class="code" href="a04558.html#a7">uint8</a>) ((6 * (<a class="code" href="a04558.html#a15">uint</a>) alpha0 + (<a class="code" href="a04558.html#a15">uint</a>) alpha1) / 7); <span class="keywordflow">break</span>; +03108 <span class="keywordflow">case</span> 3: result.A = (<a class="code" href="a04558.html#a7">uint8</a>) ((5 * (<a class="code" href="a04558.html#a15">uint</a>) alpha0 + 2 * (<a class="code" href="a04558.html#a15">uint</a>) alpha1) / 7); <span class="keywordflow">break</span>; +03109 <span class="keywordflow">case</span> 4: result.A = (<a class="code" href="a04558.html#a7">uint8</a>) ((4 * (<a class="code" href="a04558.html#a15">uint</a>) alpha0 + 3 * (<a class="code" href="a04558.html#a15">uint</a>) alpha1) / 7); <span class="keywordflow">break</span>; +03110 <span class="keywordflow">case</span> 5: result.A = (<a class="code" href="a04558.html#a7">uint8</a>) ((3 * (<a class="code" href="a04558.html#a15">uint</a>) alpha0 + 4 * (<a class="code" href="a04558.html#a15">uint</a>) alpha1) / 7); <span class="keywordflow">break</span>; +03111 <span class="keywordflow">case</span> 6: result.A = (<a class="code" href="a04558.html#a7">uint8</a>) ((2 * (<a class="code" href="a04558.html#a15">uint</a>) alpha0 + 5 * (<a class="code" href="a04558.html#a15">uint</a>) alpha1) / 7); <span class="keywordflow">break</span>; +03112 <span class="keywordflow">case</span> 7: result.A = (<a class="code" href="a04558.html#a7">uint8</a>) (((<a class="code" href="a04558.html#a15">uint</a>) alpha0 + (<a class="code" href="a04558.html#a15">uint</a>) 6 * alpha1) / 7); <span class="keywordflow">break</span>; +03113 } +03114 } +03115 <span class="keywordflow">else</span> +03116 { +03117 <span class="keywordflow">switch</span> (alphaIndex) +03118 { +03119 <span class="keywordflow">case</span> 0: result.A = alpha0; <span class="keywordflow">break</span>; +03120 <span class="keywordflow">case</span> 1: result.A = alpha1; <span class="keywordflow">break</span>; +03121 <span class="keywordflow">case</span> 2: result.A = (<a class="code" href="a04558.html#a7">uint8</a>) ((4 * (<a class="code" href="a04558.html#a15">uint</a>) alpha0 + (<a class="code" href="a04558.html#a15">uint</a>) alpha1) / 5); <span class="keywordflow">break</span>; +03122 <span class="keywordflow">case</span> 3: result.A = (<a class="code" href="a04558.html#a7">uint8</a>) ((3 * (<a class="code" href="a04558.html#a15">uint</a>) alpha0 + 2 * (<a class="code" href="a04558.html#a15">uint</a>) alpha1) / 5); <span class="keywordflow">break</span>; +03123 <span class="keywordflow">case</span> 4: result.A = (<a class="code" href="a04558.html#a7">uint8</a>) ((2 * (<a class="code" href="a04558.html#a15">uint</a>) alpha0 + 3 * (<a class="code" href="a04558.html#a15">uint</a>) alpha1) / 5); <span class="keywordflow">break</span>; +03124 <span class="keywordflow">case</span> 5: result.A = (<a class="code" href="a04558.html#a7">uint8</a>) (((<a class="code" href="a04558.html#a15">uint</a>) alpha0 + 4 * (<a class="code" href="a04558.html#a15">uint</a>) alpha1) / 5); <span class="keywordflow">break</span>; +03125 <span class="keywordflow">case</span> 6: result.A = 0; <span class="keywordflow">break</span>; +03126 <span class="keywordflow">case</span> 7: result.A = 255; <span class="keywordflow">break</span>; +03127 } +03128 } +03129 <span class="keywordflow">return</span> result; +03130 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBitmapz1926_3" doxytag="NLMISC::CBitmap::getDXTCColorFromBlock" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03337.html">CRGBA</a> NLMISC::CBitmap::getDXTCColorFromBlock </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a04558.html#a7">uint8</a> * </td> + <td class="mdname" nowrap> <em>block</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a> </td> + <td class="mdname" nowrap> <em>x</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a> </td> + <td class="mdname" nowrap> <em>y</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [static, private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05486.html#l02990">2990</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +References <a class="el" href="a06340.html#l00340">NLMISC::CRGBA::A</a>, <a class="el" href="a06340.html#l00104">NLMISC::CRGBA::blendFromui()</a>, <a class="el" href="a06339.html#l00066">NLMISC::CRGBA::set()</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00098">uint16</a>, <a class="el" href="a05981.html#l00096">uint8</a>, <a class="el" href="a05486.html#l01350">uncompress()</a>, <a class="el" href="a05646.html#l00236">x</a>, and <a class="el" href="a05646.html#l00236">y</a>. +<p> +Referenced by <a class="el" href="a05486.html#l03048">getDXTC1Texel()</a>, <a class="el" href="a05486.html#l03061">getDXTC3Texel()</a>, and <a class="el" href="a05486.html#l03077">getDXTC5Texel()</a>. +<p> +<div class="fragment"><pre>02991 { +02992 <a class="code" href="a04558.html#a9">uint16</a> col0; +02993 <a class="code" href="a04558.html#a9">uint16</a> col1; +02994 memcpy(&col0, block, <span class="keyword">sizeof</span>(<a class="code" href="a04558.html#a9">uint16</a>)); +02995 memcpy(&col1, block + 2, <span class="keyword">sizeof</span>(<a class="code" href="a04558.html#a9">uint16</a>)); +02996 <a class="code" href="a04558.html#a15">uint</a> colIndex = (block[4 + (<a class="code" href="a04223.html#a573">y</a> & 3)] >> ((<a class="code" href="a04223.html#a572">x</a> & 3) << 1)) & 3; +02997 CRGBA result, c0, c1; +02998 <span class="keywordflow">if</span> (col0 > col1) +02999 { +03000 <span class="keywordflow">switch</span>(colIndex) +03001 { +03002 <span class="keywordflow">case</span> 0: +03003 <a class="code" href="a02268.html#NLMISC_1_1CBitmaph0">uncompress</a>(col0, result); +03004 <span class="keywordflow">break</span>; +03005 <span class="keywordflow">case</span> 1: +03006 <a class="code" href="a02268.html#NLMISC_1_1CBitmaph0">uncompress</a>(col1, result); +03007 <span class="keywordflow">break</span>; +03008 <span class="keywordflow">case</span> 2: +03009 <a class="code" href="a02268.html#NLMISC_1_1CBitmaph0">uncompress</a>(col0, c0); +03010 <a class="code" href="a02268.html#NLMISC_1_1CBitmaph0">uncompress</a>(col1, c1); +03011 result.blendFromui(c0, c1, 85); +03012 <span class="keywordflow">break</span>; +03013 <span class="keywordflow">case</span> 3: +03014 <a class="code" href="a02268.html#NLMISC_1_1CBitmaph0">uncompress</a>(col0, c0); +03015 <a class="code" href="a02268.html#NLMISC_1_1CBitmaph0">uncompress</a>(col1, c1); +03016 result.blendFromui(c0, c1, 171); +03017 <span class="keywordflow">break</span>; +03018 } +03019 result.A = 255; +03020 } +03021 <span class="keywordflow">else</span> +03022 { +03023 <span class="keywordflow">switch</span>(colIndex) +03024 { +03025 <span class="keywordflow">case</span> 0: +03026 <a class="code" href="a02268.html#NLMISC_1_1CBitmaph0">uncompress</a>(col0, result); +03027 result.A = 255; +03028 <span class="keywordflow">break</span>; +03029 <span class="keywordflow">case</span> 1: +03030 <a class="code" href="a02268.html#NLMISC_1_1CBitmaph0">uncompress</a>(col1, result); +03031 result.A = 255; +03032 <span class="keywordflow">break</span>; +03033 <span class="keywordflow">case</span> 2: +03034 <a class="code" href="a02268.html#NLMISC_1_1CBitmaph0">uncompress</a>(col0, c0); +03035 <a class="code" href="a02268.html#NLMISC_1_1CBitmaph0">uncompress</a>(col1, c1); +03036 result.blendFromui(c0, c1, 128); +03037 result.A = 255; +03038 <span class="keywordflow">break</span>; +03039 <span class="keywordflow">case</span> 3: +03040 result.set(0, 0, 0, 0); +03041 <span class="keywordflow">break</span>; +03042 } +03043 } +03044 <span class="keywordflow">return</span> result; +03045 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1ITexturea12" doxytag="NLMISC::CBitmap::getHeight" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a11">uint32</a> NLMISC::CBitmap::getHeight </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a11">uint32</a> </td> + <td class="mdname1" valign="top" nowrap> <em>numMipMap</em> = 0 </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const<code> [virtual]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Return the image height, or a mipmap height. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign=top><em>mipMap</em> </td><td>mipmap level </td></tr> + </table> +</dl> +<dl compact><dt><b>Returns:</b></dt><dd>image height (0 if mipmap not found)</dd></dl> + +<p> +Definition at line <a class="el" href="a05486.html#l01388">1388</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +References <a class="el" href="a05981.html#l00100">uint32</a>, and <a class="el" href="a05646.html#l00236">w</a>. +<p> +Referenced by <a class="el" href="a05790.html#l00152">NL3D::CHLSColorTexture::addMask()</a>, <a class="el" href="a05935.html#l00809">NL3D::CLodCharacterTmpBitmap::build()</a>, <a class="el" href="a05567.html#l00070">NL3D::CCoarseMeshBuild::buildBitmap()</a>, <a class="el" href="a06521.html#l00041">NL3D::CTextureFile::buildBitmapFromFile()</a>, <a class="el" href="a05722.html#l00088">NL3D::CFontManager::computeString()</a>, <a class="el" href="a05706.html#l00393">NL3D::CFastHLSModifier::convertDDSBitmap()</a>, <a class="el" href="a06768.html#l00712">draw2dLine()</a>, <a class="el" href="a05567.html#l00367">NL3D::CCoarseMeshBuild::expand()</a>, <a class="el" href="a05642.html#l02171">NL3D::CDriverGL::fillBuffer()</a>, <a class="el" href="a05486.html#l02682">flipH()</a>, <a class="el" href="a05486.html#l02714">flipV()</a>, <a class="el" href="a06163.html#l00214">NL3D::CPatchDLMContext::generate()</a>, <a class="el" href="a05486.html#l02470">getColor()</a>, <a class="el" href="a05486.html#l03048">getDXTC1Texel()</a>, <a class="el" href="a05486.html#l03061">getDXTC3Texel()</a>, <a class="el" href="a05486.html#l03077">getDXTC5Texel()</a>, <a class="el" href="a05486.html#l02980">getRGBAPixel()</a>, <a class="el" href="a05486.html#l01412">getSize()</a>, <a class="el" href="a06525.html#l00039">NL3D::GetTextureSize()</a>, <a class="el" href="a06536.html#l00442">NL3D::CTileBank::getTileNoiseMap()</a>, <a class="el" href="a06768.html#l02927">NL3D::CZoneLighter::lightWater()</a>, <a class="el" href="a06378.html#l00308">NL3D::CShapeBank::processWSUploadTexture()</a>, <a class="el" href="a06768.html#l00444">RenderTriangle()</a>, <a class="el" href="a05486.html#l02781">rot90CCW()</a>, <a class="el" href="a05486.html#l02746">rot90CW()</a>, <a class="el" href="a05790.html#l00092">NL3D::CHLSColorTexture::setBitmap()</a>, <a class="el" href="a05652.html#l00361">NL3D::CDriverGL::setupTextureEx()</a>, <a class="el" href="a05652.html#l00807">NL3D::CDriverGL::uploadTexture()</a>, and <a class="el" href="a05463.html#l00451">NL3D::CAsyncTextureManager::uploadTexturePart()</a>. +<p> +<div class="fragment"><pre>01389 { +01390 <span class="keywordflow">if</span>(mipMap==0) <span class="keywordflow">return</span> <a class="code" href="a02268.html#NL3D_1_1ITexturep1">_Height</a>; +01391 +01392 <a class="code" href="a04558.html#a11">uint32</a> <a class="code" href="a04223.html#a575">w</a> = <a class="code" href="a02268.html#NL3D_1_1ITexturep5">_Width</a>; +01393 <a class="code" href="a04558.html#a11">uint32</a> h = <a class="code" href="a02268.html#NL3D_1_1ITexturep1">_Height</a>; +01394 <a class="code" href="a04558.html#a11">uint32</a> m = 0; +01395 +01396 <span class="keywordflow">do</span> +01397 { +01398 m++; +01399 <a class="code" href="a04223.html#a575">w</a> = (<a class="code" href="a04223.html#a575">w</a>+1)/2; +01400 h = (h+1)/2; +01401 <span class="keywordflow">if</span>(m==mipMap) <span class="keywordflow">return</span> h; +01402 } +01403 <span class="keywordflow">while</span>(<a class="code" href="a04223.html#a575">w</a>!=1 || h!=1); +01404 +01405 <span class="keywordflow">return</span> 0; +01406 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1ITexturea13" doxytag="NLMISC::CBitmap::getMipMapCount" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a11">uint32</a> NLMISC::CBitmap::getMipMapCount </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const<code> [inline]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Return the number of mipmaps. Level0 is a mipmap... <dl compact><dt><b>Returns:</b></dt><dd>number of mipmaps. 0 if no image at all. 1 if no mipmaping (for the base level).</dd></dl> + +<p> +Definition at line <a class="el" href="a05487.html#l00369">369</a> of file <a class="el" href="a05487.html">bitmap.h</a>. +<p> +References <a class="el" href="a05487.html#l00093">_MipMapCount</a>, and <a class="el" href="a05981.html#l00100">uint32</a>. +<p> +Referenced by <a class="el" href="a05790.html#l00152">NL3D::CHLSColorTexture::addMask()</a>, <a class="el" href="a06378.html#l00308">NL3D::CShapeBank::processWSUploadTexture()</a>, <a class="el" href="a05790.html#l00092">NL3D::CHLSColorTexture::setBitmap()</a>, <a class="el" href="a05652.html#l00361">NL3D::CDriverGL::setupTextureEx()</a>, <a class="el" href="a05652.html#l00807">NL3D::CDriverGL::uploadTexture()</a>, <a class="el" href="a05463.html#l00451">NL3D::CAsyncTextureManager::uploadTexturePart()</a>, and <a class="el" href="a05463.html#l00619">NL3D::CAsyncTextureManager::validDXTCMipMap()</a>. +<p> +<div class="fragment"><pre>00370 { +00371 <span class="keywordflow">return</span> <a class="code" href="a02268.html#NL3D_1_1ITexturep3">_MipMapCount</a>; +00372 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1ITexturea14" doxytag="NLMISC::CBitmap::getPixelColor" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03337.html">CRGBA</a> NLMISC::CBitmap::getPixelColor </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a14">sint</a> </td> + <td class="mdname" nowrap> <em>x</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a> </td> + <td class="mdname" nowrap> <em>y</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a11">uint32</a> </td> + <td class="mdname" nowrap> <em>numMipMap</em> = 0</td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"> const</td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Get the pixel at the given coorrdinate. Works in RGBA and DXTC modes. Outside of the bitmap it returns Black (or if mipmap is not found) +<p> +Definition at line <a class="el" href="a05486.html#l03134">3134</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +References <a class="el" href="a05486.html#l03048">getDXTC1Texel()</a>, <a class="el" href="a05486.html#l03061">getDXTC3Texel()</a>, <a class="el" href="a05486.html#l03077">getDXTC5Texel()</a>, <a class="el" href="a05486.html#l02980">getRGBAPixel()</a>, <a class="el" href="a05622.html#l00416">nlstop</a>, <a class="el" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>, <a class="el" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew25">RGBA</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a05981.html#l00100">uint32</a>, <a class="el" href="a05646.html#l00236">x</a>, and <a class="el" href="a05646.html#l00236">y</a>. +<p> +Referenced by <a class="el" href="a05486.html#l02470">getColor()</a>. +<p> +<div class="fragment"><pre>03135 { +03136 +03137 <span class="keywordflow">switch</span> (<a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>) +03138 { +03139 <span class="keywordflow">case</span> <a class="code" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew25">RGBA</a>: +03140 <span class="keywordflow">return</span> <a class="code" href="a02268.html#NLMISC_1_1CBitmapd5">getRGBAPixel</a>(x, y, numMipMap); +03141 <span class="keywordflow">case</span> <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw4">DXTC1</a>: +03142 <span class="keywordflow">case</span> <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw5">DXTC1Alpha</a>: +03143 <span class="keywordflow">return</span> <a class="code" href="a02268.html#NLMISC_1_1CBitmapz1926_0">getDXTC1Texel</a>(x, y, numMipMap); +03144 <span class="keywordflow">case</span> <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw6">DXTC3</a>: +03145 <span class="keywordflow">return</span> <a class="code" href="a02268.html#NLMISC_1_1CBitmapz1926_1">getDXTC3Texel</a>(x, y, numMipMap); +03146 <span class="keywordflow">case</span> <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw7">DXTC5</a>: +03147 <span class="keywordflow">return</span> <a class="code" href="a02268.html#NLMISC_1_1CBitmapz1926_2">getDXTC5Texel</a>(x, y, numMipMap); +03148 <span class="keywordflow">default</span>: +03149 <a class="code" href="a04199.html#a12">nlstop</a>; +03150 <span class="keywordflow">break</span>; +03151 } +03152 <span class="keywordflow">return</span> CRGBA::Black; +03153 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1ITexturea15" doxytag="NLMISC::CBitmap::getPixelFormat" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a02268.html#NL3D_1_1ITexturew31">TType</a> NLMISC::CBitmap::getPixelFormat </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const<code> [inline]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Return the format of pixels stored at the present time in the object buffer. <dl compact><dt><b>Returns:</b></dt><dd>Pixel format (rgba luminance alpha alphaLuminance dxtc1 dxtc1Alpha dxtc3 dxtc5)</dd></dl> + +<p> +Definition at line <a class="el" href="a05487.html#l00335">335</a> of file <a class="el" href="a05487.html">bitmap.h</a>. +<p> +References <a class="el" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>. +<p> +Referenced by <a class="el" href="a05706.html#l00393">NL3D::CFastHLSModifier::convertDDSBitmap()</a>, <a class="el" href="a05706.html#l00414">NL3D::CFastHLSModifier::convertRGBABitmap()</a>, <a class="el" href="a06525.html#l00178">NL3D::CTextureGrouped::doGenerate()</a>, <a class="el" href="a05642.html#l02171">NL3D::CDriverGL::fillBuffer()</a>, <a class="el" href="a05652.html#l00170">NL3D::getGlSrcTextureFormat()</a>, <a class="el" href="a05652.html#l00099">NL3D::CDriverGL::getGlTextureFormat()</a>, <a class="el" href="a06378.html#l00308">NL3D::CShapeBank::processWSUploadTexture()</a>, <a class="el" href="a06519.html#l00465">NL3D::CTextureFar::rebuildPatch()</a>, <a class="el" href="a05790.html#l00092">NL3D::CHLSColorTexture::setBitmap()</a>, <a class="el" href="a05652.html#l00361">NL3D::CDriverGL::setupTextureEx()</a>, <a class="el" href="a05463.html#l00361">NL3D::CAsyncTextureManager::update()</a>, <a class="el" href="a05652.html#l00807">NL3D::CDriverGL::uploadTexture()</a>, <a class="el" href="a05463.html#l00451">NL3D::CAsyncTextureManager::uploadTexturePart()</a>, and <a class="el" href="a05463.html#l00619">NL3D::CAsyncTextureManager::validDXTCMipMap()</a>. +<p> +<div class="fragment"><pre>00336 { +00337 <span class="keywordflow">return</span> <a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>; +00338 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1ITexturez1927_0" doxytag="NLMISC::CBitmap::getPixels" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> const <a class="el" href="a03000.html">CObjectVector</a><<a class="el" href="a04558.html#a7">uint8</a>>& NLMISC::CBitmap::getPixels </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a11">uint32</a> </td> + <td class="mdname1" valign="top" nowrap> <em>numMipMap</em> = 0 </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const<code> [inline]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05487.html#l00313">313</a> of file <a class="el" href="a05487.html">bitmap.h</a>. +<p> +References <a class="el" href="a05981.html#l00100">uint32</a>. +<p> +<div class="fragment"><pre>00314 { +00315 <span class="comment">//nlassert (numMipMap<=_MipMapCount);</span> +00316 <span class="keywordflow">return</span> <a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[numMipMap]; +00317 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1ITexturez1927_1" doxytag="NLMISC::CBitmap::getPixels" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03000.html">CObjectVector</a><<a class="el" href="a04558.html#a7">uint8</a>>& NLMISC::CBitmap::getPixels </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a11">uint32</a> </td> + <td class="mdname1" valign="top" nowrap> <em>numMipMap</em> = 0 </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [inline]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Return the pixels buffer of the image, or of one of its mipmap. Return a reference of an array in pixel format get with <a class="el" href="a02268.html#NL3D_1_1ITexturea15">getPixelFormat()</a>. <dl compact><dt><b>Returns:</b></dt><dd><a class="el" href="a03000.html">CObjectVector<uint8></a>& RGBA pixels</dd></dl> + +<p> +Definition at line <a class="el" href="a05487.html#l00308">308</a> of file <a class="el" href="a05487.html">bitmap.h</a>. +<p> +References <a class="el" href="a05981.html#l00100">uint32</a>. +<p> +Referenced by <a class="el" href="a05790.html#l00152">NL3D::CHLSColorTexture::addMask()</a>, <a class="el" href="a05935.html#l00809">NL3D::CLodCharacterTmpBitmap::build()</a>, <a class="el" href="a06521.html#l00041">NL3D::CTextureFile::buildBitmapFromFile()</a>, <a class="el" href="a05790.html#l00337">NL3D::CHLSColorTexture::buildColorVersion()</a>, <a class="el" href="a05706.html#l00252">NL3D::CFastHLSModifier::convertDDSBitmapDXTC1Or1A()</a>, <a class="el" href="a05706.html#l00354">NL3D::CFastHLSModifier::convertDDSBitmapDXTC3Or5()</a>, <a class="el" href="a05706.html#l00414">NL3D::CFastHLSModifier::convertRGBABitmap()</a>, <a class="el" href="a06515.html#l00241">NL3D::CTextureDLM::copyRect()</a>, <a class="el" href="a06523.html#l00067">NL3D::CTextureFont::CTextureFont()</a>, <a class="el" href="a06527.html#l00045">NL3D::CTextureMem::doGenerate()</a>, <a class="el" href="a06517.html#l00101">NL3D::CTextureEmboss::doGenerate()</a>, <a class="el" href="a06511.html#l00277">NL3D::CTextureBump::doGenerate()</a>, <a class="el" href="a06768.html#l00712">draw2dLine()</a>, <a class="el" href="a06523.html#l00133">NL3D::CTextureFont::dumpTextureFont()</a>, <a class="el" href="a05567.html#l00367">NL3D::CCoarseMeshBuild::expand()</a>, <a class="el" href="a05642.html#l02171">NL3D::CDriverGL::fillBuffer()</a>, <a class="el" href="a06515.html#l00257">NL3D::CTextureDLM::fillRect()</a>, <a class="el" href="a05642.html#l02131">NL3D::CDriverGL::getBufferPart()</a>, <a class="el" href="a05486.html#l02470">getColor()</a>, <a class="el" href="a05486.html#l03048">getDXTC1Texel()</a>, <a class="el" href="a05486.html#l03061">getDXTC3Texel()</a>, <a class="el" href="a05486.html#l03077">getDXTC5Texel()</a>, <a class="el" href="a05486.html#l02980">getRGBAPixel()</a>, <a class="el" href="a06536.html#l00442">NL3D::CTileBank::getTileNoiseMap()</a>, <a class="el" href="a06768.html#l02927">NL3D::CZoneLighter::lightWater()</a>, <a class="el" href="a06515.html#l00273">NL3D::CTextureDLM::modulateAndfillRect565()</a>, <a class="el" href="a06515.html#l00305">NL3D::CTextureDLM::modulateAndfillRect8888()</a>, <a class="el" href="a06515.html#l00335">NL3D::CTextureDLM::modulateConstantAndfillRect()</a>, <a class="el" href="a06519.html#l00465">NL3D::CTextureFar::rebuildPatch()</a>, <a class="el" href="a06768.html#l00444">RenderTriangle()</a>, <a class="el" href="a05790.html#l00092">NL3D::CHLSColorTexture::setBitmap()</a>, <a class="el" href="a05652.html#l00361">NL3D::CDriverGL::setupTextureEx()</a>, and <a class="el" href="a05652.html#l00807">NL3D::CDriverGL::uploadTexture()</a>. +<p> +<div class="fragment"><pre>00309 { +00310 <span class="comment">//nlassert (numMipMap<=_MipMapCount);</span> +00311 <span class="keywordflow">return</span> <a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[numMipMap]; +00312 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBitmapd5" doxytag="NLMISC::CBitmap::getRGBAPixel" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03337.html">CRGBA</a> NLMISC::CBitmap::getRGBAPixel </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a14">sint</a> </td> + <td class="mdname" nowrap> <em>x</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a> </td> + <td class="mdname" nowrap> <em>y</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a11">uint32</a> </td> + <td class="mdname" nowrap> <em>numMipMap</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"> const<code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05486.html#l02980">2980</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +References <a class="el" href="a05486.html#l01388">getHeight()</a>, <a class="el" href="a05487.html#l00308">getPixels()</a>, <a class="el" href="a05486.html#l01363">getWidth()</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00100">uint32</a>, <a class="el" href="a05981.html#l00096">uint8</a>, <a class="el" href="a05646.html#l00236">w</a>, <a class="el" href="a05646.html#l00236">x</a>, and <a class="el" href="a05646.html#l00236">y</a>. +<p> +Referenced by <a class="el" href="a05486.html#l03134">getPixelColor()</a>. +<p> +<div class="fragment"><pre>02981 { +02982 <a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a575">w</a> = <a class="code" href="a02268.html#NL3D_1_1ITexturea20">getWidth</a>(numMipMap); +02983 <a class="code" href="a04558.html#a15">uint</a> h = <a class="code" href="a02268.html#NL3D_1_1ITexturea12">getHeight</a>(numMipMap); +02984 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a575">w</a> == 0 || (<a class="code" href="a04558.html#a15">uint</a>) <a class="code" href="a04223.html#a572">x</a> >= <a class="code" href="a04223.html#a575">w</a> || (<a class="code" href="a04558.html#a15">uint</a>) <a class="code" href="a04223.html#a573">y</a> >= h) <span class="keywordflow">return</span> CRGBA::Black; <span class="comment">// include negative cases</span> +02985 <span class="keyword">const</span> <a class="code" href="a04558.html#a7">uint8</a> *pix = &<a class="code" href="a02268.html#NL3D_1_1ITexturez1927_1">getPixels</a>(numMipMap)[(<a class="code" href="a04223.html#a572">x</a> + <a class="code" href="a04223.html#a573">y</a> * <a class="code" href="a04223.html#a575">w</a>) << 2]; +02986 <span class="keywordflow">return</span> CRGBA(pix[0], pix[1], pix[2], pix[3]); +02987 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1ITexturea19" doxytag="NLMISC::CBitmap::getSize" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a11">uint32</a> NLMISC::CBitmap::getSize </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a11">uint32</a> </td> + <td class="mdname1" valign="top" nowrap> <em>numMipMap</em> = 0 </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const</td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Return the size (in pixels) of the image: <=> <a class="el" href="a02268.html#NL3D_1_1ITexturea12">getHeight()</a>*getWidth(). <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign=top><em>mipMap</em> </td><td>mipmap level </td></tr> + </table> +</dl> +<dl compact><dt><b>Returns:</b></dt><dd>image size (0 if mipmap not found)</dd></dl> + +<p> +Definition at line <a class="el" href="a05486.html#l01412">1412</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +References <a class="el" href="a05486.html#l01388">getHeight()</a>, <a class="el" href="a05486.html#l01363">getWidth()</a>, and <a class="el" href="a05981.html#l00100">uint32</a>. +<p> +Referenced by <a class="el" href="a06378.html#l00308">NL3D::CShapeBank::processWSUploadTexture()</a>, <a class="el" href="a05652.html#l00361">NL3D::CDriverGL::setupTextureEx()</a>, <a class="el" href="a05463.html#l00361">NL3D::CAsyncTextureManager::update()</a>, and <a class="el" href="a05463.html#l00451">NL3D::CAsyncTextureManager::uploadTexturePart()</a>. +<p> +<div class="fragment"><pre>01413 { +01414 <span class="keywordflow">return</span> <a class="code" href="a02268.html#NL3D_1_1ITexturea12">getHeight</a>(numMipMap)*<a class="code" href="a02268.html#NL3D_1_1ITexturea20">getWidth</a>(numMipMap); +01415 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1ITexturea20" doxytag="NLMISC::CBitmap::getWidth" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a11">uint32</a> NLMISC::CBitmap::getWidth </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a11">uint32</a> </td> + <td class="mdname1" valign="top" nowrap> <em>numMipMap</em> = 0 </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const<code> [virtual]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Return the image width, or a mipmap width. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign=top><em>mipMap</em> </td><td>mipmap level </td></tr> + </table> +</dl> +<dl compact><dt><b>Returns:</b></dt><dd>image width (0 if mipmap not found)</dd></dl> + +<p> +Definition at line <a class="el" href="a05486.html#l01363">1363</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +References <a class="el" href="a05981.html#l00100">uint32</a>, and <a class="el" href="a05646.html#l00236">w</a>. +<p> +Referenced by <a class="el" href="a05790.html#l00152">NL3D::CHLSColorTexture::addMask()</a>, <a class="el" href="a06372.html#l00957">NL3D::CShadowMapManager::allocateTexture()</a>, <a class="el" href="a05935.html#l00809">NL3D::CLodCharacterTmpBitmap::build()</a>, <a class="el" href="a05567.html#l00070">NL3D::CCoarseMeshBuild::buildBitmap()</a>, <a class="el" href="a06521.html#l00041">NL3D::CTextureFile::buildBitmapFromFile()</a>, <a class="el" href="a05722.html#l00088">NL3D::CFontManager::computeString()</a>, <a class="el" href="a05706.html#l00393">NL3D::CFastHLSModifier::convertDDSBitmap()</a>, <a class="el" href="a06515.html#l00241">NL3D::CTextureDLM::copyRect()</a>, <a class="el" href="a06768.html#l00712">draw2dLine()</a>, <a class="el" href="a05567.html#l00367">NL3D::CCoarseMeshBuild::expand()</a>, <a class="el" href="a05642.html#l02171">NL3D::CDriverGL::fillBuffer()</a>, <a class="el" href="a06515.html#l00257">NL3D::CTextureDLM::fillRect()</a>, <a class="el" href="a05486.html#l02682">flipH()</a>, <a class="el" href="a05486.html#l02714">flipV()</a>, <a class="el" href="a06163.html#l00214">NL3D::CPatchDLMContext::generate()</a>, <a class="el" href="a05486.html#l02470">getColor()</a>, <a class="el" href="a05486.html#l03048">getDXTC1Texel()</a>, <a class="el" href="a05486.html#l03061">getDXTC3Texel()</a>, <a class="el" href="a05486.html#l03077">getDXTC5Texel()</a>, <a class="el" href="a05486.html#l02980">getRGBAPixel()</a>, <a class="el" href="a05486.html#l01412">getSize()</a>, <a class="el" href="a06525.html#l00039">NL3D::GetTextureSize()</a>, <a class="el" href="a06536.html#l00442">NL3D::CTileBank::getTileNoiseMap()</a>, <a class="el" href="a06768.html#l02927">NL3D::CZoneLighter::lightWater()</a>, <a class="el" href="a06515.html#l00273">NL3D::CTextureDLM::modulateAndfillRect565()</a>, <a class="el" href="a06515.html#l00305">NL3D::CTextureDLM::modulateAndfillRect8888()</a>, <a class="el" href="a06515.html#l00335">NL3D::CTextureDLM::modulateConstantAndfillRect()</a>, <a class="el" href="a06378.html#l00308">NL3D::CShapeBank::processWSUploadTexture()</a>, <a class="el" href="a06768.html#l00444">RenderTriangle()</a>, <a class="el" href="a05486.html#l02781">rot90CCW()</a>, <a class="el" href="a05486.html#l02746">rot90CW()</a>, <a class="el" href="a05790.html#l00092">NL3D::CHLSColorTexture::setBitmap()</a>, <a class="el" href="a05652.html#l00361">NL3D::CDriverGL::setupTextureEx()</a>, <a class="el" href="a05652.html#l00807">NL3D::CDriverGL::uploadTexture()</a>, and <a class="el" href="a05463.html#l00451">NL3D::CAsyncTextureManager::uploadTexturePart()</a>. +<p> +<div class="fragment"><pre>01364 { +01365 <span class="keywordflow">if</span>(mipMap==0) <span class="keywordflow">return</span> <a class="code" href="a02268.html#NL3D_1_1ITexturep5">_Width</a>; +01366 +01367 <a class="code" href="a04558.html#a11">uint32</a> <a class="code" href="a04223.html#a575">w</a> = <a class="code" href="a02268.html#NL3D_1_1ITexturep5">_Width</a>; +01368 <a class="code" href="a04558.html#a11">uint32</a> h = <a class="code" href="a02268.html#NL3D_1_1ITexturep1">_Height</a>; +01369 <a class="code" href="a04558.html#a11">uint32</a> m = 0; +01370 +01371 <span class="keywordflow">do</span> +01372 { +01373 m++; +01374 <a class="code" href="a04223.html#a575">w</a> = (<a class="code" href="a04223.html#a575">w</a>+1)/2; +01375 h = (h+1)/2; +01376 <span class="keywordflow">if</span>(m==mipMap) <span class="keywordflow">return</span> <a class="code" href="a04223.html#a575">w</a>; +01377 } +01378 <span class="keywordflow">while</span>(<a class="code" href="a04223.html#a575">w</a>!=1 || h!=1); +01379 +01380 <span class="keywordflow">return</span> 0; +01381 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1ITexturea23" doxytag="NLMISC::CBitmap::isGrayscaleAsAlpha" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLMISC::CBitmap::isGrayscaleAsAlpha </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const<code> [inline]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Tell if the bitmap loads grayscale bitmap as alpha or luminance format.<p> +<dl compact><dt><b>Returns:</b></dt><dd>true if the bitmap loads grayscale bitmaps as alpha, false if it loads grayscale bitmaps as luminance.</dd></dl> + +<p> +Definition at line <a class="el" href="a05487.html#l00483">483</a> of file <a class="el" href="a05487.html">bitmap.h</a>. +<p> +References <a class="el" href="a05487.html#l00094">_LoadGrayscaleAsAlpha</a>. +<p> +<div class="fragment"><pre>00484 { +00485 <span class="keywordflow">return</span> <a class="code" href="a02268.html#NL3D_1_1ITexturep2">_LoadGrayscaleAsAlpha</a>; +00486 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1ITexturea25" doxytag="NLMISC::CBitmap::load" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a7">uint8</a> NLMISC::CBitmap::load </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02270.html">NLMISC::IStream</a> & </td> + <td class="mdname" nowrap> <em>f</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>mipMapSkip</em> = 0</td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Read a bitmap(TGA or DDS) from an <a class="el" href="a02270.html">IStream</a>. Bitmap supported are DDS (DXTC1, DXTC1 with Alpha, DXTC3, DXTC5, and uncompressed TGA (24 and 32 bits). <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign=top><em>IStream</em> </td><td>The stream must be in reading mode. </td></tr> + <tr><td valign=top><em>mipMapSkip</em> </td><td>if the file is a DDS with mipMap. N=mipMapSkip mipmaps are skipped. </td></tr> + </table> +</dl> +<dl compact><dt><b>Returns:</b></dt><dd>image depth (24 or 32), or 0 if load failed </dd></dl> +<dl compact><dt><b>Exceptions:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign=top><em>ESeekFailed</em> </td><td>: seek has failed</td></tr> + </table> +</dl> + +<p> +Definition at line <a class="el" href="a05486.html#l00109">109</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +References <a class="el" href="a02270.html#NLMISC_1_1IStreamz2036_0NLMISC_1_1IStreamw0">NLMISC::IStream::begin</a>, <a class="el" href="a05487.html#l00059">NLMISC::DDS</a>, <a class="el" href="a05646.html#l01013">depth</a>, <a class="el" href="a05646.html#l01013">height</a>, <a class="el" href="a06463.html#l00064">NLMISC::IStream::isReading()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05486.html#l00244">readDDS()</a>, <a class="el" href="a05486.html#l01800">readTGA()</a>, <a class="el" href="a06461.html#l00401">NLMISC::IStream::seek()</a>, <a class="el" href="a06462.html#l00232">NLMISC::IStream::serial()</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00098">uint16</a>, <a class="el" href="a05981.html#l00100">uint32</a>, <a class="el" href="a05981.html#l00096">uint8</a>, and <a class="el" href="a05646.html#l01013">width</a>. +<p> +Referenced by <a class="el" href="a06521.html#l00041">NL3D::CTextureFile::buildBitmapFromFile()</a>, and <a class="el" href="a06527.html#l00045">NL3D::CTextureMem::doGenerate()</a>. +<p> +<div class="fragment"><pre>00110 { +00111 <a class="code" href="a04199.html#a6">nlassert</a>(f.<a class="code" href="a02270.html#NLMISC_1_1IStreama0">isReading</a>()); +00112 +00113 <span class="comment">// testing if DDS</span> +00114 <a class="code" href="a04558.html#a11">uint32</a> fileType = 0;; +00115 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(fileType); +00116 <span class="keywordflow">if</span>(fileType == <a class="code" href="a05378.html#a41">DDS</a>) +00117 { +00118 <span class="preprocessor">#ifdef NEL_ALL_BITMAP_WHITE</span> +00119 <span class="preprocessor"></span> <a class="code" href="a04558.html#a7">uint8</a> result = <a class="code" href="a02268.html#NLMISC_1_1CBitmapd6">readDDS</a>(f, mipMapSkip); +00120 MakeWhite (*<span class="keyword">this</span>); +00121 <span class="keywordflow">return</span> result; +00122 <span class="preprocessor">#else // NEL_ALL_BITMAP_WHITE</span> +00123 <span class="preprocessor"></span> <span class="keywordflow">return</span> <a class="code" href="a02268.html#NLMISC_1_1CBitmapd6">readDDS</a>(f, mipMapSkip); +00124 <span class="preprocessor">#endif // NEL_ALL_BITMAP_WHITE</span> +00125 <span class="preprocessor"></span> } +00126 <span class="comment">// assuming it's TGA</span> +00127 <span class="keywordflow">else</span> +00128 { +00129 <a class="code" href="a02270.html#NLMISC_1_1IStreamz2036_0">NLMISC::IStream::TSeekOrigin</a> origin= f.<a class="code" href="a02270.html#NLMISC_1_1IStreamz2036_0NLMISC_1_1IStreamw0">begin</a>; +00130 <span class="keywordflow">if</span>(!f.<a class="code" href="a02270.html#NLMISC_1_1IStreamz2036_3">seek</a> (0, origin)) +00131 { +00132 <span class="keywordflow">throw</span> ESeekFailed(); +00133 } +00134 +00135 <span class="comment">// Reading header, </span> +00136 <span class="comment">// To make sure that the bitmap is TGA, we check imageType and imageDepth.</span> +00137 <a class="code" href="a04558.html#a7">uint8</a> lengthID; +00138 <a class="code" href="a04558.html#a7">uint8</a> cMapType; +00139 <a class="code" href="a04558.html#a7">uint8</a> imageType; +00140 <a class="code" href="a04558.html#a9">uint16</a> tgaOrigin; +00141 <a class="code" href="a04558.html#a9">uint16</a> length; +00142 <a class="code" href="a04558.html#a7">uint8</a> <a class="code" href="a04223.html#a634">depth</a>; +00143 <a class="code" href="a04558.html#a9">uint16</a> xOrg; +00144 <a class="code" href="a04558.html#a9">uint16</a> yOrg; +00145 <a class="code" href="a04558.html#a9">uint16</a> <a class="code" href="a04223.html#a632">width</a>; +00146 <a class="code" href="a04558.html#a9">uint16</a> <a class="code" href="a04223.html#a633">height</a>; +00147 <a class="code" href="a04558.html#a7">uint8</a> imageDepth; +00148 <a class="code" href="a04558.html#a7">uint8</a> desc; +00149 +00150 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(lengthID); +00151 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(cMapType); +00152 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(imageType); +00153 <span class="keywordflow">if</span>(imageType!=2 && imageType!=3 && imageType!=10 && imageType!=11) <span class="keywordflow">return</span> 0; +00154 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(tgaOrigin); +00155 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(length); +00156 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(depth); +00157 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(xOrg); +00158 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(yOrg); +00159 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(width); +00160 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(height); +00161 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(imageDepth); +00162 <span class="keywordflow">if</span>(imageDepth!=8 && imageDepth!=16 && imageDepth!=24 && imageDepth!=32) <span class="keywordflow">return</span> 0; +00163 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(desc); +00164 +00165 <span class="keywordflow">if</span>(!f.<a class="code" href="a02270.html#NLMISC_1_1IStreamz2036_3">seek</a> (0, origin)) +00166 { +00167 <span class="keywordflow">throw</span> ESeekFailed(); +00168 } +00169 <span class="preprocessor">#ifdef NEL_ALL_BITMAP_WHITE</span> +00170 <span class="preprocessor"></span> <a class="code" href="a04558.html#a7">uint8</a> result = <a class="code" href="a02268.html#NLMISC_1_1CBitmapd7">readTGA</a>(f); +00171 MakeWhite (*<span class="keyword">this</span>); +00172 <span class="keywordflow">return</span> result; +00173 <span class="preprocessor">#else // NEL_ALL_BITMAP_WHITE</span> +00174 <span class="preprocessor"></span> <span class="keywordflow">return</span> <a class="code" href="a02268.html#NLMISC_1_1CBitmapd7">readTGA</a>(f); +00175 <span class="preprocessor">#endif // NEL_ALL_BITMAP_WHITE</span> +00176 <span class="preprocessor"></span> +00177 } +00178 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1ITexturea26" doxytag="NLMISC::CBitmap::loadGrayscaleAsAlpha" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CBitmap::loadGrayscaleAsAlpha </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">bool </td> + <td class="mdname1" valign="top" nowrap> <em>loadAsAlpha</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [inline]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Tell the bitmap to load grayscale bitmap as alpha or luminance format.<p> +<dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign=top><em>loadAsAlpha</em> </td><td>is true to load grayscale bitmaps as alpha. false to load grayscale bitmaps as luminance. default value is true.</td></tr> + </table> +</dl> + +<p> +Definition at line <a class="el" href="a05487.html#l00472">472</a> of file <a class="el" href="a05487.html">bitmap.h</a>. +<p> +References <a class="el" href="a05487.html#l00094">_LoadGrayscaleAsAlpha</a>. +<p> +Referenced by <a class="el" href="a06521.html#l00041">NL3D::CTextureFile::buildBitmapFromFile()</a>, and <a class="el" href="a06536.html#l00442">NL3D::CTileBank::getTileNoiseMap()</a>. +<p> +<div class="fragment"><pre>00473 { +00474 <a class="code" href="a02268.html#NL3D_1_1ITexturep2">_LoadGrayscaleAsAlpha</a>=loadAsAlpha; +00475 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1ITexturee0" doxytag="NLMISC::CBitmap::loadSize" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CBitmap::loadSize </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::string & </td> + <td class="mdname" nowrap> <em>path</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a11">uint32</a> & </td> + <td class="mdname" nowrap> <em>retWidth</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a11">uint32</a> & </td> + <td class="mdname" nowrap> <em>retHeight</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +same than other <a class="el" href="a02268.html#NL3D_1_1ITexturee1">loadSize()</a>, but with a pathName. <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="a02268.html#NL3D_1_1ITexturee1">loadSize()</a></dd></dl> + +<p> +Definition at line <a class="el" href="a05486.html#l02671">2671</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +References <a class="el" href="a05486.html#l02582">loadSize()</a>, <a class="el" href="a05708.html#l00135">NLMISC::CIFile::open()</a>, and <a class="el" href="a05981.html#l00100">uint32</a>. +<p> +<div class="fragment"><pre>02672 { +02673 retWidth= 0; +02674 retHeight= 0; +02675 +02676 <a class="code" href="a02653.html">CIFile</a> f(path); +02677 <span class="keywordflow">if</span>(f.<a class="code" href="a02653.html#NLMISC_1_1CIFilea12">open</a>(path)) +02678 <a class="code" href="a02268.html#NL3D_1_1ITexturee1">loadSize</a>(f, retWidth, retHeight); +02679 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1ITexturee1" doxytag="NLMISC::CBitmap::loadSize" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CBitmap::loadSize </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02270.html">NLMISC::IStream</a> & </td> + <td class="mdname" nowrap> <em>f</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a11">uint32</a> & </td> + <td class="mdname" nowrap> <em>width</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a11">uint32</a> & </td> + <td class="mdname" nowrap> <em>height</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Determinate the bitmap size from a bitmap(TGA or DDS) from an <a class="el" href="a02270.html">IStream</a>. load just header of the file. Bitmap supported are DDS (DXTC1, DXTC1 with Alpha, DXTC3, DXTC5, and uncompressed TGA (24 and 32 bits). NB: at the end, f is seeked to begin. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign=top><em>IStream</em> </td><td>The stream must be in reading mode. </td></tr> + <tr><td valign=top><em>width</em> </td><td>the width of the image. 0 if fails. </td></tr> + <tr><td valign=top><em>height</em> </td><td>the height of the image. 0 if fails. </td></tr> + </table> +</dl> +<dl compact><dt><b>Exceptions:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign=top><em>ESeekFailed</em> </td><td>: seek has failed</td></tr> + </table> +</dl> + +<p> +Definition at line <a class="el" href="a05486.html#l02582">2582</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +References <a class="el" href="a05487.html#l00059">NLMISC::DDS</a>, <a class="el" href="a05487.html#l00064">DDSD_LINEARSIZE</a>, <a class="el" href="a05646.html#l01013">depth</a>, <a class="el" href="a05646.html#l01013">height</a>, <a class="el" href="a06463.html#l00064">NLMISC::IStream::isReading()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a06461.html#l00401">NLMISC::IStream::seek()</a>, <a class="el" href="a06462.html#l00232">NLMISC::IStream::serial()</a>, <a class="el" href="a05646.html#l00645">size</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00098">uint16</a>, <a class="el" href="a05981.html#l00100">uint32</a>, <a class="el" href="a05981.html#l00096">uint8</a>, and <a class="el" href="a05646.html#l01013">width</a>. +<p> +Referenced by <a class="el" href="a05486.html#l02671">loadSize()</a>. +<p> +<div class="fragment"><pre>02583 { +02584 retWidth= 0; +02585 retHeight= 0; +02586 +02587 +02588 <a class="code" href="a04199.html#a6">nlassert</a>(f.<a class="code" href="a02270.html#NLMISC_1_1IStreama0">isReading</a>()); +02589 +02590 <span class="comment">// testing if DDS</span> +02591 <a class="code" href="a04558.html#a11">uint32</a> fileType = 0; +02592 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(fileType); +02593 <span class="keywordflow">if</span>(fileType == <a class="code" href="a05378.html#a41">DDS</a>) +02594 { +02595 <span class="comment">// read entire DDS header.</span> +02596 <a class="code" href="a04558.html#a11">uint32</a> <a class="code" href="a04223.html#a587">size</a> = 0; +02597 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(size); <span class="comment">// size in Bytes of header(without "DDS")</span> +02598 <a class="code" href="a04558.html#a11">uint32</a> * _DDSSurfaceDesc = <span class="keyword">new</span> <a class="code" href="a04558.html#a11">uint32</a>[<a class="code" href="a04223.html#a587">size</a>]; +02599 std::auto_ptr<uint32> _DDSSurfaceDescAuto(_DDSSurfaceDesc); +02600 _DDSSurfaceDesc[0]= <a class="code" href="a04223.html#a587">size</a>; +02601 +02602 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> i= 0; i<<a class="code" href="a04223.html#a587">size</a>/4 - 1; i++) +02603 { +02604 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(_DDSSurfaceDesc[i+1]); +02605 } +02606 +02607 <span class="comment">// flags determines which members of the header structure contain valid data</span> +02608 <a class="code" href="a04558.html#a11">uint32</a> flags = _DDSSurfaceDesc[1]; +02609 +02610 <span class="comment">//verify if file have linearsize set</span> +02611 <span class="keywordflow">if</span>(!(flags & <a class="code" href="a04064.html#a1">DDSD_LINEARSIZE</a>)) +02612 { +02613 <span class="keywordflow">throw</span> EDDSBadHeader(); +02614 } +02615 +02616 <span class="comment">//-------------- extracting and testing useful info</span> +02617 retHeight = _DDSSurfaceDesc[2]; +02618 retWidth = _DDSSurfaceDesc[3]; +02619 } +02620 <span class="comment">// assuming it's TGA</span> +02621 <span class="keywordflow">else</span> +02622 { +02623 <span class="keywordflow">if</span>(!f.<a class="code" href="a02270.html#NLMISC_1_1IStreamz2036_3">seek</a> (0, NLMISC::IStream::begin)) +02624 { +02625 <span class="keywordflow">throw</span> ESeekFailed(); +02626 } +02627 +02628 <span class="comment">// Reading header, </span> +02629 <span class="comment">// To make sure that the bitmap is TGA, we check imageType and imageDepth.</span> +02630 <a class="code" href="a04558.html#a7">uint8</a> lengthID; +02631 <a class="code" href="a04558.html#a7">uint8</a> cMapType; +02632 <a class="code" href="a04558.html#a7">uint8</a> imageType; +02633 <a class="code" href="a04558.html#a9">uint16</a> tgaOrigin; +02634 <a class="code" href="a04558.html#a9">uint16</a> length; +02635 <a class="code" href="a04558.html#a7">uint8</a> <a class="code" href="a04223.html#a634">depth</a>; +02636 <a class="code" href="a04558.html#a9">uint16</a> xOrg; +02637 <a class="code" href="a04558.html#a9">uint16</a> yOrg; +02638 <a class="code" href="a04558.html#a9">uint16</a> <a class="code" href="a04223.html#a632">width</a>; +02639 <a class="code" href="a04558.html#a9">uint16</a> <a class="code" href="a04223.html#a633">height</a>; +02640 <a class="code" href="a04558.html#a7">uint8</a> imageDepth; +02641 <a class="code" href="a04558.html#a7">uint8</a> desc; +02642 +02643 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(lengthID); +02644 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(cMapType); +02645 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(imageType); +02646 <span class="keywordflow">if</span>(imageType!=2 && imageType!=3 && imageType!=10 && imageType!=11) <span class="keywordflow">return</span>; +02647 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(tgaOrigin); +02648 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(length); +02649 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(depth); +02650 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(xOrg); +02651 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(yOrg); +02652 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(width); +02653 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(height); +02654 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(imageDepth); +02655 <span class="keywordflow">if</span>(imageDepth!=8 && imageDepth!=24 && imageDepth!=32) <span class="keywordflow">return</span>; +02656 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(desc); +02657 +02658 <span class="comment">// Ok, we have width and height.</span> +02659 retWidth= <a class="code" href="a04223.html#a632">width</a>; +02660 retHeight= <a class="code" href="a04223.html#a633">height</a>; +02661 } +02662 +02663 <span class="comment">// reset stream.</span> +02664 <span class="keywordflow">if</span>(!f.<a class="code" href="a02270.html#NLMISC_1_1IStreamz2036_3">seek</a> (0, NLMISC::IStream::begin)) +02665 { +02666 <span class="keywordflow">throw</span> ESeekFailed(); +02667 } +02668 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBitmapz1925_11" doxytag="NLMISC::CBitmap::luminanceToAlpha" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLMISC::CBitmap::luminanceToAlpha </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05486.html#l00736">736</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +References <a class="el" href="a05487.html#l00093">_MipMapCount</a>, <a class="el" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>, <a class="el" href="a06116.html#l00142">NLMISC::CObjectVector< T, EnableObjectBehavior >::resize()</a>, <a class="el" href="a06116.html#l00184">NLMISC::CObjectVector< uint8 >::size()</a>, <a class="el" href="a05538.html#l02935">size</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00100">uint32</a>, and <a class="el" href="a05981.html#l00096">uint8</a>. +<p> +Referenced by <a class="el" href="a05486.html#l00821">convertToAlpha()</a>. +<p> +<div class="fragment"><pre>00737 { +00738 <a class="code" href="a04558.html#a11">uint32</a> i; +00739 +00740 <span class="keywordflow">if</span>(<a class="code" href="a02268.html#NL3D_1_1ITexturep5">_Width</a>*<a class="code" href="a02268.html#NL3D_1_1ITexturep1">_Height</a> == 0) <span class="keywordflow">return</span> <span class="keyword">false</span>; +00741 +00742 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a7">uint8</a> m= 0; m<<a class="code" href="a02268.html#NL3D_1_1ITexturep3">_MipMapCount</a>; m++) +00743 { +00744 CObjectVector<uint8> dataTmp; +00745 dataTmp.resize(_Data[m].<a class="code" href="a04115.html#a94">size</a>()); +00746 <a class="code" href="a04558.html#a15">uint</a> dstId= 0; +00747 +00748 <span class="keywordflow">for</span>(i=0; i<<a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[m].size(); i++) +00749 { +00750 dataTmp[dstId++]= _Data[m][i]; +00751 } +00752 _Data[m] = dataTmp; +00753 } +00754 <a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a> = <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw0">Alpha</a>; +00755 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00756 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBitmapz1925_12" doxytag="NLMISC::CBitmap::luminanceToAlphaLuminance" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLMISC::CBitmap::luminanceToAlphaLuminance </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05486.html#l00579">579</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +References <a class="el" href="a05487.html#l00093">_MipMapCount</a>, <a class="el" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>, <a class="el" href="a06116.html#l00142">NLMISC::CObjectVector< T, EnableObjectBehavior >::resize()</a>, <a class="el" href="a06116.html#l00184">NLMISC::CObjectVector< uint8 >::size()</a>, <a class="el" href="a05538.html#l02935">size</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00100">uint32</a>, and <a class="el" href="a05981.html#l00096">uint8</a>. +<p> +Referenced by <a class="el" href="a05486.html#l00852">convertToAlphaLuminance()</a>. +<p> +<div class="fragment"><pre>00580 { +00581 <a class="code" href="a04558.html#a11">uint32</a> i; +00582 +00583 <span class="keywordflow">if</span>(<a class="code" href="a02268.html#NL3D_1_1ITexturep5">_Width</a>*<a class="code" href="a02268.html#NL3D_1_1ITexturep1">_Height</a> == 0) <span class="keywordflow">return</span> <span class="keyword">false</span>; +00584 +00585 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a7">uint8</a> m= 0; m<<a class="code" href="a02268.html#NL3D_1_1ITexturep3">_MipMapCount</a>; m++) +00586 { +00587 CObjectVector<uint8> dataTmp; +00588 dataTmp.resize(_Data[m].<a class="code" href="a04115.html#a94">size</a>()*2); +00589 <a class="code" href="a04558.html#a15">uint</a> dstId= 0; +00590 +00591 <span class="keywordflow">for</span>(i=0; i<<a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[m].size(); i++) +00592 { +00593 dataTmp[dstId++]= _Data[m][i]; +00594 dataTmp[dstId++]= 255; +00595 } +00596 _Data[m] = dataTmp; +00597 } +00598 <a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a> = <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw1">AlphaLuminance</a>; +00599 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00600 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBitmapz1925_13" doxytag="NLMISC::CBitmap::luminanceToRGBA" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLMISC::CBitmap::luminanceToRGBA </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05486.html#l00462">462</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +References <a class="el" href="a05487.html#l00093">_MipMapCount</a>, <a class="el" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>, <a class="el" href="a06116.html#l00142">NLMISC::CObjectVector< T, EnableObjectBehavior >::resize()</a>, <a class="el" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew25">RGBA</a>, <a class="el" href="a06116.html#l00184">NLMISC::CObjectVector< uint8 >::size()</a>, <a class="el" href="a05538.html#l02935">size</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00100">uint32</a>, and <a class="el" href="a05981.html#l00096">uint8</a>. +<p> +Referenced by <a class="el" href="a05486.html#l00882">convertToRGBA()</a>. +<p> +<div class="fragment"><pre>00463 { +00464 <a class="code" href="a04558.html#a11">uint32</a> i; +00465 +00466 <span class="keywordflow">if</span>(<a class="code" href="a02268.html#NL3D_1_1ITexturep5">_Width</a>*<a class="code" href="a02268.html#NL3D_1_1ITexturep1">_Height</a> == 0) <span class="keywordflow">return</span> <span class="keyword">false</span>; +00467 +00468 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a7">uint8</a> m= 0; m<<a class="code" href="a02268.html#NL3D_1_1ITexturep3">_MipMapCount</a>; m++) +00469 { +00470 CObjectVector<uint8> dataTmp; +00471 dataTmp.resize(_Data[m].<a class="code" href="a04115.html#a94">size</a>()*4); +00472 <a class="code" href="a04558.html#a15">uint</a> dstId= 0; +00473 +00474 <span class="keywordflow">for</span>(i=0; i<<a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[m].size(); i++) +00475 { +00476 dataTmp[dstId++]= _Data[m][i]; +00477 dataTmp[dstId++]= _Data[m][i]; +00478 dataTmp[dstId++]= _Data[m][i]; +00479 dataTmp[dstId++]= 255; +00480 } +00481 _Data[m] = dataTmp; +00482 } +00483 <a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a> = <a class="code" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew25">RGBA</a>; +00484 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00485 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1ITexturea27" doxytag="NLMISC::CBitmap::makeDummy" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CBitmap::makeDummy </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Make a dummy "?" texture. Usefull for file not found. Mode is rgba. +<p> +Definition at line <a class="el" href="a05486.html#l00184">184</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +References <a class="el" href="a05487.html#l00093">_MipMapCount</a>, <a class="el" href="a06116.html#l00195">NLMISC::CObjectVector< uint8 >::getPtr()</a>, <a class="el" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>, <a class="el" href="a06116.html#l00142">NLMISC::CObjectVector< uint8 >::resize()</a>, <a class="el" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew25">RGBA</a>, <a class="el" href="a06339.html#l00066">NLMISC::CRGBA::set()</a>, <a class="el" href="a05981.html#l00104">sint</a>, and <a class="el" href="a05981.html#l00096">uint8</a>. +<p> +Referenced by <a class="el" href="a06521.html#l00041">NL3D::CTextureFile::buildBitmapFromFile()</a>, <a class="el" href="a06250.html#l00092">NL3D::CreateDummyMesh()</a>, <a class="el" href="a06529.html#l00077">NL3D::CTextureMultiFile::doGenerate()</a>, <a class="el" href="a06527.html#l00045">NL3D::CTextureMem::doGenerate()</a>, <a class="el" href="a06525.html#l00178">NL3D::CTextureGrouped::doGenerate()</a>, <a class="el" href="a06517.html#l00101">NL3D::CTextureEmboss::doGenerate()</a>, <a class="el" href="a06511.html#l00277">NL3D::CTextureBump::doGenerate()</a>, and <a class="el" href="a06509.html#l00102">NL3D::CTextureBlend::doGenerate()</a>. +<p> +<div class="fragment"><pre>00185 { +00186 <span class="keyword">static</span> <span class="keyword">const</span> <a class="code" href="a04558.html#a7">uint8</a> bitmap[1024]= { +00187 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +00188 0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0, +00189 0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0, +00190 0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0, +00191 0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0, +00192 0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0, +00193 0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0, +00194 0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0, +00195 0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,0, +00196 0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0, +00197 0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0, +00198 0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0, +00199 0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0, +00200 0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0, +00201 0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0, +00202 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +00203 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +00204 0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0, +00205 0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0, +00206 0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0, +00207 0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0, +00208 0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0, +00209 0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0, +00210 0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0, +00211 0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,0, +00212 0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0, +00213 0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0, +00214 0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0, +00215 0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0, +00216 0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0, +00217 0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0, +00218 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +00219 }; +00220 +00221 <a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a> = <a class="code" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew25">RGBA</a>; +00222 <a class="code" href="a02268.html#NL3D_1_1ITexturep3">_MipMapCount</a> = 1; +00223 <a class="code" href="a02268.html#NL3D_1_1ITexturep5">_Width</a>= 32; +00224 <a class="code" href="a02268.html#NL3D_1_1ITexturep1">_Height</a>= 32; +00225 <a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[0].resize(_Width*_Height*<span class="keyword">sizeof</span>(<a class="code" href="a03337.html">NLMISC::CRGBA</a>)); +00226 <a class="code" href="a03337.html">NLMISC::CRGBA</a> *pix= (<a class="code" href="a03337.html">NLMISC::CRGBA</a>*)(<a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[0].getPtr()); +00227 +00228 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a14">sint</a> i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)(<a class="code" href="a02268.html#NL3D_1_1ITexturep5">_Width</a>*<a class="code" href="a02268.html#NL3D_1_1ITexturep1">_Height</a>);i++) +00229 { +00230 <span class="keywordflow">if</span>(bitmap[i]) +00231 pix[i].<a class="code" href="a03337.html#NLMISC_1_1CRGBAa14">set</a>(255,255,255,255); +00232 <span class="keywordflow">else</span> +00233 pix[i].<a class="code" href="a03337.html#NLMISC_1_1CRGBAa14">set</a>(0x80,0x80,0x80,0x40); +00234 } +00235 +00236 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBitmapd6" doxytag="NLMISC::CBitmap::readDDS" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a7">uint8</a> NLMISC::CBitmap::readDDS </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02270.html">NLMISC::IStream</a> & </td> + <td class="mdname" nowrap> <em>f</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>mipMapSkip</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Read a DDS from an <a class="el" href="a02270.html">IStream</a>. The bitmap is readen as a set of bytes and stocked compressed. Width and Height are multiple of 4. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign=top><em>IStream</em> </td><td>The stream must be in reading mode. </td></tr> + </table> +</dl> +<dl compact><dt><b>Returns:</b></dt><dd>image depth </dd></dl> +<dl compact><dt><b>Exceptions:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign=top><em>EDDSBadHeader</em> </td><td>: surface is header is not valid.</td></tr> + </table> +</dl> + +<p> +Definition at line <a class="el" href="a05486.html#l00244">244</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +References <a class="el" href="a05487.html#l00093">_MipMapCount</a>, <a class="el" href="a05487.html#l00064">DDSD_LINEARSIZE</a>, <a class="el" href="a05486.html#l00083">DXTC1HEADER</a>, <a class="el" href="a05486.html#l00084">DXTC3HEADER</a>, <a class="el" href="a05486.html#l00085">DXTC5HEADER</a>, <a class="el" href="a05586.html#l00358">NLMISC::getPowerOf2()</a>, <a class="el" href="a05484.html#l00038">min</a>, <a class="el" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>, <a class="el" href="a06116.html#l00142">NLMISC::CObjectVector< uint8 >::resize()</a>, <a class="el" href="a06461.html#l00401">NLMISC::IStream::seek()</a>, <a class="el" href="a06462.html#l00232">NLMISC::IStream::serial()</a>, <a class="el" href="a02270.html#NLMISC_1_1IStreamz2041_1">NLMISC::IStream::serialBuffer()</a>, <a class="el" href="a06116.html#l00184">NLMISC::CObjectVector< uint8 >::size()</a>, <a class="el" href="a05646.html#l00645">size</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00100">uint32</a>, <a class="el" href="a05981.html#l00096">uint8</a>, and <a class="el" href="a05646.html#l00236">w</a>. +<p> +Referenced by <a class="el" href="a05486.html#l00109">load()</a>. +<p> +<div class="fragment"><pre>00245 { +00246 <span class="comment">//------------------ Reading Header ------------------------</span> +00247 +00248 <span class="comment">//-------------- reading entire header</span> +00249 +00250 <a class="code" href="a04558.html#a11">uint32</a> <a class="code" href="a04223.html#a587">size</a> = 0; +00251 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(size); <span class="comment">// size in Bytes of header(without "DDS")</span> +00252 <a class="code" href="a04558.html#a11">uint32</a> * _DDSSurfaceDesc = <span class="keyword">new</span> <a class="code" href="a04558.html#a11">uint32</a>[<a class="code" href="a04223.html#a587">size</a>]; +00253 std::auto_ptr<uint32> _DDSSurfaceDescAuto(_DDSSurfaceDesc); +00254 _DDSSurfaceDesc[0]= <a class="code" href="a04223.html#a587">size</a>; +00255 +00256 <span class="preprocessor">#ifdef NL_LITTLE_ENDIAN</span> +00257 <span class="preprocessor"></span> f.<a class="code" href="a02270.html#NLMISC_1_1IStreamz2041_1">serialBuffer</a>((<a class="code" href="a04558.html#a7">uint8</a>*)(_DDSSurfaceDesc+1), size-4); +00258 <span class="preprocessor">#else</span> +00259 <span class="preprocessor"></span> <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> i= 0; i<<a class="code" href="a04223.html#a587">size</a>/4 - 1; i++) +00260 { +00261 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(_DDSSurfaceDesc[i+1]); +00262 } +00263 <span class="preprocessor">#endif</span> +00264 <span class="preprocessor"></span> +00265 <span class="comment">// flags determines which members of the header structure contain valid data</span> +00266 <a class="code" href="a04558.html#a11">uint32</a> flags = _DDSSurfaceDesc[1]; +00267 +00268 <span class="comment">//verify if file have linearsize set</span> +00269 <span class="keywordflow">if</span>(!(flags & <a class="code" href="a04064.html#a1">DDSD_LINEARSIZE</a>)) +00270 { +00271 <span class="keywordflow">throw</span> EDDSBadHeader(); +00272 } +00273 +00274 <span class="comment">//-------------- extracting and testing useful info</span> +00275 +00276 <a class="code" href="a02268.html#NL3D_1_1ITexturep1">_Height</a> = _DDSSurfaceDesc[2]; +00277 <a class="code" href="a02268.html#NL3D_1_1ITexturep5">_Width</a> = _DDSSurfaceDesc[3]; +00278 <a class="code" href="a02268.html#NL3D_1_1ITexturep3">_MipMapCount</a>= (<a class="code" href="a04558.html#a7">uint8</a>) _DDSSurfaceDesc[6]; +00279 <span class="comment">// If no mipmap.</span> +00280 <span class="keywordflow">if</span>(<a class="code" href="a02268.html#NL3D_1_1ITexturep3">_MipMapCount</a>==0) +00281 <a class="code" href="a02268.html#NL3D_1_1ITexturep3">_MipMapCount</a>=1; +00282 <span class="keywordflow">switch</span> (_DDSSurfaceDesc[20]) +00283 { +00284 <span class="keywordflow">case</span> <a class="code" href="a02268.html#NL3D_1_1ITextures1">DXTC1HEADER</a>: +00285 <a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>=<a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw4">DXTC1</a>; +00286 <span class="keywordflow">break</span>; +00287 <span class="keywordflow">case</span> <a class="code" href="a02268.html#NL3D_1_1ITextures2">DXTC3HEADER</a>: +00288 <a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>=<a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw6">DXTC3</a>; +00289 <span class="keywordflow">break</span>; +00290 <span class="keywordflow">case</span> <a class="code" href="a02268.html#NL3D_1_1ITextures3">DXTC5HEADER</a>: +00291 <a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>=<a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw7">DXTC5</a>; +00292 <span class="keywordflow">break</span>; +00293 } +00294 +00295 flags = _DDSSurfaceDesc[19]; <span class="comment">//PixelFormat flags</span> +00296 +00297 <span class="keywordflow">if</span>(<a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>==<a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw4">DXTC1</a> && _DDSSurfaceDesc[21]>0) <span class="comment">//AlphaBitDepth</span> +00298 { +00299 <a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a> = <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw5">DXTC1Alpha</a>; +00300 } +00301 +00302 <span class="keywordflow">if</span>(<a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>!= <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw4">DXTC1</a> && <a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>!= <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw5">DXTC1Alpha</a> && <a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>!= <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw6">DXTC3</a> && <a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>!= <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw7">DXTC5</a>) +00303 { +00304 <span class="keywordflow">throw</span> EDDSBadHeader(); +00305 } +00306 +00307 <span class="comment">// compute the min power of 2 between width and height</span> +00308 <a class="code" href="a04558.html#a15">uint</a> minSizeLevel= <a class="code" href="a04061.html#a0">min</a>(_Width, _Height); +00309 minSizeLevel= <a class="code" href="a05378.html#a263">getPowerOf2</a>(minSizeLevel); +00310 +00311 <span class="comment">//------------- manage mipMapSkip </span> +00312 <span class="keywordflow">if</span>(<a class="code" href="a02268.html#NL3D_1_1ITexturep3">_MipMapCount</a>>1 && mipMapSkip>0 && minSizeLevel>2) +00313 { +00314 <span class="comment">// Keep at least the level where width and height are at leat 4.</span> +00315 mipMapSkip= <a class="code" href="a04061.html#a0">min</a>(mipMapSkip, minSizeLevel-2); +00316 <span class="comment">// skip any mipmap</span> +00317 <a class="code" href="a04558.html#a15">uint</a> seekSize= 0; +00318 <span class="keywordflow">while</span>(mipMapSkip>0) +00319 { +00320 <a class="code" href="a04558.html#a11">uint32</a> mipMapSz; +00321 <span class="keywordflow">if</span>(<a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>==<a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw4">DXTC1</a> || <a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>==<a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw5">DXTC1Alpha</a>) +00322 mipMapSz = <a class="code" href="a02268.html#NL3D_1_1ITexturep5">_Width</a>*<a class="code" href="a02268.html#NL3D_1_1ITexturep1">_Height</a>/2; +00323 <span class="keywordflow">else</span> +00324 mipMapSz = <a class="code" href="a02268.html#NL3D_1_1ITexturep5">_Width</a>*<a class="code" href="a02268.html#NL3D_1_1ITexturep1">_Height</a>; +00325 +00326 <span class="comment">// add to how many to skip</span> +00327 seekSize+= mipMapSz; +00328 +00329 <span class="comment">// Size of final bitmap is reduced.</span> +00330 <a class="code" href="a02268.html#NL3D_1_1ITexturep5">_Width</a>>>=1; +00331 _Height>>=1; +00332 <a class="code" href="a02268.html#NL3D_1_1ITexturep3">_MipMapCount</a>--; +00333 mipMapSkip--; +00334 } +00335 <span class="comment">// skip data in file</span> +00336 <span class="keywordflow">if</span>(seekSize>0) +00337 { +00338 <span class="keywordflow">if</span>(!f.<a class="code" href="a02270.html#NLMISC_1_1IStreamz2036_3">seek</a>(seekSize, IStream::current)) +00339 { +00340 <span class="keywordflow">throw</span> ESeekFailed(); +00341 } +00342 } +00343 +00344 } +00345 +00346 <span class="comment">//------------- preload all the mipmaps (one serialBuffer() is faster)</span> +00347 <a class="code" href="a04558.html#a11">uint32</a> <a class="code" href="a04223.html#a575">w</a> = <a class="code" href="a02268.html#NL3D_1_1ITexturep5">_Width</a>; +00348 <a class="code" href="a04558.html#a11">uint32</a> h = <a class="code" href="a02268.html#NL3D_1_1ITexturep1">_Height</a>; +00349 <a class="code" href="a04558.html#a11">uint32</a> totalSize= 0; +00350 +00351 <a class="code" href="a04558.html#a7">uint8</a> m; +00352 <span class="keywordflow">for</span>(m= 0; m<<a class="code" href="a02268.html#NL3D_1_1ITexturep3">_MipMapCount</a>; m++) +00353 { +00354 <a class="code" href="a04558.html#a11">uint32</a> wtmp, htmp; +00355 <span class="keywordflow">if</span>(<a class="code" href="a04223.html#a575">w</a><4) +00356 wtmp = 4; +00357 <span class="keywordflow">else</span> +00358 wtmp = <a class="code" href="a04223.html#a575">w</a>; +00359 <span class="keywordflow">if</span>(h < 4) +00360 htmp = 4; +00361 <span class="keywordflow">else</span> +00362 htmp = h; +00363 +00364 <a class="code" href="a04558.html#a11">uint32</a> mipMapSz; +00365 <span class="keywordflow">if</span>(<a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>==<a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw4">DXTC1</a> || <a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>==<a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw5">DXTC1Alpha</a>) +00366 mipMapSz = wtmp*htmp/2; +00367 <span class="keywordflow">else</span> +00368 mipMapSz = wtmp*htmp; +00369 +00370 +00371 <a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[m].resize(mipMapSz); +00372 totalSize+= mipMapSz; +00373 +00374 <a class="code" href="a04223.html#a575">w</a> = (<a class="code" href="a04223.html#a575">w</a>+1)/2; +00375 h = (h+1)/2; +00376 } +00377 +00378 <span class="comment">// Read all the data in one block.</span> +00379 vector<uint8> pixData; +00380 pixData.resize(totalSize); +00381 f.<a class="code" href="a02270.html#NLMISC_1_1IStreamz2041_1">serialBuffer</a>(&(*pixData.begin()), totalSize); +00382 +00383 +00384 <span class="comment">//------------- reading mipmap levels from pixData</span> +00385 +00386 <a class="code" href="a04558.html#a11">uint32</a> pixIndex= 0; +00387 +00388 <span class="keywordflow">for</span>(m= 0; m<_MipMapCount; m++) +00389 { +00390 <a class="code" href="a04558.html#a11">uint32</a> mipMapSz= <a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[m].size(); +00391 memcpy(_Data[m].getPtr(), &(pixData[pixIndex]), mipMapSz); +00392 pixIndex+= mipMapSz; +00393 } +00394 +00395 <span class="comment">//------------- End</span> +00396 +00397 <span class="keywordflow">switch</span>(<a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>) +00398 { +00399 <span class="keywordflow">case</span> <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw4">DXTC1</a> : <span class="keywordflow">return</span> 24; +00400 <span class="keywordflow">case</span> <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw5">DXTC1Alpha</a> : <span class="keywordflow">return</span> 32; +00401 <span class="keywordflow">case</span> <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw6">DXTC3</a> : <span class="keywordflow">return</span> 32; +00402 <span class="keywordflow">case</span> <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw7">DXTC5</a> : <span class="keywordflow">return</span> 32; +00403 <span class="keywordflow">default</span> : <span class="keywordflow">break</span>; +00404 } +00405 +00406 <span class="keywordflow">return</span> 0; +00407 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBitmapd7" doxytag="NLMISC::CBitmap::readTGA" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a7">uint8</a> NLMISC::CBitmap::readTGA </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02270.html">NLMISC::IStream</a> & </td> + <td class="mdname1" valign="top" nowrap> <em>f</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Read a TGA from an <a class="el" href="a02270.html">IStream</a>. TGA pictures can be in 24 or 32 bits, RLE or uncompressed <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign=top><em>f</em> </td><td><a class="el" href="a02270.html">IStream</a> (must be a reading stream) </td></tr> + </table> +</dl> +<dl compact><dt><b>Returns:</b></dt><dd>image depth if succeed, 0 else</dd></dl> + +<p> +Definition at line <a class="el" href="a05486.html#l01800">1800</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +References <a class="el" href="a05487.html#l00094">_LoadGrayscaleAsAlpha</a>, <a class="el" href="a05487.html#l00093">_MipMapCount</a>, <a class="el" href="a02270.html#NLMISC_1_1IStreamz2036_0NLMISC_1_1IStreamw0">NLMISC::IStream::begin</a>, <a class="el" href="a05646.html#l01013">depth</a>, <a class="el" href="a02270.html#NLMISC_1_1IStreamz2036_0NLMISC_1_1IStreamw2">NLMISC::IStream::end</a>, <a class="el" href="a06461.html#l00407">NLMISC::IStream::getPos()</a>, <a class="el" href="a05646.html#l01013">height</a>, <a class="el" href="a05646.html#l01013">imageSize</a>, <a class="el" href="a06463.html#l00064">NLMISC::IStream::isReading()</a>, <a class="el" href="a05622.html#l00111">nlinfo</a>, <a class="el" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>, <a class="el" href="a05646.html#l00993">r</a>, <a class="el" href="a06116.html#l00142">NLMISC::CObjectVector< uint8 >::resize()</a>, <a class="el" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew25">RGBA</a>, <a class="el" href="a06461.html#l00401">NLMISC::IStream::seek()</a>, <a class="el" href="a06462.html#l00232">NLMISC::IStream::serial()</a>, <a class="el" href="a02270.html#NLMISC_1_1IStreamz2041_1">NLMISC::IStream::serialBuffer()</a>, <a class="el" href="a05981.html#l00099">sint32</a>, <a class="el" href="a05646.html#l00645">size</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00098">uint16</a>, <a class="el" href="a05981.html#l00100">uint32</a>, <a class="el" href="a05981.html#l00096">uint8</a>, <a class="el" href="a05646.html#l01013">width</a>, <a class="el" href="a05646.html#l00236">x</a>, and <a class="el" href="a05646.html#l00236">y</a>. +<p> +Referenced by <a class="el" href="a05486.html#l00109">load()</a>. +<p> +<div class="fragment"><pre>01801 { +01802 <span class="keywordflow">if</span>(!f.<a class="code" href="a02270.html#NLMISC_1_1IStreama0">isReading</a>()) <span class="keywordflow">return</span> 0; +01803 +01804 <a class="code" href="a04558.html#a11">uint32</a> <a class="code" href="a04223.html#a587">size</a>; +01805 <a class="code" href="a04558.html#a11">uint32</a> <a class="code" href="a04223.html#a572">x</a>,<a class="code" href="a04223.html#a573">y</a>; +01806 <a class="code" href="a04558.html#a10">sint32</a> slsize; +01807 <a class="code" href="a04558.html#a7">uint8</a> *scanline; +01808 <a class="code" href="a04558.html#a7">uint8</a> <a class="code" href="a04223.html#a628">r</a>,g,b; +01809 <a class="code" href="a04558.html#a10">sint32</a> i,j,k; +01810 +01811 <span class="comment">// TGA file header fields</span> +01812 <a class="code" href="a04558.html#a7">uint8</a> lengthID; +01813 <a class="code" href="a04558.html#a7">uint8</a> cMapType; +01814 <a class="code" href="a04558.html#a7">uint8</a> imageType; +01815 <a class="code" href="a04558.html#a9">uint16</a> origin; +01816 <a class="code" href="a04558.html#a9">uint16</a> length; +01817 <a class="code" href="a04558.html#a7">uint8</a> <a class="code" href="a04223.html#a634">depth</a>; +01818 <a class="code" href="a04558.html#a9">uint16</a> xOrg; +01819 <a class="code" href="a04558.html#a9">uint16</a> yOrg; +01820 <a class="code" href="a04558.html#a9">uint16</a> <a class="code" href="a04223.html#a632">width</a>; +01821 <a class="code" href="a04558.html#a9">uint16</a> <a class="code" href="a04223.html#a633">height</a>; +01822 <a class="code" href="a04558.html#a7">uint8</a> imageDepth; +01823 <a class="code" href="a04558.html#a7">uint8</a> desc; +01824 +01825 <span class="comment">// Image/Color map data</span> +01826 <a class="code" href="a04558.html#a7">uint8</a> *imageID; +01827 +01828 +01829 +01830 <span class="comment">// Determining whether file is in Original or New TGA format</span> +01831 +01832 <span class="keywordtype">bool</span> newTgaFormat; +01833 <a class="code" href="a04558.html#a11">uint32</a> extAreaOffset; +01834 <a class="code" href="a04558.html#a11">uint32</a> devDirectoryOffset; +01835 <span class="keywordtype">char</span> signature[16]; +01836 +01837 f.<a class="code" href="a02270.html#NLMISC_1_1IStreamz2036_3">seek</a> (0, f.<a class="code" href="a02270.html#NLMISC_1_1IStreamz2036_0NLMISC_1_1IStreamw2">end</a>); +01838 newTgaFormat = <span class="keyword">false</span>; +01839 <span class="keywordflow">if</span> (f.<a class="code" href="a02270.html#NLMISC_1_1IStreamz2036_1">getPos</a>() >= 26) +01840 { +01841 f.<a class="code" href="a02270.html#NLMISC_1_1IStreamz2036_3">seek</a> (-26, f.<a class="code" href="a02270.html#NLMISC_1_1IStreamz2036_0NLMISC_1_1IStreamw2">end</a>); +01842 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(extAreaOffset); +01843 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(devDirectoryOffset); +01844 <span class="keywordflow">for</span>(i=0; i<16; i++) +01845 { +01846 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(signature[i]); +01847 } +01848 <span class="keywordflow">if</span>(strncmp(signature,<span class="stringliteral">"TRUEVISION-XFILE"</span>,16)==0) +01849 newTgaFormat = <span class="keyword">true</span>; +01850 } +01851 +01852 +01853 +01854 <span class="comment">// Reading TGA file header</span> +01855 f.<a class="code" href="a02270.html#NLMISC_1_1IStreamz2036_3">seek</a> (0, f.<a class="code" href="a02270.html#NLMISC_1_1IStreamz2036_0NLMISC_1_1IStreamw0">begin</a>); +01856 +01857 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(lengthID); +01858 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(cMapType); +01859 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(imageType); +01860 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(origin); +01861 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(length); +01862 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(depth); +01863 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(xOrg); +01864 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(yOrg); +01865 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(width); +01866 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(height); +01867 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(imageDepth); +01868 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(desc); +01869 +01870 <span class="keywordflow">if</span>(cMapType!=0) +01871 { +01872 <a class="code" href="a04199.html#a1">nlinfo</a>(<span class="stringliteral">"readTga : color-map not supported"</span>); +01873 } +01874 +01875 <span class="keywordflow">if</span>(lengthID>0) +01876 { +01877 imageID = <span class="keyword">new</span> <a class="code" href="a04558.html#a7">uint8</a>[lengthID]; +01878 <span class="keywordflow">for</span>(i=0; i<lengthID; i++) +01879 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(imageID[i]); +01880 } +01881 +01882 +01883 +01884 <span class="comment">// Reading TGA image data</span> +01885 +01886 <a class="code" href="a02268.html#NL3D_1_1ITexturep5">_Width</a> = <a class="code" href="a04223.html#a632">width</a>; +01887 <a class="code" href="a02268.html#NL3D_1_1ITexturep1">_Height</a> = <a class="code" href="a04223.html#a633">height</a>; +01888 <a class="code" href="a04223.html#a587">size</a> = <a class="code" href="a02268.html#NL3D_1_1ITexturep5">_Width</a> * <a class="code" href="a02268.html#NL3D_1_1ITexturep1">_Height</a> * (imageDepth/8); +01889 +01890 <span class="keywordflow">switch</span>(imageType) +01891 { +01892 <span class="comment">// Uncompressed RGB or RGBA</span> +01893 <span class="keywordflow">case</span> 2: +01894 { +01895 <a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[0].resize(_Width*_Height*4); +01896 <a class="code" href="a04558.html#a7">uint8</a> upSideDown = ((desc & (1 << 5))==0); +01897 slsize = <a class="code" href="a02268.html#NL3D_1_1ITexturep5">_Width</a> * imageDepth / 8; +01898 +01899 scanline = <span class="keyword">new</span> <a class="code" href="a04558.html#a7">uint8</a>[slsize]; +01900 <span class="keywordflow">if</span>(!scanline) +01901 { +01902 <span class="keywordflow">throw</span> EAllocationFailure(); +01903 } +01904 +01905 <span class="keywordflow">for</span>(<a class="code" href="a04223.html#a573">y</a>=0; <a class="code" href="a04223.html#a573">y</a><<a class="code" href="a02268.html#NL3D_1_1ITexturep1">_Height</a>;<a class="code" href="a04223.html#a573">y</a>++) +01906 { +01907 <span class="comment">// Serial buffer: more efficient way to load.</span> +01908 f.<a class="code" href="a02270.html#NLMISC_1_1IStreamz2041_1">serialBuffer</a> (scanline, slsize); +01909 +01910 <span class="keywordflow">if</span>(imageDepth==24 || imageDepth==32) +01911 { +01912 <a class="code" href="a04558.html#a10">sint32</a> mult = 3; +01913 <span class="keywordflow">if</span>(imageDepth==16) +01914 { +01915 mult = 2; +01916 } +01917 <span class="keywordflow">if</span>(imageDepth==32) +01918 { +01919 mult = 4; +01920 } +01921 <span class="keywordflow">if</span>(imageDepth!=16) +01922 { +01923 <span class="keywordflow">for</span>(<a class="code" href="a04223.html#a572">x</a>=0; <a class="code" href="a04223.html#a572">x</a><<a class="code" href="a02268.html#NL3D_1_1ITexturep5">_Width</a>; <a class="code" href="a04223.html#a572">x</a>++) +01924 { +01925 <span class="comment">// RGB(A)</span> +01926 <a class="code" href="a04223.html#a628">r</a> = scanline[<a class="code" href="a04223.html#a572">x</a>*mult+0]; +01927 g = scanline[<a class="code" href="a04223.html#a572">x</a>*mult+1]; +01928 b = scanline[<a class="code" href="a04223.html#a572">x</a>*mult+2]; +01929 <span class="comment">// Switching to BGR(A)</span> +01930 scanline[<a class="code" href="a04223.html#a572">x</a>*mult+0] = b; +01931 scanline[<a class="code" href="a04223.html#a572">x</a>*mult+1] = g; +01932 scanline[<a class="code" href="a04223.html#a572">x</a>*mult+2] = <a class="code" href="a04223.html#a628">r</a>; +01933 } +01934 } +01935 } +01936 +01937 k=0; +01938 <span class="keywordflow">for</span>(i=0; i<<a class="code" href="a04223.html#a632">width</a>; i++) +01939 { +01940 <span class="keywordflow">if</span>(upSideDown) +01941 { +01942 <span class="keywordflow">if</span>(imageDepth==16) +01943 { +01944 <a class="code" href="a04558.html#a9">uint16</a> toto = (<a class="code" href="a04558.html#a9">uint16</a>)scanline[k++]; +01945 toto |= scanline[k++]<<8; +01946 <a class="code" href="a04558.html#a15">uint</a> _r = toto>>10; +01947 <a class="code" href="a04558.html#a15">uint</a> _g = (toto>>5)&0x1f; +01948 <a class="code" href="a04558.html#a15">uint</a> _b = toto&0x1f; +01949 <a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[0][(<a class="code" href="a04223.html#a633">height</a>-<a class="code" href="a04223.html#a573">y</a>-1)*<a class="code" href="a04223.html#a632">width</a>*4 + 4*i] = (_r<<3) | (_r>>2); +01950 <a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[0][(<a class="code" href="a04223.html#a633">height</a>-<a class="code" href="a04223.html#a573">y</a>-1)*<a class="code" href="a04223.html#a632">width</a>*4 + 4*i + 1] = (_g<<3) | (_g>>2); +01951 <a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[0][(<a class="code" href="a04223.html#a633">height</a>-<a class="code" href="a04223.html#a573">y</a>-1)*<a class="code" href="a04223.html#a632">width</a>*4 + 4*i + 2] = (_b<<3) | (_b>>2); +01952 <a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[0][(<a class="code" href="a04223.html#a633">height</a>-<a class="code" href="a04223.html#a573">y</a>-1)*<a class="code" href="a04223.html#a632">width</a>*4 + 4*i + 3] = 255; +01953 } +01954 <span class="keywordflow">else</span> +01955 { +01956 <a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[0][(<a class="code" href="a04223.html#a633">height</a>-<a class="code" href="a04223.html#a573">y</a>-1)*<a class="code" href="a04223.html#a632">width</a>*4 + 4*i] = scanline[k++]; +01957 <a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[0][(<a class="code" href="a04223.html#a633">height</a>-<a class="code" href="a04223.html#a573">y</a>-1)*<a class="code" href="a04223.html#a632">width</a>*4 + 4*i + 1] = scanline[k++]; +01958 <a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[0][(<a class="code" href="a04223.html#a633">height</a>-<a class="code" href="a04223.html#a573">y</a>-1)*<a class="code" href="a04223.html#a632">width</a>*4 + 4*i + 2] = scanline[k++]; +01959 <span class="keywordflow">if</span>(imageDepth==32) +01960 <a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[0][(<a class="code" href="a04223.html#a633">height</a>-<a class="code" href="a04223.html#a573">y</a>-1)*<a class="code" href="a04223.html#a632">width</a>*4 + 4*i + 3] = scanline[k++]; +01961 <span class="keywordflow">else</span> +01962 <a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[0][(<a class="code" href="a04223.html#a633">height</a>-<a class="code" href="a04223.html#a573">y</a>-1)*<a class="code" href="a04223.html#a632">width</a>*4 + 4*i + 3] = 255; +01963 } +01964 } +01965 <span class="keywordflow">else</span> +01966 { +01967 <span class="keywordflow">if</span>(imageDepth==16) +01968 { +01969 <a class="code" href="a04558.html#a9">uint16</a> toto = (<a class="code" href="a04558.html#a9">uint16</a>)scanline[k++]; +01970 toto |= scanline[k++]<<8; +01971 <span class="keywordtype">int</span> _r = toto>>10; +01972 <span class="keywordtype">int</span> _g = toto&(0x3e0)>>5; +01973 <span class="keywordtype">int</span> _b = toto&0x1f; +01974 <a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[0][<a class="code" href="a04223.html#a573">y</a>*<a class="code" href="a04223.html#a632">width</a>*4 + 4*i] = (_r<<3) | (_r>>2); +01975 <a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[0][<a class="code" href="a04223.html#a573">y</a>*<a class="code" href="a04223.html#a632">width</a>*4 + 4*i + 1] = (_g<<3) | (_g>>2); +01976 <a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[0][<a class="code" href="a04223.html#a573">y</a>*<a class="code" href="a04223.html#a632">width</a>*4 + 4*i + 2] = (_b<<3) | (_b>>2); +01977 <a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[0][<a class="code" href="a04223.html#a573">y</a>*<a class="code" href="a04223.html#a632">width</a>*4 + 4*i + 3] = 255; +01978 } +01979 <span class="keywordflow">else</span> +01980 { +01981 <a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[0][<a class="code" href="a04223.html#a573">y</a>*<a class="code" href="a04223.html#a632">width</a>*4 + 4*i] = scanline[k++]; +01982 <a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[0][<a class="code" href="a04223.html#a573">y</a>*<a class="code" href="a04223.html#a632">width</a>*4 + 4*i + 1] = scanline[k++]; +01983 <a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[0][<a class="code" href="a04223.html#a573">y</a>*<a class="code" href="a04223.html#a632">width</a>*4 + 4*i + 2] = scanline[k++]; +01984 <span class="keywordflow">if</span>(imageDepth==32) +01985 <a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[0][<a class="code" href="a04223.html#a573">y</a>*<a class="code" href="a04223.html#a632">width</a>*4 + 4*i + 3] = scanline[k++]; +01986 <span class="keywordflow">else</span> +01987 <a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[0][<a class="code" href="a04223.html#a573">y</a>*<a class="code" href="a04223.html#a632">width</a>*4 + 4*i + 3] = 255; +01988 } +01989 } +01990 } +01991 } +01992 +01993 <a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a> = <a class="code" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew25">RGBA</a>; +01994 <span class="keyword">delete</span> scanline; +01995 }; +01996 <span class="keywordflow">break</span>; +01997 +01998 <span class="comment">// Uncompressed Grayscale bitmap</span> +01999 <span class="keywordflow">case</span> 3: +02000 { +02001 <a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[0].resize(_Width*_Height); +02002 <a class="code" href="a04558.html#a7">uint8</a> upSideDown = ((desc & (1 << 5))==0); +02003 slsize = <a class="code" href="a02268.html#NL3D_1_1ITexturep5">_Width</a>; +02004 +02005 scanline = <span class="keyword">new</span> <a class="code" href="a04558.html#a7">uint8</a>[slsize]; +02006 <span class="keywordflow">if</span>(!scanline) +02007 { +02008 <span class="keywordflow">throw</span> EAllocationFailure(); +02009 } +02010 +02011 <span class="keywordflow">for</span>(<a class="code" href="a04223.html#a573">y</a>=0; <a class="code" href="a04223.html#a573">y</a><<a class="code" href="a02268.html#NL3D_1_1ITexturep1">_Height</a>;<a class="code" href="a04223.html#a573">y</a>++) +02012 { +02013 <span class="comment">// Serial buffer: more efficient way to load.</span> +02014 f.<a class="code" href="a02270.html#NLMISC_1_1IStreamz2041_1">serialBuffer</a> (scanline, slsize); +02015 +02016 k=0; +02017 <span class="keywordflow">for</span>(i=0; i<<a class="code" href="a04223.html#a632">width</a>; i++) +02018 { +02019 <span class="keywordflow">if</span>(upSideDown) +02020 <a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[0][(<a class="code" href="a04223.html#a633">height</a>-<a class="code" href="a04223.html#a573">y</a>-1)*<a class="code" href="a04223.html#a632">width</a> + i] = scanline[k++]; +02021 <span class="keywordflow">else</span> +02022 <a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[0][<a class="code" href="a04223.html#a573">y</a>*<a class="code" href="a04223.html#a632">width</a> + i] = scanline[k++]; +02023 } +02024 } +02025 +02026 <a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a> = <a class="code" href="a02268.html#NL3D_1_1ITexturep2">_LoadGrayscaleAsAlpha</a>?<a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw0">Alpha</a>:<a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw8">Luminance</a>; +02027 <span class="keyword">delete</span> scanline; +02028 }; +02029 <span class="keywordflow">break</span>; +02030 +02031 <span class="comment">// Compressed RGB or RGBA</span> +02032 <span class="keywordflow">case</span> 10: +02033 { +02034 <a class="code" href="a04558.html#a7">uint8</a> packet; +02035 <a class="code" href="a04558.html#a7">uint8</a> pixel[4]; +02036 <a class="code" href="a04558.html#a11">uint32</a> <a class="code" href="a04223.html#a636">imageSize</a> = <a class="code" href="a04223.html#a632">width</a>*<a class="code" href="a04223.html#a633">height</a>; +02037 <a class="code" href="a04558.html#a11">uint32</a> readSize = 0; +02038 <a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[0].resize(_Width*_Height*4); +02039 <a class="code" href="a04558.html#a15">uint</a> dstId= 0; +02040 +02041 <span class="keywordflow">while</span>(readSize < <a class="code" href="a04223.html#a636">imageSize</a>) +02042 { +02043 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(packet); +02044 <span class="keywordflow">if</span>((packet & 0x80) > 0) <span class="comment">// packet RLE </span> +02045 { +02046 <span class="keywordflow">for</span>(i=0; i<imageDepth/8; i++) +02047 { +02048 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(pixel[i]); +02049 } +02050 <span class="keywordflow">for</span> (i=0; i < (packet & 0x7F) + 1; i++) +02051 { +02052 <span class="keywordflow">for</span>(j=0; j<imageDepth/8; j++) +02053 { +02054 <a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[0][dstId++]= pixel[j]; +02055 } +02056 <span class="keywordflow">if</span>(imageDepth==24) +02057 { +02058 <a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[0][dstId++]= 0; +02059 } +02060 } +02061 } +02062 <span class="keywordflow">else</span> <span class="comment">// packet Raw </span> +02063 { +02064 <span class="keywordflow">for</span>(i=0; i<((packet & 0x7F) + 1); i++) +02065 { +02066 <span class="keywordflow">for</span>(j=0; j<imageDepth/8; j++) +02067 { +02068 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(pixel[j]); +02069 } +02070 <span class="keywordflow">if</span>(imageDepth==32) +02071 { +02072 <a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[0][dstId++]= pixel[2]; +02073 <a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[0][dstId++]= pixel[1]; +02074 <a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[0][dstId++]= pixel[0]; +02075 <a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[0][dstId++]= pixel[3]; +02076 } +02077 <span class="keywordflow">if</span>(imageDepth==24) +02078 { +02079 <a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[0][dstId++]= pixel[2]; +02080 <a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[0][dstId++]= pixel[1]; +02081 <a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[0][dstId++]= pixel[0]; +02082 <a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[0][dstId++]= 0; +02083 } +02084 } +02085 } +02086 readSize += (packet & 0x7F) + 1; +02087 } +02088 <a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a> = <a class="code" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew25">RGBA</a>; +02089 }; +02090 <span class="keywordflow">break</span>; +02091 +02092 <span class="comment">// Compressed Grayscale bitmap (not tested)</span> +02093 <span class="keywordflow">case</span> 11: +02094 { +02095 <a class="code" href="a04558.html#a7">uint8</a> packet; +02096 <a class="code" href="a04558.html#a7">uint8</a> pixel[4]; +02097 <a class="code" href="a04558.html#a11">uint32</a> <a class="code" href="a04223.html#a636">imageSize</a> = <a class="code" href="a04223.html#a632">width</a>*<a class="code" href="a04223.html#a633">height</a>; +02098 <a class="code" href="a04558.html#a11">uint32</a> readSize = 0; +02099 <a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[0].resize(_Width*_Height); +02100 <a class="code" href="a04558.html#a15">uint</a> dstId= 0; +02101 +02102 <span class="keywordflow">while</span>(readSize < <a class="code" href="a04223.html#a636">imageSize</a>) +02103 { +02104 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(packet); +02105 <span class="keywordflow">if</span>((packet & 0x80) > 0) <span class="comment">// packet RLE </span> +02106 { +02107 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(pixel[0]); +02108 <span class="keywordflow">for</span> (i=0; i < (packet & 0x7F) + 1; i++) +02109 { +02110 <a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[0][dstId++]= pixel[0]; +02111 } +02112 } +02113 <span class="keywordflow">else</span> <span class="comment">// packet Raw </span> +02114 { +02115 <span class="keywordflow">for</span>(i=0; i<((packet & 0x7F) + 1); i++) +02116 { +02117 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(pixel[0]); +02118 <a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[0][dstId++]= pixel[0]; +02119 } +02120 } +02121 readSize += (packet & 0x7F) + 1; +02122 } +02123 <a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a> = <a class="code" href="a02268.html#NL3D_1_1ITexturep2">_LoadGrayscaleAsAlpha</a>?<a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw0">Alpha</a>:<a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw8">Luminance</a>; +02124 }; +02125 <span class="keywordflow">break</span>; +02126 +02127 <span class="keywordflow">default</span>: +02128 <span class="keywordflow">return</span> 0; +02129 } +02130 +02131 <a class="code" href="a02268.html#NL3D_1_1ITexturep3">_MipMapCount</a> = 1; +02132 <span class="keywordflow">return</span>(imageDepth); +02133 +02134 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1ITexturea30" doxytag="NLMISC::CBitmap::releaseMipMaps" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CBitmap::releaseMipMaps </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Release the mipmaps of the bitmap if they exist. Work for any mode. <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="a02268.html#NL3D_1_1ITexturea3">buildMipMaps()</a>.</dd></dl> + +<p> +Definition at line <a class="el" href="a05486.html#l01493">1493</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +References <a class="el" href="a05487.html#l00093">_MipMapCount</a>, <a class="el" href="a05587.html#l00141">NLMISC::contReset()</a>, <a class="el" href="a05487.html#l00070">NLMISC::MAX_MIPMAP</a>, and <a class="el" href="a05981.html#l00104">sint</a>. +<p> +Referenced by <a class="el" href="a05463.html#l00059">NL3D::CAsyncTextureManager::CTextureEntry::createCoarseBitmap()</a>, <a class="el" href="a06517.html#l00101">NL3D::CTextureEmboss::doGenerate()</a>, <a class="el" href="a06511.html#l00277">NL3D::CTextureBump::doGenerate()</a>, <a class="el" href="a05486.html#l02682">flipH()</a>, <a class="el" href="a05486.html#l02714">flipV()</a>, <a class="el" href="a05486.html#l01508">resample()</a>, <a class="el" href="a05486.html#l01545">resize()</a>, <a class="el" href="a05486.html#l02781">rot90CCW()</a>, <a class="el" href="a05486.html#l02746">rot90CW()</a>, and <a class="el" href="a05652.html#l00361">NL3D::CDriverGL::setupTextureEx()</a>. +<p> +<div class="fragment"><pre>01494 { +01495 <span class="keywordflow">if</span>(<a class="code" href="a02268.html#NL3D_1_1ITexturep3">_MipMapCount</a><=1) <span class="keywordflow">return</span>; +01496 +01497 <a class="code" href="a02268.html#NL3D_1_1ITexturep3">_MipMapCount</a>=1; +01498 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a14">sint</a> i=1;i<<a class="code" href="a05378.html#a43">MAX_MIPMAP</a>;i++) +01499 { +01500 <a class="code" href="a05378.html#a381">NLMISC::contReset</a>(_Data[i]); +01501 } +01502 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1ITexturea31" doxytag="NLMISC::CBitmap::resample" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CBitmap::resample </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a10">sint32</a> </td> + <td class="mdname" nowrap> <em>nNewWidth</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a10">sint32</a> </td> + <td class="mdname" nowrap> <em>nNewHeight</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Resample the bitmap. If mipmaps exist they are deleted, then rebuilt after resampling. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign=top><em>nNewWidth</em> </td><td>width after resample </td></tr> + <tr><td valign=top><em>nNewHeight</em> </td><td>height after resample</td></tr> + </table> +</dl> + +<p> +Definition at line <a class="el" href="a05486.html#l01508">1508</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +References <a class="el" href="a05487.html#l00093">_MipMapCount</a>, <a class="el" href="a05486.html#l01422">buildMipMaps()</a>, <a class="el" href="a05587.html#l00141">NLMISC::contReset()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>, <a class="el" href="a05486.html#l01493">releaseMipMaps()</a>, <a class="el" href="a05486.html#l01618">resamplePicture32()</a>, <a class="el" href="a06116.html#l00142">NLMISC::CObjectVector< T, EnableObjectBehavior >::resize()</a>, <a class="el" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew25">RGBA</a>, and <a class="el" href="a05981.html#l00099">sint32</a>. +<p> +Referenced by <a class="el" href="a05567.html#l00070">NL3D::CCoarseMeshBuild::buildBitmap()</a>, and <a class="el" href="a05652.html#l00361">NL3D::CDriverGL::setupTextureEx()</a>. +<p> +<div class="fragment"><pre>01509 { +01510 <a class="code" href="a04199.html#a6">nlassert</a>(PixelFormat == RGBA); +01511 <span class="keywordtype">bool</span> needRebuild = <span class="keyword">false</span>; +01512 +01513 <span class="comment">// Deleting mipmaps</span> +01514 <span class="keywordflow">if</span>(<a class="code" href="a02268.html#NL3D_1_1ITexturep3">_MipMapCount</a>>1) +01515 needRebuild = <span class="keyword">true</span>; +01516 <a class="code" href="a02268.html#NL3D_1_1ITexturea30">releaseMipMaps</a>(); +01517 +01518 <span class="keywordflow">if</span>(nNewWidth==0 || nNewHeight==0) +01519 { +01520 <a class="code" href="a02268.html#NL3D_1_1ITexturep5">_Width</a> = <a class="code" href="a02268.html#NL3D_1_1ITexturep1">_Height</a> = 0; +01521 <span class="keywordflow">return</span>; +01522 } +01523 +01524 CObjectVector<uint8> pDestui; +01525 pDestui.resize(nNewWidth*nNewHeight*4); +01526 <a class="code" href="a03337.html">NLMISC::CRGBA</a> *pDestRgba = (<a class="code" href="a03337.html">NLMISC::CRGBA</a>*)&pDestui[0]; +01527 +01528 <a class="code" href="a02268.html#NLMISC_1_1CBitmapd8">resamplePicture32</a> ((<a class="code" href="a03337.html">NLMISC::CRGBA</a>*)&_Data[0][0], pDestRgba, _Width, _Height, nNewWidth, nNewHeight); +01529 <a class="code" href="a05378.html#a381">NLMISC::contReset</a>(_Data[0]); <span class="comment">// free memory</span> +01530 <a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[0] = pDestui; +01531 <a class="code" href="a02268.html#NL3D_1_1ITexturep5">_Width</a>= nNewWidth; +01532 <a class="code" href="a02268.html#NL3D_1_1ITexturep1">_Height</a>= nNewHeight; +01533 +01534 <span class="comment">// Rebuilding mipmaps</span> +01535 <span class="keywordflow">if</span>(needRebuild) +01536 { +01537 <a class="code" href="a02268.html#NL3D_1_1ITexturea3">buildMipMaps</a>(); +01538 } +01539 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBitmapd8" doxytag="NLMISC::CBitmap::resamplePicture32" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CBitmap::resamplePicture32 </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a03337.html">NLMISC::CRGBA</a> * </td> + <td class="mdname" nowrap> <em>pSrc</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a03337.html">NLMISC::CRGBA</a> * </td> + <td class="mdname" nowrap> <em>pDest</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a10">sint32</a> </td> + <td class="mdname" nowrap> <em>nSrcWidth</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a10">sint32</a> </td> + <td class="mdname" nowrap> <em>nSrcHeight</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a10">sint32</a> </td> + <td class="mdname" nowrap> <em>nDestWidth</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a10">sint32</a> </td> + <td class="mdname" nowrap> <em>nDestHeight</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +The resample function <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign=top><em>pSrc</em> </td><td><a class="el" href="a03337.html">CRGBA</a> array </td></tr> + <tr><td valign=top><em>pDest</em> </td><td><a class="el" href="a03337.html">CRGBA</a> array for storing resampled texture </td></tr> + <tr><td valign=top><em>nSrcWidth</em> </td><td>original width </td></tr> + <tr><td valign=top><em>nSrcHeight</em> </td><td>original height </td></tr> + <tr><td valign=top><em>nDestWidth</em> </td><td>width after resample </td></tr> + <tr><td valign=top><em>nDestHeight</em> </td><td>height after resample</td></tr> + </table> +</dl> + +<p> +Definition at line <a class="el" href="a05486.html#l01618">1618</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +References <a class="el" href="a05622.html#l00290">nlassert</a>, and <a class="el" href="a05981.html#l00099">sint32</a>. +<p> +Referenced by <a class="el" href="a05486.html#l01508">resample()</a>. +<p> +<div class="fragment"><pre>01621 { +01622 <span class="keywordflow">if</span> ((nSrcWidth<=0)||(nSrcHeight<=0)||(nDestHeight<=0)||(nDestHeight<=0)) +01623 <span class="keywordflow">return</span>; +01624 <span class="keywordtype">bool</span> bXMag=(nDestWidth>=nSrcWidth); +01625 <span class="keywordtype">bool</span> bYMag=(nDestHeight>=nSrcHeight); +01626 <span class="keywordtype">bool</span> bXEq=(nDestWidth==nSrcWidth); +01627 <span class="keywordtype">bool</span> bYEq=(nDestHeight==nSrcHeight); +01628 std::vector<NLMISC::CRGBAF> pIterm (nDestWidth*nSrcHeight); +01629 +01630 <span class="keywordflow">if</span> (bXMag) +01631 { +01632 <span class="keywordtype">float</span> fXdelta=(<span class="keywordtype">float</span>)(nSrcWidth)/(<span class="keywordtype">float</span>)(nDestWidth); +01633 <a class="code" href="a03338.html">NLMISC::CRGBAF</a> *pItermPtr=&*pIterm.begin(); +01634 <a class="code" href="a04558.html#a10">sint32</a> nY; +01635 <span class="keywordflow">for</span> (nY=0; nY<nSrcHeight; nY++) +01636 { +01637 <span class="keyword">const</span> <a class="code" href="a03337.html">NLMISC::CRGBA</a> *pSrcLine=pSrc; +01638 <span class="keywordtype">float</span> fX=0.f; +01639 <a class="code" href="a04558.html#a10">sint32</a> nX; +01640 <span class="keywordflow">for</span> (nX=0; nX<nDestWidth; nX++) +01641 { +01642 <span class="keywordtype">float</span> fVirgule=fX-(<span class="keywordtype">float</span>)floor(fX); +01643 <a class="code" href="a04199.html#a6">nlassert</a> (fVirgule>=0.f); +01644 <a class="code" href="a03338.html">NLMISC::CRGBAF</a> vColor; +01645 <span class="keywordflow">if</span> (fVirgule>=0.5f) +01646 { +01647 <span class="keywordflow">if</span> (fX<(<span class="keywordtype">float</span>)(nSrcWidth-1)) +01648 { +01649 <a class="code" href="a03338.html">NLMISC::CRGBAF</a> vColor1 (pSrcLine[(<a class="code" href="a04558.html#a10">sint32</a>)floor(fX)]); +01650 <a class="code" href="a03338.html">NLMISC::CRGBAF</a> vColor2 (pSrcLine[(sint32)floor(fX)+1]); +01651 vColor=vColor1*(1.5f-fVirgule)+vColor2*(fVirgule-0.5f); +01652 } +01653 <span class="keywordflow">else</span> +01654 vColor=<a class="code" href="a03338.html">NLMISC::CRGBAF</a> (pSrcLine[(sint32)floor(fX)]); +01655 } +01656 <span class="keywordflow">else</span> +01657 { +01658 <span class="keywordflow">if</span> (fX>=1.f) +01659 { +01660 NLMISC::CRGBAF vColor1 (pSrcLine[(sint32)floor(fX)]); +01661 NLMISC::CRGBAF vColor2 (pSrcLine[(sint32)floor(fX)-1]); +01662 vColor=vColor1*(0.5f+fVirgule)+vColor2*(0.5f-fVirgule); +01663 } +01664 <span class="keywordflow">else</span> +01665 vColor=NLMISC::CRGBAF (pSrcLine[(sint32)floor(fX)]); +01666 } +01667 *(pItermPtr++)=vColor; +01668 fX+=fXdelta; +01669 } +01670 pSrc+=nSrcWidth; +01671 } +01672 } +01673 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (bXEq) +01674 { +01675 NLMISC::CRGBAF *pItermPtr=&*pIterm.begin(); +01676 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a10">sint32</a> nY=0; nY<nSrcHeight; nY++) +01677 { +01678 <span class="keyword">const</span> <a class="code" href="a03337.html">NLMISC::CRGBA</a> *pSrcLine=pSrc; +01679 <a class="code" href="a04558.html#a10">sint32</a> nX; +01680 <span class="keywordflow">for</span> (nX=0; nX<nDestWidth; nX++) +01681 *(pItermPtr++)=NLMISC::CRGBAF (pSrcLine[nX]); +01682 pSrc+=nSrcWidth; +01683 } +01684 } +01685 <span class="keywordflow">else</span> +01686 { +01687 <span class="keywordtype">double</span> fXdelta=(<span class="keywordtype">double</span>)(nSrcWidth)/(<span class="keywordtype">double</span>)(nDestWidth); +01688 <a class="code" href="a04199.html#a6">nlassert</a> (fXdelta>1.f); +01689 NLMISC::CRGBAF *pItermPtr=&*pIterm.begin(); +01690 <a class="code" href="a04558.html#a10">sint32</a> nY; +01691 <span class="keywordflow">for</span> (nY=0; nY<nSrcHeight; nY++) +01692 { +01693 <span class="keyword">const</span> <a class="code" href="a03337.html">NLMISC::CRGBA</a> *pSrcLine=pSrc; +01694 <span class="keywordtype">double</span> fX=0.f; +01695 <a class="code" href="a04558.html#a10">sint32</a> nX; +01696 <span class="keywordflow">for</span> (nX=0; nX<nDestWidth; nX++) +01697 { +01698 NLMISC::CRGBAF vColor (0.f, 0.f, 0.f, 0.f); +01699 <span class="keywordtype">double</span> fFinal=fX+fXdelta; +01700 <span class="keywordflow">while</span> (fX<fFinal) +01701 { +01702 <span class="keywordtype">double</span> fNext=(<span class="keywordtype">double</span>)floor (fX)+1.f; +01703 <span class="keywordflow">if</span> (fNext>fFinal) +01704 fNext=fFinal; +01705 vColor+=((<span class="keywordtype">float</span>)(fNext-fX))*NLMISC::CRGBAF (pSrcLine[(sint32)floor(fX)]); +01706 fX=fNext; +01707 } +01708 <a class="code" href="a04199.html#a6">nlassert</a> (fX==fFinal); +01709 vColor/=(<span class="keywordtype">float</span>)fXdelta; +01710 *(pItermPtr++)=vColor; +01711 } +01712 pSrc+=nSrcWidth; +01713 } +01714 } +01715 +01716 <span class="keywordflow">if</span> (bYMag) +01717 { +01718 <span class="keywordtype">double</span> fYdelta=(<span class="keywordtype">double</span>)(nSrcHeight)/(<span class="keywordtype">double</span>)(nDestHeight); +01719 <a class="code" href="a04558.html#a10">sint32</a> nX; +01720 <span class="keywordflow">for</span> (nX=0; nX<nDestWidth; nX++) +01721 { +01722 <span class="keywordtype">double</span> fY=0.f; +01723 <a class="code" href="a04558.html#a10">sint32</a> nY; +01724 <span class="keywordflow">for</span> (nY=0; nY<nDestHeight; nY++) +01725 { +01726 <span class="keywordtype">double</span> fVirgule=fY-(<span class="keywordtype">double</span>)floor(fY); +01727 <a class="code" href="a04199.html#a6">nlassert</a> (fVirgule>=0.f); +01728 NLMISC::CRGBAF vColor; +01729 <span class="keywordflow">if</span> (fVirgule>=0.5f) +01730 { +01731 <span class="keywordflow">if</span> (fY<(<span class="keywordtype">double</span>)(nSrcHeight-1)) +01732 { +01733 NLMISC::CRGBAF vColor1=pIterm[((<a class="code" href="a04558.html#a10">sint32</a>)floor(fY))*nDestWidth+nX]; +01734 NLMISC::CRGBAF vColor2=pIterm[(((<a class="code" href="a04558.html#a10">sint32</a>)floor(fY))+1)*nDestWidth+nX]; +01735 vColor=vColor1*(1.5f-(<span class="keywordtype">float</span>)fVirgule)+vColor2*((<span class="keywordtype">float</span>)fVirgule-0.5f); +01736 } +01737 <span class="keywordflow">else</span> +01738 vColor=pIterm[((<a class="code" href="a04558.html#a10">sint32</a>)floor(fY))*nDestWidth+nX]; +01739 } +01740 <span class="keywordflow">else</span> +01741 { +01742 <span class="keywordflow">if</span> (fY>=1.f) +01743 { +01744 NLMISC::CRGBAF vColor1=pIterm[((<a class="code" href="a04558.html#a10">sint32</a>)floor(fY))*nDestWidth+nX]; +01745 NLMISC::CRGBAF vColor2=pIterm[(((<a class="code" href="a04558.html#a10">sint32</a>)floor(fY))-1)*nDestWidth+nX]; +01746 vColor=vColor1*(0.5f+(<span class="keywordtype">float</span>)fVirgule)+vColor2*(0.5f-(<span class="keywordtype">float</span>)fVirgule); +01747 } +01748 <span class="keywordflow">else</span> +01749 vColor=pIterm[((<a class="code" href="a04558.html#a10">sint32</a>)floor(fY))*nDestWidth+nX]; +01750 } +01751 pDest[nX+nY*nDestWidth]=vColor; +01752 fY+=fYdelta; +01753 } +01754 } +01755 } +01756 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (bYEq) +01757 { +01758 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a10">sint32</a> nX=0; nX<nDestWidth; nX++) +01759 { +01760 <a class="code" href="a04558.html#a10">sint32</a> nY; +01761 <span class="keywordflow">for</span> (nY=0; nY<nDestHeight; nY++) +01762 { +01763 pDest[nX+nY*nDestWidth]=pIterm[nY*nDestWidth+nX]; +01764 } +01765 } +01766 } +01767 <span class="keywordflow">else</span> +01768 { +01769 <span class="keywordtype">double</span> fYdelta=(<span class="keywordtype">double</span>)(nSrcHeight)/(<span class="keywordtype">double</span>)(nDestHeight); +01770 <a class="code" href="a04199.html#a6">nlassert</a> (fYdelta>1.f); +01771 <a class="code" href="a04558.html#a10">sint32</a> nX; +01772 <span class="keywordflow">for</span> (nX=0; nX<nDestWidth; nX++) +01773 { +01774 <span class="keywordtype">double</span> fY=0.f; +01775 <a class="code" href="a04558.html#a10">sint32</a> nY; +01776 <span class="keywordflow">for</span> (nY=0; nY<nDestHeight; nY++) +01777 { +01778 NLMISC::CRGBAF vColor (0.f, 0.f, 0.f, 0.f); +01779 <span class="keywordtype">double</span> fFinal=fY+fYdelta; +01780 <span class="keywordflow">while</span> ((fY<fFinal)&&((<a class="code" href="a04558.html#a10">sint32</a>)fY!=nSrcHeight)) +01781 { +01782 <span class="keywordtype">double</span> fNext=(<span class="keywordtype">double</span>)floor (fY)+1.f; +01783 <span class="keywordflow">if</span> (fNext>fFinal) +01784 fNext=fFinal; +01785 vColor+=((<span class="keywordtype">float</span>)(fNext-fY))*pIterm[((<a class="code" href="a04558.html#a10">sint32</a>)floor(fY))*nDestWidth+nX]; +01786 fY=fNext; +01787 } +01788 vColor/=(<span class="keywordtype">float</span>)fYdelta; +01789 pDest[nX+nY*nDestWidth]=vColor; +01790 } +01791 } +01792 } +01793 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1ITexturea32" doxytag="NLMISC::CBitmap::reset" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CBitmap::reset </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02268.html#NL3D_1_1ITexturew31">TType</a> </td> + <td class="mdname1" valign="top" nowrap> <em>type</em> = RGBA </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Reset the buffer. Mipmaps are deleted and bitmap is not valid anymore.<p> +<dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign=top><em>type</em> </td><td>is the new type used for this texture</td></tr> + </table> +</dl> + +<p> +Definition at line <a class="el" href="a05486.html#l01599">1599</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +References <a class="el" href="a05487.html#l00093">_MipMapCount</a>, <a class="el" href="a05587.html#l00141">NLMISC::contReset()</a>, <a class="el" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>, <a class="el" href="a06116.html#l00142">NLMISC::CObjectVector< uint8 >::resize()</a>, <a class="el" href="a05646.html#l00244">type</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +Referenced by <a class="el" href="a05790.html#l00337">NL3D::CHLSColorTexture::buildColorVersion()</a>, <a class="el" href="a05642.html#l02131">NL3D::CDriverGL::getBufferPart()</a>, and <a class="el" href="a06506.html#l00327">NL3D::ITexture::release()</a>. +<p> +<div class="fragment"><pre>01600 { +01601 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> i=0; i<<a class="code" href="a02268.html#NL3D_1_1ITexturep3">_MipMapCount</a>; i++) +01602 { +01603 <a class="code" href="a05378.html#a381">NLMISC::contReset</a>(_Data[i]); +01604 <a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[i].resize(0); +01605 } +01606 <a class="code" href="a02268.html#NL3D_1_1ITexturep5">_Width</a> = <a class="code" href="a02268.html#NL3D_1_1ITexturep1">_Height</a> = 0; +01607 _MipMapCount= 1; +01608 +01609 <span class="comment">// Change pixel format</span> +01610 <a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>=<a class="code" href="a04223.html#a581">type</a>; +01611 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1ITexturea33" doxytag="NLMISC::CBitmap::resize" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CBitmap::resize </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a10">sint32</a> </td> + <td class="mdname" nowrap> <em>nNewWidth</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a10">sint32</a> </td> + <td class="mdname" nowrap> <em>nNewHeight</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a02268.html#NL3D_1_1ITexturew31">TType</a> </td> + <td class="mdname" nowrap> <em>newType</em> = DonTKnow, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>bool </td> + <td class="mdname" nowrap> <em>resetTo0</em> = true</td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Resize the bitmap. If mipmaps exist they are deleted and not rebuilt. This is not a crop. Pixels are lost after resize.<p> +<dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign=top><em>nNewWidth</em> </td><td>width after resize </td></tr> + <tr><td valign=top><em>nNewHeight</em> </td><td>height after resize </td></tr> + <tr><td valign=top><em>newType</em> </td><td>is the new type of the bitmap. If don_t_know, keep the same pixel format that before. </td></tr> + <tr><td valign=top><em>resetTo0</em> </td><td>by default the vector are filled by 0. set false to gain performances.</td></tr> + </table> +</dl> + +<p> +Definition at line <a class="el" href="a05486.html#l01545">1545</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +References <a class="el" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew4">DonTKnow</a>, <a class="el" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>, <a class="el" href="a05486.html#l01493">releaseMipMaps()</a>, <a class="el" href="a05486.html#l01565">resizeMipMap()</a>, and <a class="el" href="a05981.html#l00099">sint32</a>. +<p> +Referenced by <a class="el" href="a05486.html#l02817">blend()</a>, <a class="el" href="a05790.html#l00337">NL3D::CHLSColorTexture::buildColorVersion()</a>, <a class="el" href="a06523.html#l00067">NL3D::CTextureFont::CTextureFont()</a>, <a class="el" href="a06527.html#l00045">NL3D::CTextureMem::doGenerate()</a>, <a class="el" href="a06525.html#l00178">NL3D::CTextureGrouped::doGenerate()</a>, <a class="el" href="a05862.html#l00116">NL3D::CTextureCross::doGenerate()</a>, <a class="el" href="a06523.html#l00133">NL3D::CTextureFont::dumpTextureFont()</a>, <a class="el" href="a05567.html#l00367">NL3D::CCoarseMeshBuild::expand()</a>, and <a class="el" href="a05642.html#l02131">NL3D::CDriverGL::getBufferPart()</a>. +<p> +<div class="fragment"><pre>01546 { +01547 <span class="comment">// Deleting mipmaps</span> +01548 <a class="code" href="a02268.html#NL3D_1_1ITexturea30">releaseMipMaps</a>(); +01549 +01550 <span class="comment">// Change type of bitmap ?</span> +01551 <span class="keywordflow">if</span> (newType!=<a class="code" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew4">DonTKnow</a>) +01552 <a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>=newType; +01553 +01554 <a class="code" href="a02268.html#NL3D_1_1ITexturep5">_Width</a> = nNewWidth; +01555 <a class="code" href="a02268.html#NL3D_1_1ITexturep1">_Height</a> = nNewHeight; +01556 +01557 <span class="comment">// resize the level 0 only.</span> +01558 <a class="code" href="a02268.html#NL3D_1_1ITexturea34">resizeMipMap</a>(0, nNewWidth, nNewHeight, resetTo0); +01559 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1ITexturea34" doxytag="NLMISC::CBitmap::resizeMipMap" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CBitmap::resizeMipMap </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a11">uint32</a> </td> + <td class="mdname" nowrap> <em>numMipMap</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a10">sint32</a> </td> + <td class="mdname" nowrap> <em>nNewWidth</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a10">sint32</a> </td> + <td class="mdname" nowrap> <em>nNewHeight</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>bool </td> + <td class="mdname" nowrap> <em>resetTo0</em> = true</td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +ADVANCED USE Resize a single mipmap level. <a class="el" href="a02268.html#NL3D_1_1ITexturea33">resize()</a> should have been called before. This is not a crop. Pixels are lost after resize. No validity check is made. It is the user responsabitility fo setup correct mipmap size.<p> +<dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign=top><em>numMipMap</em> </td><td>id of the mipmap </td></tr> + <tr><td valign=top><em>nNewWidth</em> </td><td>width after resize </td></tr> + <tr><td valign=top><em>nNewHeight</em> </td><td>height after resize </td></tr> + <tr><td valign=top><em>resetTo0</em> </td><td>by default the vector are filled by 0. set false to gain performances.</td></tr> + </table> +</dl> + +<p> +Definition at line <a class="el" href="a05486.html#l01565">1565</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +References <a class="el" href="a05486.html#l00070">bitPerPixels</a>, <a class="el" href="a05587.html#l00141">NLMISC::contReset()</a>, <a class="el" href="a06116.html#l00231">NLMISC::CObjectVector< uint8 >::fill()</a>, <a class="el" href="a05487.html#l00070">NLMISC::MAX_MIPMAP</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>, <a class="el" href="a06116.html#l00142">NLMISC::CObjectVector< uint8 >::resize()</a>, <a class="el" href="a05981.html#l00099">sint32</a>, and <a class="el" href="a05981.html#l00100">uint32</a>. +<p> +Referenced by <a class="el" href="a05790.html#l00337">NL3D::CHLSColorTexture::buildColorVersion()</a>, and <a class="el" href="a05486.html#l01545">resize()</a>. +<p> +<div class="fragment"><pre>01566 { +01567 <a class="code" href="a04199.html#a6">nlassert</a>(numMipMap<MAX_MIPMAP); +01568 +01569 <span class="comment">// free memory</span> +01570 <a class="code" href="a05378.html#a381">NLMISC::contReset</a>(_Data[numMipMap]); +01571 +01572 <span class="comment">// DXTC compressed??</span> +01573 <span class="comment">//bool isDXTC= PixelFormat==DXTC1 || PixelFormat==DXTC1Alpha || PixelFormat==DXTC3 || PixelFormat==DXTC5;</span> +01574 <span class="comment">// if yes, must round up width and height to 4, for allocation</span> +01575 nNewWidth= 4*((nNewWidth+3)/4); +01576 nNewHeight= 4*((nNewHeight+3)/4); +01577 +01578 <span class="comment">// resize the buffer</span> +01579 <a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[numMipMap].resize (((<a class="code" href="a04558.html#a11">uint32</a>)(nNewWidth*nNewHeight)*bitPerPixels[PixelFormat])/8); +01580 +01581 <span class="comment">// Fill 0?</span> +01582 <span class="keywordflow">if</span>( resetTo0 ) +01583 <a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[numMipMap].fill(0); +01584 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBitmapz1925_14" doxytag="NLMISC::CBitmap::rgbaToAlpha" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLMISC::CBitmap::rgbaToAlpha </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05486.html#l00708">708</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +References <a class="el" href="a05487.html#l00093">_MipMapCount</a>, <a class="el" href="a05587.html#l00141">NLMISC::contReset()</a>, <a class="el" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>, <a class="el" href="a06116.html#l00142">NLMISC::CObjectVector< T, EnableObjectBehavior >::resize()</a>, <a class="el" href="a06116.html#l00184">NLMISC::CObjectVector< uint8 >::size()</a>, <a class="el" href="a05538.html#l02935">size</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00100">uint32</a>, and <a class="el" href="a05981.html#l00096">uint8</a>. +<p> +Referenced by <a class="el" href="a05486.html#l00821">convertToAlpha()</a>. +<p> +<div class="fragment"><pre>00709 { +00710 <a class="code" href="a04558.html#a11">uint32</a> i; +00711 +00712 <span class="keywordflow">if</span>(<a class="code" href="a02268.html#NL3D_1_1ITexturep5">_Width</a>*<a class="code" href="a02268.html#NL3D_1_1ITexturep1">_Height</a> == 0) <span class="keywordflow">return</span> <span class="keyword">false</span>; +00713 +00714 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a7">uint8</a> m= 0; m<<a class="code" href="a02268.html#NL3D_1_1ITexturep3">_MipMapCount</a>; m++) +00715 { +00716 CObjectVector<uint8> dataTmp; +00717 dataTmp.resize(_Data[m].<a class="code" href="a04115.html#a94">size</a>()/4); +00718 <a class="code" href="a04558.html#a15">uint</a> dstId= 0; +00719 +00720 <span class="keywordflow">for</span>(i=0; i<<a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[m].size(); i+=4) +00721 { +00722 dataTmp[dstId++]= _Data[m][i+3]; +00723 } +00724 <a class="code" href="a05378.html#a381">NLMISC::contReset</a>(_Data[m]); +00725 _Data[m].resize(0); +00726 _Data[m] = dataTmp; +00727 } +00728 <a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a> = <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw0">Alpha</a>; +00729 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00730 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBitmapz1925_15" doxytag="NLMISC::CBitmap::rgbaToAlphaLuminance" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLMISC::CBitmap::rgbaToAlphaLuminance </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05486.html#l00550">550</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +References <a class="el" href="a05487.html#l00093">_MipMapCount</a>, <a class="el" href="a05587.html#l00141">NLMISC::contReset()</a>, <a class="el" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>, <a class="el" href="a06116.html#l00142">NLMISC::CObjectVector< T, EnableObjectBehavior >::resize()</a>, <a class="el" href="a06116.html#l00184">NLMISC::CObjectVector< uint8 >::size()</a>, <a class="el" href="a05538.html#l02935">size</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00100">uint32</a>, and <a class="el" href="a05981.html#l00096">uint8</a>. +<p> +Referenced by <a class="el" href="a05486.html#l00852">convertToAlphaLuminance()</a>. +<p> +<div class="fragment"><pre>00551 { +00552 <a class="code" href="a04558.html#a11">uint32</a> i; +00553 +00554 <span class="keywordflow">if</span>(<a class="code" href="a02268.html#NL3D_1_1ITexturep5">_Width</a>*<a class="code" href="a02268.html#NL3D_1_1ITexturep1">_Height</a> == 0) <span class="keywordflow">return</span> <span class="keyword">false</span>; +00555 +00556 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a7">uint8</a> m= 0; m<<a class="code" href="a02268.html#NL3D_1_1ITexturep3">_MipMapCount</a>; m++) +00557 { +00558 CObjectVector<uint8> dataTmp; +00559 dataTmp.resize(_Data[m].<a class="code" href="a04115.html#a94">size</a>()/2); +00560 <a class="code" href="a04558.html#a15">uint</a> dstId= 0; +00561 +00562 <span class="keywordflow">for</span>(i=0; i<<a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[m].size(); i+=4) +00563 { +00564 dataTmp[dstId++]= (_Data[m][i]*77 + _Data[m][i+1]*150 + _Data[m][i+2]*28)/255; +00565 dataTmp[dstId++]= _Data[m][i+3]; +00566 } +00567 <a class="code" href="a05378.html#a381">NLMISC::contReset</a>(_Data[m]); +00568 _Data[m].resize(0); +00569 _Data[m] = dataTmp; +00570 } +00571 <a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a> = <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw1">AlphaLuminance</a>; +00572 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00573 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBitmapz1925_16" doxytag="NLMISC::CBitmap::rgbaToLuminance" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLMISC::CBitmap::rgbaToLuminance </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05486.html#l00635">635</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +References <a class="el" href="a05487.html#l00093">_MipMapCount</a>, <a class="el" href="a05587.html#l00141">NLMISC::contReset()</a>, <a class="el" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>, <a class="el" href="a06116.html#l00142">NLMISC::CObjectVector< T, EnableObjectBehavior >::resize()</a>, <a class="el" href="a06116.html#l00184">NLMISC::CObjectVector< uint8 >::size()</a>, <a class="el" href="a05538.html#l02935">size</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00100">uint32</a>, and <a class="el" href="a05981.html#l00096">uint8</a>. +<p> +Referenced by <a class="el" href="a05486.html#l00790">convertToLuminance()</a>. +<p> +<div class="fragment"><pre>00636 { +00637 <a class="code" href="a04558.html#a11">uint32</a> i; +00638 +00639 <span class="keywordflow">if</span>(<a class="code" href="a02268.html#NL3D_1_1ITexturep5">_Width</a>*<a class="code" href="a02268.html#NL3D_1_1ITexturep1">_Height</a> == 0) <span class="keywordflow">return</span> <span class="keyword">false</span>; +00640 +00641 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a7">uint8</a> m= 0; m<<a class="code" href="a02268.html#NL3D_1_1ITexturep3">_MipMapCount</a>; m++) +00642 { +00643 CObjectVector<uint8> dataTmp; +00644 dataTmp.resize(_Data[m].<a class="code" href="a04115.html#a94">size</a>()/4); +00645 <a class="code" href="a04558.html#a15">uint</a> dstId= 0; +00646 +00647 <span class="keywordflow">for</span>(i=0; i<<a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[m].size(); i+=4) +00648 { +00649 dataTmp[dstId++]= (_Data[m][i]*77 + _Data[m][i+1]*150 + _Data[m][i+2]*28)/255; +00650 } +00651 <a class="code" href="a05378.html#a381">NLMISC::contReset</a>(_Data[m]); +00652 _Data[m].resize(0); +00653 _Data[m] = dataTmp; +00654 } +00655 <a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a> = <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw8">Luminance</a>; +00656 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00657 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1ITexturea35" doxytag="NLMISC::CBitmap::rot90CCW" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CBitmap::rot90CCW </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Rotation of the bitmap of 90 degree in counter clockwise +<p> +Definition at line <a class="el" href="a05486.html#l02781">2781</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +References <a class="el" href="a05487.html#l00093">_MipMapCount</a>, <a class="el" href="a05486.html#l01422">buildMipMaps()</a>, <a class="el" href="a05587.html#l00141">NLMISC::contReset()</a>, <a class="el" href="a05486.html#l01388">getHeight()</a>, <a class="el" href="a05486.html#l01363">getWidth()</a>, <a class="el" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>, <a class="el" href="a05486.html#l01493">releaseMipMaps()</a>, <a class="el" href="a06116.html#l00142">NLMISC::CObjectVector< T, EnableObjectBehavior >::resize()</a>, <a class="el" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew25">RGBA</a>, <a class="el" href="a05981.html#l00099">sint32</a>, and <a class="el" href="a05981.html#l00100">uint32</a>. +<p> +<div class="fragment"><pre>02782 { +02783 <span class="keywordflow">if</span> (<a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a> != <a class="code" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew25">RGBA</a>) +02784 <span class="keywordflow">return</span>; +02785 <a class="code" href="a04558.html#a10">sint32</a> nWidth = <a class="code" href="a02268.html#NL3D_1_1ITexturea20">getWidth</a>(0); +02786 <a class="code" href="a04558.html#a10">sint32</a> nHeight = <a class="code" href="a02268.html#NL3D_1_1ITexturea12">getHeight</a>(0); +02787 <a class="code" href="a04558.html#a10">sint32</a> i, j; +02788 <a class="code" href="a03337.html">NLMISC::CRGBA</a> *pSrcRgba = (<a class="code" href="a03337.html">NLMISC::CRGBA</a>*)&<a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[0][0]; +02789 <span class="keywordtype">bool</span> needRebuild = <span class="keyword">false</span>; +02790 +02791 <span class="keywordflow">if</span>(<a class="code" href="a02268.html#NL3D_1_1ITexturep3">_MipMapCount</a>>1) +02792 needRebuild = <span class="keyword">true</span>; +02793 <a class="code" href="a02268.html#NL3D_1_1ITexturea30">releaseMipMaps</a>(); +02794 +02795 CObjectVector<uint8> pDestui; +02796 pDestui.resize(nWidth*nHeight*4); +02797 <a class="code" href="a03337.html">NLMISC::CRGBA</a> *pDestRgba = (<a class="code" href="a03337.html">NLMISC::CRGBA</a>*)&pDestui[0]; +02798 +02799 <span class="keywordflow">for</span>( j = 0; j < nHeight; ++j ) +02800 <span class="keywordflow">for</span>( i = 0; i < nWidth; ++i ) +02801 pDestRgba[j+i*nHeight] = pSrcRgba[nWidth-1-i+j*nWidth]; +02802 +02803 <a class="code" href="a04558.html#a11">uint32</a> nTemp = <a class="code" href="a02268.html#NL3D_1_1ITexturep5">_Width</a>; +02804 _Width = <a class="code" href="a02268.html#NL3D_1_1ITexturep1">_Height</a>; +02805 _Height = nTemp; +02806 +02807 <a class="code" href="a05378.html#a381">NLMISC::contReset</a>(_Data[0]); <span class="comment">// free memory</span> +02808 <a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[0] = pDestui; +02809 <span class="comment">// Rebuilding mipmaps</span> +02810 <span class="keywordflow">if</span>(needRebuild) +02811 { +02812 <a class="code" href="a02268.html#NL3D_1_1ITexturea3">buildMipMaps</a>(); +02813 } +02814 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1ITexturea36" doxytag="NLMISC::CBitmap::rot90CW" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CBitmap::rot90CW </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Rotation of the bitmap of 90 degree in clockwise +<p> +Definition at line <a class="el" href="a05486.html#l02746">2746</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +References <a class="el" href="a05487.html#l00093">_MipMapCount</a>, <a class="el" href="a05486.html#l01422">buildMipMaps()</a>, <a class="el" href="a05587.html#l00141">NLMISC::contReset()</a>, <a class="el" href="a05486.html#l01388">getHeight()</a>, <a class="el" href="a05486.html#l01363">getWidth()</a>, <a class="el" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>, <a class="el" href="a05486.html#l01493">releaseMipMaps()</a>, <a class="el" href="a06116.html#l00142">NLMISC::CObjectVector< T, EnableObjectBehavior >::resize()</a>, <a class="el" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew25">RGBA</a>, <a class="el" href="a05981.html#l00099">sint32</a>, and <a class="el" href="a05981.html#l00100">uint32</a>. +<p> +<div class="fragment"><pre>02747 { +02748 <span class="keywordflow">if</span> (<a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a> != <a class="code" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew25">RGBA</a>) +02749 <span class="keywordflow">return</span>; +02750 <a class="code" href="a04558.html#a10">sint32</a> nWidth = <a class="code" href="a02268.html#NL3D_1_1ITexturea20">getWidth</a>(0); +02751 <a class="code" href="a04558.html#a10">sint32</a> nHeight = <a class="code" href="a02268.html#NL3D_1_1ITexturea12">getHeight</a>(0); +02752 <a class="code" href="a04558.html#a10">sint32</a> i, j; +02753 <a class="code" href="a03337.html">NLMISC::CRGBA</a> *pSrcRgba = (<a class="code" href="a03337.html">NLMISC::CRGBA</a>*)&<a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[0][0]; +02754 <span class="keywordtype">bool</span> needRebuild = <span class="keyword">false</span>; +02755 +02756 <span class="keywordflow">if</span>(<a class="code" href="a02268.html#NL3D_1_1ITexturep3">_MipMapCount</a>>1) +02757 needRebuild = <span class="keyword">true</span>; +02758 <a class="code" href="a02268.html#NL3D_1_1ITexturea30">releaseMipMaps</a>(); +02759 +02760 CObjectVector<uint8> pDestui; +02761 pDestui.resize(nWidth*nHeight*4); +02762 <a class="code" href="a03337.html">NLMISC::CRGBA</a> *pDestRgba = (<a class="code" href="a03337.html">NLMISC::CRGBA</a>*)&pDestui[0]; +02763 +02764 <span class="keywordflow">for</span>( j = 0; j < nHeight; ++j ) +02765 <span class="keywordflow">for</span>( i = 0; i < nWidth; ++i ) +02766 pDestRgba[j+i*nHeight] = pSrcRgba[i+(nHeight-1-j)*nWidth]; +02767 +02768 <a class="code" href="a04558.html#a11">uint32</a> nTemp = <a class="code" href="a02268.html#NL3D_1_1ITexturep5">_Width</a>; +02769 _Width = <a class="code" href="a02268.html#NL3D_1_1ITexturep1">_Height</a>; +02770 _Height = nTemp; +02771 +02772 <a class="code" href="a05378.html#a381">NLMISC::contReset</a>(_Data[0]); <span class="comment">// free memory</span> +02773 <a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[0] = pDestui; +02774 <span class="comment">// Rebuilding mipmaps</span> +02775 <span class="keywordflow">if</span>(needRebuild) +02776 { +02777 <a class="code" href="a02268.html#NL3D_1_1ITexturea3">buildMipMaps</a>(); +02778 } +02779 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1ITexturea37" doxytag="NLMISC::CBitmap::rotateCCW" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CBitmap::rotateCCW </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Rotate a bitmap in CCW mode.<p> +<dl compact><dt><b>See also:</b></dt><dd><a class="el" href="a02268.html#NL3D_1_1ITexturea30">releaseMipMaps()</a>.</dd></dl> + +<p> +Definition at line <a class="el" href="a05486.html#l02306">2306</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +References <a class="el" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>, <a class="el" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew25">RGBA</a>, <a class="el" href="a05486.html#l02283">NLMISC::rotateCCW()</a>, <a class="el" href="a05981.html#l00098">uint16</a>, and <a class="el" href="a05981.html#l00100">uint32</a>. +<p> +<div class="fragment"><pre>02307 { +02308 <span class="comment">// Copy the array</span> +02309 CObjectVector<uint8> copy=<a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[0]; +02310 +02311 <span class="keywordflow">switch</span> (<a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>) +02312 { +02313 <span class="keywordflow">case</span> <a class="code" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew25">RGBA</a>: +02314 <a class="code" href="a05378.html#a254">NLMISC::rotateCCW</a> ((<a class="code" href="a04558.html#a11">uint32</a>*)&(_Data[0][0]), (<a class="code" href="a04558.html#a11">uint32</a>*)&(copy[0]), _Width, _Height); +02315 <span class="keywordflow">break</span>; +02316 <span class="keywordflow">case</span> <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw8">Luminance</a>: +02317 <span class="keywordflow">case</span> <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw0">Alpha</a>: +02318 <a class="code" href="a05378.html#a254">NLMISC::rotateCCW</a> (&_Data[0][0], &copy[0], _Width, _Height); +02319 <span class="keywordflow">break</span>; +02320 <span class="keywordflow">case</span> <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw1">AlphaLuminance</a>: +02321 <a class="code" href="a05378.html#a254">NLMISC::rotateCCW</a> ((<a class="code" href="a04558.html#a9">uint16</a>*)&(_Data[0][0]), (<a class="code" href="a04558.html#a9">uint16</a>*)&(copy[0]), _Width, _Height);; +02322 <span class="keywordflow">break</span>; +02323 <span class="keywordflow">default</span>: <span class="keywordflow">break</span>; +02324 } +02325 +02326 <a class="code" href="a04558.html#a11">uint32</a> tmp=<a class="code" href="a02268.html#NL3D_1_1ITexturep5">_Width</a>; +02327 _Width=<a class="code" href="a02268.html#NL3D_1_1ITexturep1">_Height</a>; +02328 _Height=tmp; +02329 _Data[0]=copy; +02330 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1ITexturea40" doxytag="NLMISC::CBitmap::setMipMapCount" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CBitmap::setMipMapCount </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a11">uint32</a> </td> + <td class="mdname1" valign="top" nowrap> <em>mmc</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +ADVANCED USE To use in conjunction with resizeMipMap. Setup the correct total number of mipmap No validity check is made. It is the user responsabitility fo setup correct mipmap count. +<p> +Definition at line <a class="el" href="a05486.html#l01590">1590</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +References <a class="el" href="a05487.html#l00093">_MipMapCount</a>, <a class="el" href="a05981.html#l00100">uint32</a>, and <a class="el" href="a06590.html#l00215">uint8</a>. +<p> +Referenced by <a class="el" href="a05790.html#l00337">NL3D::CHLSColorTexture::buildColorVersion()</a>. +<p> +<div class="fragment"><pre>01591 { +01592 <a class="code" href="a02268.html#NL3D_1_1ITexturep3">_MipMapCount</a>= <a class="code" href="a05167.html#a9">uint8</a>(mmc); +01593 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBitmaph0" doxytag="NLMISC::CBitmap::uncompress" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CBitmap::uncompress </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a9">uint16</a> </td> + <td class="mdname" nowrap> <em>color</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a03337.html">NLMISC::CRGBA</a> & </td> + <td class="mdname" nowrap></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [inline, static, private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Extracting RGBA infos from a 16bits word. (used by S3TC decompression) <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign=top><em>color</em> </td><td>a 16bits integer </td></tr> + <tr><td valign=top><em>r</em> </td><td>a <a class="el" href="a03337.html">CRGBA</a></td></tr> + </table> +</dl> + +<p> +Definition at line <a class="el" href="a05486.html#l01350">1350</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +References <a class="el" href="a05646.html#l00993">r</a>, and <a class="el" href="a05981.html#l00098">uint16</a>. +<p> +Referenced by <a class="el" href="a05486.html#l00965">decompressDXT1()</a>, <a class="el" href="a05486.html#l01090">decompressDXT3()</a>, <a class="el" href="a05486.html#l01200">decompressDXT5()</a>, and <a class="el" href="a05486.html#l02990">getDXTCColorFromBlock()</a>. +<p> +<div class="fragment"><pre>01351 { +01352 <a class="code" href="a04223.html#a628">r</a>.A= 0; +01353 <a class="code" href="a04223.html#a628">r</a>.R= ((color>>11)&31) << 3; <a class="code" href="a04223.html#a628">r</a>.R+= <a class="code" href="a04223.html#a628">r</a>.R>>5; +01354 <a class="code" href="a04223.html#a628">r</a>.G= ((color>>5)&63) << 2; <a class="code" href="a04223.html#a628">r</a>.G+= <a class="code" href="a04223.html#a628">r</a>.G>>6; +01355 <a class="code" href="a04223.html#a628">r</a>.B= ((color)&31) << 3; <a class="code" href="a04223.html#a628">r</a>.B+= <a class="code" href="a04223.html#a628">r</a>.B>>5; +01356 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1ITexturea48" doxytag="NLMISC::CBitmap::writeJPG" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLMISC::CBitmap::writeJPG </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02270.html">NLMISC::IStream</a> & </td> + <td class="mdname" nowrap> <em>f</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a7">uint8</a> </td> + <td class="mdname" nowrap> <em>quality</em> = 80</td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [inline]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Write a JPG from the object pixels buffer. If the current pixel format is not rgba then the method does nothing If the pixel format is Alpha then we save in 8 bpp <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign=top><em>f</em> </td><td><a class="el" href="a02270.html">IStream</a> (must be a reading stream) </td></tr> + <tr><td valign=top><em>quality</em> </td><td>0=very bad quality 100=best quality </td></tr> + </table> +</dl> +<dl compact><dt><b>Returns:</b></dt><dd>true if succeed, false else</dd></dl> + +<p> +Definition at line <a class="el" href="a05487.html#l00620">620</a> of file <a class="el" href="a05487.html">bitmap.h</a>. +<p> +References <a class="el" href="a05622.html#l00135">nlwarning</a>, and <a class="el" href="a05981.html#l00096">uint8</a>. +<p> +<div class="fragment"><pre>00621 { +00622 <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"You must put #define USE_JPEG before all include in the file where you call writeJPG() if you want jpeg support"</span>); +00623 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00624 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1ITexturea49" doxytag="NLMISC::CBitmap::writeTGA" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLMISC::CBitmap::writeTGA </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02270.html">NLMISC::IStream</a> & </td> + <td class="mdname" nowrap> <em>f</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a11">uint32</a> </td> + <td class="mdname" nowrap> <em>d</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>bool </td> + <td class="mdname" nowrap> <em>upsideDown</em> = false</td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Write a TGA (24 or 32 bits) from the object pixels buffer. If the current pixel format is not rgba then the method does nothing If the pixel format is Alpha then we save in 8 bpp <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign=top><em>f</em> </td><td><a class="el" href="a02270.html">IStream</a> (must be a reading stream) </td></tr> + <tr><td valign=top><em>d</em> </td><td>depth : 8 or 16 or 24 or 32 </td></tr> + <tr><td valign=top><em>upsideDown</em> </td><td>if true, the bitmap will be saved with the upside down </td></tr> + </table> +</dl> +<dl compact><dt><b>Returns:</b></dt><dd>true if succeed, false else</dd></dl> + +<p> +Definition at line <a class="el" href="a05486.html#l02139">2139</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +References <a class="el" href="a05646.html#l01013">depth</a>, <a class="el" href="a05646.html#l01013">height</a>, <a class="el" href="a06463.html#l00064">NLMISC::IStream::isReading()</a>, <a class="el" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a>, <a class="el" href="a05646.html#l00993">r</a>, <a class="el" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew25">RGBA</a>, <a class="el" href="a06462.html#l00232">NLMISC::IStream::serial()</a>, <a class="el" href="a05981.html#l00099">sint32</a>, <a class="el" href="a05981.html#l00098">uint16</a>, <a class="el" href="a05981.html#l00100">uint32</a>, <a class="el" href="a05981.html#l00096">uint8</a>, <a class="el" href="a05646.html#l01013">width</a>, <a class="el" href="a05646.html#l00236">x</a>, and <a class="el" href="a05646.html#l00236">y</a>. +<p> +Referenced by <a class="el" href="a06523.html#l00133">NL3D::CTextureFont::dumpTextureFont()</a>, <a class="el" href="a06768.html#l02927">NL3D::CZoneLighter::lightWater()</a>, and <a class="el" href="a06092.html#l00192">NL3D::CNELU::screenshot()</a>. +<p> +<div class="fragment"><pre>02140 { +02141 <span class="keywordflow">if</span>(f.<a class="code" href="a02270.html#NLMISC_1_1IStreama0">isReading</a>()) <span class="keywordflow">return</span> <span class="keyword">false</span>; +02142 <span class="keywordflow">if</span>(d!=24 && d!=32 && d!=16 && d!=8) <span class="keywordflow">return</span> <span class="keyword">false</span>; +02143 <span class="keywordflow">if</span> ((<a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a> != <a class="code" href="a02268.html#NL3D_1_1ITexturew31NL3D_1_1ITexturew25">RGBA</a>)&&(<a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a> != <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw0">Alpha</a>)&&(<a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a> != <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw8">Luminance</a>)) <span class="keywordflow">return</span> <span class="keyword">false</span>; +02144 <span class="keywordflow">if</span> ((<a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a> == <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw0">Alpha</a>) && (d != 8)) <span class="keywordflow">return</span> <span class="keyword">false</span>; +02145 <span class="keywordflow">if</span> ((<a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a> == <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw8">Luminance</a>) && (d != 8)) <span class="keywordflow">return</span> <span class="keyword">false</span>; +02146 +02147 <a class="code" href="a04558.html#a10">sint32</a> i,j,<a class="code" href="a04223.html#a572">x</a>,<a class="code" href="a04223.html#a573">y</a>; +02148 <a class="code" href="a04558.html#a7">uint8</a> * scanline; +02149 <a class="code" href="a04558.html#a7">uint8</a> <a class="code" href="a04223.html#a628">r</a>,g,b,a; +02150 +02151 <a class="code" href="a04558.html#a7">uint8</a> lengthID = 0; +02152 <a class="code" href="a04558.html#a7">uint8</a> cMapType = 0; +02153 <a class="code" href="a04558.html#a7">uint8</a> imageType = 2; +02154 <a class="code" href="a04558.html#a9">uint16</a> origin = 0; +02155 <a class="code" href="a04558.html#a9">uint16</a> length = 0; +02156 <a class="code" href="a04558.html#a7">uint8</a> <a class="code" href="a04223.html#a634">depth</a> = 0; +02157 <a class="code" href="a04558.html#a9">uint16</a> xOrg = 0; +02158 <a class="code" href="a04558.html#a9">uint16</a> yOrg = 0; +02159 <a class="code" href="a04558.html#a9">uint16</a> <a class="code" href="a04223.html#a632">width</a> = (<a class="code" href="a04558.html#a9">uint16</a>)<a class="code" href="a02268.html#NL3D_1_1ITexturep5">_Width</a>; +02160 <a class="code" href="a04558.html#a9">uint16</a> <a class="code" href="a04223.html#a633">height</a> = (<a class="code" href="a04558.html#a9">uint16</a>)<a class="code" href="a02268.html#NL3D_1_1ITexturep1">_Height</a>; +02161 <a class="code" href="a04558.html#a7">uint8</a> imageDepth = (<a class="code" href="a04558.html#a7">uint8</a>)d; +02162 <a class="code" href="a04558.html#a7">uint8</a> desc = 0; +02163 <span class="keywordflow">if</span> (upsideDown) +02164 desc |= 1<<5; +02165 +02166 <span class="keywordflow">if</span> ((<a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a> == <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw0">Alpha</a>) || (<a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a> == <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw8">Luminance</a>)) +02167 imageType = 3; <span class="comment">// Uncompressed grayscale</span> +02168 +02169 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(lengthID); +02170 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(cMapType); +02171 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(imageType); +02172 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(origin); +02173 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(length); +02174 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(depth); +02175 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(xOrg); +02176 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(yOrg); +02177 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(width); +02178 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(height); +02179 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(imageDepth); +02180 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(desc); +02181 +02182 <span class="keywordflow">if</span> ((<a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a> == <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw0">Alpha</a>)||(<a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a> == <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw8">Luminance</a>)) +02183 scanline = <span class="keyword">new</span> <a class="code" href="a04558.html#a7">uint8</a>[<a class="code" href="a04223.html#a632">width</a>]; +02184 <span class="keywordflow">else</span> +02185 scanline = <span class="keyword">new</span> <a class="code" href="a04558.html#a7">uint8</a>[<a class="code" href="a04223.html#a632">width</a>*4]; +02186 <span class="keywordflow">if</span>(!scanline) +02187 { +02188 <span class="keywordflow">throw</span> EAllocationFailure(); +02189 } +02190 +02191 <span class="keywordflow">for</span>(<a class="code" href="a04223.html#a573">y</a>=0; <a class="code" href="a04223.html#a573">y</a><(<a class="code" href="a04558.html#a10">sint32</a>)<a class="code" href="a04223.html#a633">height</a>; <a class="code" href="a04223.html#a573">y</a>++) +02192 { +02193 +02194 <a class="code" href="a04558.html#a11">uint32</a> k=0; +02195 <span class="keywordflow">if</span> (<a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a> == <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw0">Alpha</a>) +02196 { +02197 <span class="keywordflow">for</span>(i=0; i<<a class="code" href="a04223.html#a632">width</a>; ++i) <span class="comment">// Alpha</span> +02198 { +02199 scanline[k++] = <a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[0][(<a class="code" href="a04223.html#a633">height</a>-<a class="code" href="a04223.html#a573">y</a>-1)*<a class="code" href="a04223.html#a632">width</a> + i]; +02200 } +02201 } +02202 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="a02268.html#NL3D_1_1ITextureo3">PixelFormat</a> == <a class="code" href="a02268.html#NL3D_1_1ITexturew31NLMISC_1_1CBitmapw8">Luminance</a>) +02203 { +02204 <span class="keywordflow">for</span>(i=0; i<<a class="code" href="a04223.html#a632">width</a>; ++i) <span class="comment">// Luminance</span> +02205 { +02206 scanline[k++] = <a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[0][(<a class="code" href="a04223.html#a633">height</a>-<a class="code" href="a04223.html#a573">y</a>-1)*<a class="code" href="a04223.html#a632">width</a> + i]; +02207 } +02208 } +02209 <span class="keywordflow">else</span> +02210 { +02211 <span class="keywordflow">for</span>(i=0; i<<a class="code" href="a04223.html#a632">width</a>*4; i+=4) <span class="comment">// 4:RGBA</span> +02212 { +02213 <span class="keywordflow">if</span>(d==16) +02214 { +02215 <span class="keywordflow">for</span>(j=0; j<(<a class="code" href="a04558.html#a10">sint32</a>)4; j++) +02216 { +02217 scanline[k++] = <a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[0][(<a class="code" href="a04223.html#a633">height</a>-<a class="code" href="a04223.html#a573">y</a>-1)*<a class="code" href="a04223.html#a632">width</a>*4 + i + j]; +02218 } +02219 } +02220 <span class="keywordflow">else</span> +02221 { +02222 <span class="keywordflow">for</span>(j=0; j<(<a class="code" href="a04558.html#a10">sint32</a>)d/8; j++) +02223 { +02224 scanline[k++] = <a class="code" href="a02268.html#NL3D_1_1ITexturep0">_Data</a>[0][(<a class="code" href="a04223.html#a633">height</a>-<a class="code" href="a04223.html#a573">y</a>-1)*<a class="code" href="a04223.html#a632">width</a>*4 + i + j]; +02225 } +02226 } +02227 } +02228 } +02229 +02230 <span class="keywordflow">if</span>(d==16) +02231 { +02232 <span class="keywordflow">for</span>(<a class="code" href="a04223.html#a572">x</a>=0; <a class="code" href="a04223.html#a572">x</a><(<a class="code" href="a04558.html#a10">sint32</a>)<a class="code" href="a04223.html#a632">width</a>; <a class="code" href="a04223.html#a572">x</a>++) +02233 { +02234 <a class="code" href="a04223.html#a628">r</a> = scanline[<a class="code" href="a04223.html#a572">x</a>*4+0]; +02235 g = scanline[<a class="code" href="a04223.html#a572">x</a>*4+1]; +02236 b = scanline[<a class="code" href="a04223.html#a572">x</a>*4+2]; +02237 <span class="keywordtype">int</span> rr = <a class="code" href="a04223.html#a628">r</a> >>3; +02238 <span class="keywordtype">int</span> gg = g >>3; +02239 <span class="keywordtype">int</span> bb = b >>3; +02240 <a class="code" href="a04558.html#a9">uint16</a> c16 = (rr<<10) | (gg<<5) | bb; +02241 scanline[<a class="code" href="a04223.html#a572">x</a>*2+0] = c16&0xff; +02242 scanline[<a class="code" href="a04223.html#a572">x</a>*2+1] = c16>>8; +02243 } +02244 } +02245 <span class="keywordflow">if</span>(d==24) +02246 { +02247 <span class="keywordflow">for</span>(<a class="code" href="a04223.html#a572">x</a>=0; <a class="code" href="a04223.html#a572">x</a><(<a class="code" href="a04558.html#a10">sint32</a>)<a class="code" href="a04223.html#a632">width</a>; <a class="code" href="a04223.html#a572">x</a>++) +02248 { +02249 <a class="code" href="a04223.html#a628">r</a> = scanline[<a class="code" href="a04223.html#a572">x</a>*3+0]; +02250 g = scanline[<a class="code" href="a04223.html#a572">x</a>*3+1]; +02251 b = scanline[<a class="code" href="a04223.html#a572">x</a>*3+2]; +02252 scanline[<a class="code" href="a04223.html#a572">x</a>*3+0] = b; +02253 scanline[<a class="code" href="a04223.html#a572">x</a>*3+1] = g; +02254 scanline[<a class="code" href="a04223.html#a572">x</a>*3+2] = <a class="code" href="a04223.html#a628">r</a>; +02255 } +02256 } +02257 <span class="keywordflow">if</span>(d==32) +02258 { +02259 <span class="keywordflow">for</span>(<a class="code" href="a04223.html#a572">x</a>=0; <a class="code" href="a04223.html#a572">x</a><(<a class="code" href="a04558.html#a10">sint32</a>)<a class="code" href="a04223.html#a632">width</a>; <a class="code" href="a04223.html#a572">x</a>++) +02260 { +02261 <a class="code" href="a04223.html#a628">r</a> = scanline[<a class="code" href="a04223.html#a572">x</a>*4+0]; +02262 g = scanline[<a class="code" href="a04223.html#a572">x</a>*4+1]; +02263 b = scanline[<a class="code" href="a04223.html#a572">x</a>*4+2]; +02264 a= scanline[<a class="code" href="a04223.html#a572">x</a>*4+3]; +02265 scanline[<a class="code" href="a04223.html#a572">x</a>*4+0] = b; +02266 scanline[<a class="code" href="a04223.html#a572">x</a>*4+1] = g; +02267 scanline[<a class="code" href="a04223.html#a572">x</a>*4+2] = <a class="code" href="a04223.html#a628">r</a>; +02268 scanline[<a class="code" href="a04223.html#a572">x</a>*4+3] = a; +02269 } +02270 } +02271 +02272 <span class="keywordtype">int</span> finaleSize=<a class="code" href="a04223.html#a632">width</a>*d/8; +02273 <span class="keywordflow">for</span>(i=0; i<finaleSize; i++) +02274 { +02275 f.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(scanline[i]); +02276 } +02277 } +02278 <span class="keyword">delete</span> scanline; +02279 <span class="keywordflow">return</span> <span class="keyword">true</span>; +02280 } +</pre></div> </td> + </tr> +</table> +<hr><h2>Field Documentation</h2> +<a class="anchor" name="NL3D_1_1ITexturep0" doxytag="NLMISC::CBitmap::_Data" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03000.html">CObjectVector</a><<a class="el" href="a04558.html#a7">uint8</a>> <a class="el" href="a02268.html#NL3D_1_1ITexturep0">NLMISC::CBitmap::_Data</a>[<a class="el" href="a05378.html#a43">MAX_MIPMAP</a>]<code> [protected]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Reimplemented in <a class="el" href="a03511.html#NL3D_1_1CTextureMemr1">NL3D::CTextureMem</a>. +<p> +Definition at line <a class="el" href="a05487.html#l00090">90</a> of file <a class="el" href="a05487.html">bitmap.h</a>. +<p> +Referenced by <a class="el" href="a05486.html#l02817">blend()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1ITexturep1" doxytag="NLMISC::CBitmap::_Height" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a11">uint32</a> <a class="el" href="a02268.html#NL3D_1_1ITexturep1">NLMISC::CBitmap::_Height</a><code> [protected]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05487.html#l00096">96</a> of file <a class="el" href="a05487.html">bitmap.h</a>. +<p> +Referenced by <a class="el" href="a05486.html#l02817">blend()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1ITexturep2" doxytag="NLMISC::CBitmap::_LoadGrayscaleAsAlpha" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool <a class="el" href="a02268.html#NL3D_1_1ITexturep2">NLMISC::CBitmap::_LoadGrayscaleAsAlpha</a><code> [protected]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05487.html#l00094">94</a> of file <a class="el" href="a05487.html">bitmap.h</a>. +<p> +Referenced by <a class="el" href="a05487.html#l00254">CBitmap()</a>, <a class="el" href="a05487.html#l00483">isGrayscaleAsAlpha()</a>, <a class="el" href="a05487.html#l00472">loadGrayscaleAsAlpha()</a>, and <a class="el" href="a05486.html#l01800">readTGA()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1ITexturep3" doxytag="NLMISC::CBitmap::_MipMapCount" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a7">uint8</a> <a class="el" href="a02268.html#NL3D_1_1ITexturep3">NLMISC::CBitmap::_MipMapCount</a><code> [protected]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05487.html#l00093">93</a> of file <a class="el" href="a05487.html">bitmap.h</a>. +<p> +Referenced by <a class="el" href="a05486.html#l00762">alphaLuminanceToAlpha()</a>, <a class="el" href="a05486.html#l00677">alphaLuminanceToLuminance()</a>, <a class="el" href="a05486.html#l00519">alphaLuminanceToRGBA()</a>, <a class="el" href="a05486.html#l00607">alphaToAlphaLuminance()</a>, <a class="el" href="a05486.html#l00490">alphaToRGBA()</a>, <a class="el" href="a05486.html#l01422">buildMipMaps()</a>, <a class="el" href="a05487.html#l00254">CBitmap()</a>, <a class="el" href="a05486.html#l00965">decompressDXT1()</a>, <a class="el" href="a05486.html#l01090">decompressDXT3()</a>, <a class="el" href="a05486.html#l01200">decompressDXT5()</a>, <a class="el" href="a05486.html#l02682">flipH()</a>, <a class="el" href="a05486.html#l02714">flipV()</a>, <a class="el" href="a05487.html#l00369">getMipMapCount()</a>, <a class="el" href="a05486.html#l00736">luminanceToAlpha()</a>, <a class="el" href="a05486.html#l00579">luminanceToAlphaLuminance()</a>, <a class="el" href="a05486.html#l00462">luminanceToRGBA()</a>, <a class="el" href="a05486.html#l00184">makeDummy()</a>, <a class="el" href="a05486.html#l00244">readDDS()</a>, <a class="el" href="a05486.html#l01800">readTGA()</a>, <a class="el" href="a05486.html#l01493">releaseMipMaps()</a>, <a class="el" href="a05486.html#l01508">resample()</a>, <a class="el" href="a05486.html#l01599">reset()</a>, <a class="el" href="a05486.html#l00708">rgbaToAlpha()</a>, <a class="el" href="a05486.html#l00550">rgbaToAlphaLuminance()</a>, <a class="el" href="a05486.html#l00635">rgbaToLuminance()</a>, <a class="el" href="a05486.html#l02781">rot90CCW()</a>, <a class="el" href="a05486.html#l02746">rot90CW()</a>, and <a class="el" href="a05486.html#l01590">setMipMapCount()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1ITexturep5" doxytag="NLMISC::CBitmap::_Width" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a11">uint32</a> <a class="el" href="a02268.html#NL3D_1_1ITexturep5">NLMISC::CBitmap::_Width</a><code> [protected]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05487.html#l00095">95</a> of file <a class="el" href="a05487.html">bitmap.h</a>. +<p> +Referenced by <a class="el" href="a05486.html#l02817">blend()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1ITextures0" doxytag="NLMISC::CBitmap::bitPerPixels" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> const <a class="el" href="a04558.html#a11">uint32</a> <a class="el" href="a02268.html#NL3D_1_1ITextures0">NLMISC::CBitmap::bitPerPixels</a><code> [static]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +<b>Initial value:</b><div class="fragment"><pre> +{ + 32, + 8, + 8, + 16, + 4, + 4, + 8, + 8, + 16 +} +</pre></div> +<p> +Definition at line <a class="el" href="a05486.html#l00070">70</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +Referenced by <a class="el" href="a05486.html#l02332">blit()</a>, and <a class="el" href="a05486.html#l01565">resizeMipMap()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1ITextures1" doxytag="NLMISC::CBitmap::DXTC1HEADER" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> const <a class="el" href="a04558.html#a11">uint32</a> <a class="el" href="a02268.html#NL3D_1_1ITextures1">NLMISC::CBitmap::DXTC1HEADER</a> = NL_MAKEFOURCC('D','X', 'T', '1')<code> [static]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05486.html#l00083">83</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +Referenced by <a class="el" href="a05486.html#l00244">readDDS()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1ITextures2" doxytag="NLMISC::CBitmap::DXTC3HEADER" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> const <a class="el" href="a04558.html#a11">uint32</a> <a class="el" href="a02268.html#NL3D_1_1ITextures2">NLMISC::CBitmap::DXTC3HEADER</a> = NL_MAKEFOURCC('D','X', 'T', '3')<code> [static]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05486.html#l00084">84</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +Referenced by <a class="el" href="a05486.html#l00244">readDDS()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1ITextures3" doxytag="NLMISC::CBitmap::DXTC5HEADER" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> const <a class="el" href="a04558.html#a11">uint32</a> <a class="el" href="a02268.html#NL3D_1_1ITextures3">NLMISC::CBitmap::DXTC5HEADER</a> = NL_MAKEFOURCC('D','X', 'T', '5')<code> [static]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05486.html#l00085">85</a> of file <a class="el" href="a05486.html">bitmap.cpp</a>. +<p> +Referenced by <a class="el" href="a05486.html#l00244">readDDS()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1ITextureo3" doxytag="NLMISC::CBitmap::PixelFormat" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> enum <a class="el" href="a02268.html#NL3D_1_1ITexturew31">NLMISC::CBitmap::TType</a> <a class="el" href="a02268.html#NL3D_1_1ITextureo3">NLMISC::CBitmap::PixelFormat</a> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Referenced by <a class="el" href="a05486.html#l00762">alphaLuminanceToAlpha()</a>, <a class="el" href="a05486.html#l00677">alphaLuminanceToLuminance()</a>, <a class="el" href="a05486.html#l00519">alphaLuminanceToRGBA()</a>, <a class="el" href="a05486.html#l00607">alphaToAlphaLuminance()</a>, <a class="el" href="a05486.html#l00664">alphaToLuminance()</a>, <a class="el" href="a05486.html#l00490">alphaToRGBA()</a>, <a class="el" href="a05486.html#l02817">blend()</a>, <a class="el" href="a05486.html#l02332">blit()</a>, <a class="el" href="a06521.html#l00041">NL3D::CTextureFile::buildBitmapFromFile()</a>, <a class="el" href="a05486.html#l01422">buildMipMaps()</a>, <a class="el" href="a05487.html#l00254">CBitmap()</a>, <a class="el" href="a05486.html#l00821">convertToAlpha()</a>, <a class="el" href="a05486.html#l00852">convertToAlphaLuminance()</a>, <a class="el" href="a05486.html#l00790">convertToLuminance()</a>, <a class="el" href="a05486.html#l00882">convertToRGBA()</a>, <a class="el" href="a05486.html#l00926">convertToType()</a>, <a class="el" href="a05486.html#l00965">decompressDXT1()</a>, <a class="el" href="a05486.html#l01090">decompressDXT3()</a>, <a class="el" href="a05486.html#l01200">decompressDXT5()</a>, <a class="el" href="a05486.html#l02682">flipH()</a>, <a class="el" href="a05486.html#l02714">flipV()</a>, <a class="el" href="a05486.html#l02470">getColor()</a>, <a class="el" href="a05486.html#l03134">getPixelColor()</a>, <a class="el" href="a05487.html#l00335">getPixelFormat()</a>, <a class="el" href="a05486.html#l00736">luminanceToAlpha()</a>, <a class="el" href="a05486.html#l00579">luminanceToAlphaLuminance()</a>, <a class="el" href="a05486.html#l00462">luminanceToRGBA()</a>, <a class="el" href="a05486.html#l00184">makeDummy()</a>, <a class="el" href="a05486.html#l00244">readDDS()</a>, <a class="el" href="a05486.html#l01800">readTGA()</a>, <a class="el" href="a05486.html#l01508">resample()</a>, <a class="el" href="a05486.html#l01599">reset()</a>, <a class="el" href="a05486.html#l01545">resize()</a>, <a class="el" href="a05486.html#l01565">resizeMipMap()</a>, <a class="el" href="a05486.html#l00708">rgbaToAlpha()</a>, <a class="el" href="a05486.html#l00550">rgbaToAlphaLuminance()</a>, <a class="el" href="a05486.html#l00635">rgbaToLuminance()</a>, <a class="el" href="a05486.html#l02781">rot90CCW()</a>, <a class="el" href="a05486.html#l02746">rot90CW()</a>, <a class="el" href="a05486.html#l02306">rotateCCW()</a>, <a class="el" href="a05652.html#l00322">NL3D::sameDXTCFormat()</a>, and <a class="el" href="a05486.html#l02139">writeTGA()</a>. </td> + </tr> +</table> +<hr>The documentation for this class was generated from the following files:<ul> +<li><a class="el" href="a05487.html">bitmap.h</a><li><a class="el" href="a05486.html">bitmap.cpp</a></ul> +<hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 13:03:22 2004 for NeL by +<a href="http://www.doxygen.org/index.html"> +<img src="doxygen.png" alt="doxygen" align="middle" border=0 > +</a>1.3.6 </small></address> +</body> +</html> |