/** A small utility to generate embedded images for Keramik, especially structured for easy recoloring... Copyright (c) 2002 Maksim Orlovich Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include #include #include #include #include #include #include #include using namespace std; #include #include //NOTE: Use of old-style header is intentional for portability. See revisions 1.6 and 1.7 //Force-touch-embedded-revision: 2 #include "keramikimage.h" /** Need to generate something like this: TargetColorAlpha, GreyAdd, SrcAlpha; so that one can do (R*T+GreyAdd, G*T+GreyAdd, B*T+GreyAdd, SrcAlpha) as pixel values */ int evalSuffix(TQString suffix) { if (suffix == "-tl") return 0; if (suffix == "-tc") return 1; if (suffix == "-tr") return 2; if (suffix == "-cl") return 3; if (suffix == "-cc") return 4; if (suffix == "-cr") return 5; if (suffix == "-bl") return 6; if (suffix == "-bc") return 7; if (suffix == "-br") return 8; if (suffix == "-separator") return KeramikTileSeparator; if (suffix == "-slider1") return KeramikSlider1; if (suffix == "-slider2") return KeramikSlider2; if (suffix == "-slider3") return KeramikSlider3; if (suffix == "-slider4") return KeramikSlider4; if (suffix == "-groove1") return KeramikGroove1; if (suffix == "-groove2") return KeramikGroove2; if (suffix == "-1") return 1; if (suffix == "-2") return 2; if (suffix == "-3") return 3; return -1; } int main(int argc, char** argv) { if (argc < 2) return 0; TQValueVector images; cout<<"#include \n\n"; cout<<"#include \"keramikimage.h\"\n\n"; TQMap assignID; int nextID = 0; for (int c = 1; c(strdup(s.latin1())); bool reallySolid = true; int pixCount = 0; int pixSolid = 0; cout<<"static const unsigned char "<(input.bits() ); int size = input.width()*input.height(); for (int pos=0; pos(input.bits() ); for (int pos=0; pos0 || v > 128) { //Non-shadow float fv = v/255.0; fv = pow(fv, gamma); v = int(255.5*fv); if (s<17 && highlights) //A bit of a highligt.. { float effectPortion = (16 - s)/15.0; greyAdd = (int)(v/4.0 * effectPortion*1.2); targetColorAlpha = v - greyAdd; } else { targetColorAlpha = v;//(int)(fv*255); greyAdd = 0; } } else { if (shadows) { targetColorAlpha = 0; greyAdd = v; } else { targetColorAlpha = v;//(int)(fv*255); greyAdd = 0; } } greyAdd+=brightAdj; if (reallySolid) cout< images;\n"; cout<<"};\n\n"; cout<<"KeramikImageDb* KeramikImageDb::instance = 0;\n\n"; cout<<"KeramikEmbedImage* KeramikGetDbImage(int id)\n"; cout<<"{\n"; cout<<"\treturn KeramikImageDb::getInstance()->getImage(id);\n"; cout<<"}\n\n"; cout<<"void KeramikDbCleanup()\n"; cout<<"{\n"; cout<<"\t\tKeramikImageDb::release();\n"; cout<<"}\n"; TQFile file("keramikrc.h"); file.open(IO_WriteOnly); TQTextStream ts( &file); ts<<"#ifndef KERAMIK_RC_H\n"; ts<<"#define KERAMIK_RC_H\n"; ts<<"enum KeramikWidget {\n"; for (TQMap::iterator i = assignID.begin(); i != assignID.end(); ++i) { TQString name = "keramik_"+i.key(); name.replace("-","_"); ts<<"\t"<