Text archives Help
- From: boulos@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [MANTA] r1628 - trunk/Image
- Date: Mon, 13 Aug 2007 08:39:22 -0600 (MDT)
Author: boulos
Date: Mon Aug 13 08:39:20 2007
New Revision: 1628
Modified:
trunk/Image/PPMFile.cc
trunk/Image/TGAFile.cc
Log:
Making PPMFile use signed ints for loop to
temporarily remove warnings (will need to do
a full cleanup of image->getResolution to really
fix the problem).
Removing unused variables in TGAFile while maintaining
the file semantics (still pull off values, just not into
named variables)
Modified: trunk/Image/PPMFile.cc
==============================================================================
--- trunk/Image/PPMFile.cc (original)
+++ trunk/Image/PPMFile.cc Mon Aug 13 08:39:20 2007
@@ -62,8 +62,9 @@
RGB8Pixel* pixels=dynamic_cast<SimpleImage<RGB8Pixel> const
*>(image)->getRawPixels(0);
RGBColor rgb;
unsigned char color[3];
- for (unsigned v=0; v<height; ++v) {
- for (unsigned u=0; u<width; ++u) {
+ // TODO(boulos): Fix getResolution to be unsigned everywhere...
+ for (int v=0; v<height; ++v) {
+ for (int u=0; u<width; ++u) {
convertToRGBColor(rgb, pixels[v*width + u]);
color[0]=static_cast<unsigned char>(rgb.r()*255);
color[1]=static_cast<unsigned char>(rgb.g()*255);
@@ -100,7 +101,7 @@
while (true) {
in.get(c);
if (c=='\n')
- break;
+ break;
}
}
@@ -115,7 +116,7 @@
unsigned char color[3];
for (unsigned v=0; v<height; ++v) {
for (unsigned u=0; u<width; ++u) {
- in.read(reinterpret_cast<char*>(color), 3*sizeof(unsigned char));
+ in.read(reinterpret_cast<char*>(color), 3*sizeof(unsigned char));
convertToPixel(pixel, RGBColor(color[0]*invmax, color[1]*invmax,
color[2]*invmax));
pixels[v*width + u]=pixel;
@@ -125,7 +126,7 @@
int r, g, b;
for (unsigned v=0; v<height; ++v) {
for (unsigned u=0; u<width; ++u) {
- in>>r>>g>>b;
+ in>>r>>g>>b;
convertToPixel(pixel, RGBColor(r*invmax, g*invmax, b*invmax));
pixels[v*width + u]=pixel;
}
@@ -134,7 +135,7 @@
unsigned char gray[1];
for (unsigned v=0; v<height; ++v) {
for (unsigned u=0; u<width; ++u) {
- in.read(reinterpret_cast<char*>(gray), 1*sizeof(unsigned char));
+ in.read(reinterpret_cast<char*>(gray), 1*sizeof(unsigned char));
convertToPixel(pixel, RGBColor(gray[0]*invmax, gray[1]*invmax,
gray[2]*invmax));
pixels[v*width + u]=pixel;
Modified: trunk/Image/TGAFile.cc
==============================================================================
--- trunk/Image/TGAFile.cc (original)
+++ trunk/Image/TGAFile.cc Mon Aug 13 08:39:20 2007
@@ -95,7 +95,7 @@
bool stereo;
int xres, yres;
image->getResolution( stereo, xres, yres );
-
+
const SimpleImage< PType >* si =
dynamic_cast< const SimpleImage< PType > * >( image );
PType const *buffer = si->getRawPixels( eye );
@@ -112,7 +112,7 @@
bool stereo;
int xres, yres;
image->getResolution( stereo, xres, yres );
-
+
const SimpleImage< PType >* si =
dynamic_cast< const SimpleImage< PType > * >( image );
PType const *buffer = si->getRawPixels( eye );
@@ -256,11 +256,21 @@
int image_type = in.get();
if ( image_type != 2 )
throw InternalError( "Only uncompressed true-color TGA files currently
supported", __FILE__, __LINE__ );
+#if 0
int color_map_first_entry_index = read16bit( in );
int color_map_length = read16bit( in );
int color_map_entry_size = in.get();
int x_origin = read16bit( in );
int y_origin = read16bit( in );
+#else
+ // Instead of storing these, we'll just pull them off (to avoid
+ // warnings and yet still produce correct behaviour)
+ read16bit(in);
+ read16bit(in);
+ in.get();
+ read16bit(in);
+ read16bit(in);
+#endif
int width = read16bit( in );
int height = read16bit( in );
int pixel_depth = in.get();
- [MANTA] r1628 - trunk/Image, boulos, 08/13/2007
Archive powered by MHonArc 2.6.16.