Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

Modules/ColorTableMod/ColorTable64Mod.cpp

Go to the documentation of this file.
00001 /** 
00002 * @file ColorTable64Mod.cpp
00003 * Implementation of class ColorTable64Mod.
00004 *
00005 * @author <A href=mailto:walter.nistico@uni-dortmund.de>Walter Nistico</A>
00006 */
00007 
00008 #include "ColorTable64Mod.h"
00009 #include "Tools/Location.h"
00010 
00011 /* 
00012 I don't like this.
00013 Directly copying an object to a memory buffer is a C-style low level way of instantiating it, 
00014 beside, the initialization of the memory buffer looks quite ugly because of the test operators
00015 to determine the size of the biggest colortable object, and it gets worser and worser as new
00016 colortables are implemented.
00017 I have a more elegant solution which gives access to colortables to the image processors 
00018 through a colortable pointer: it works, but it needed a thorough rewriting of the image processor
00019 interface, and it has a potential for problems with image processors designed to use a 
00020 single color table (ColorTable64) such as GridImageProcessor2.
00021 If you want to support this second approach, please write me an e-mail.
00022 */
00023 void ColorTable64Mod::setup()
00024 {
00025   ColorTable64* colorTable64 = new ColorTable64();
00026   InBinaryFile stream(getLocation().getModelFilename("coltable.c64"));
00027   colorTable64->setFormat(ColorTable64::CT64);
00028   if (stream.exists())
00029   {
00030     stream >> *colorTable64;
00031   }else{
00032     OUTPUT(idText, text, "load coltable.c64 FAILT");
00033   }
00034   memcpy(colorTable, colorTable64, sizeof(ColorTable64));
00035   delete colorTable64;
00036 }
00037 
00038 void ColorTable64Mod::execute()
00039 {
00040   //dont work hier why
00041   INFO(sendColorTable64, idText, text, "send Colortable");
00042   INFO(sendColorTable64, idColorTable64, bin, *(const ColorTable64*)&colorTable);
00043 }

Generated on Mon Mar 20 21:59:44 2006 for GT2005 by doxygen 1.3.6