void AvatarCreator::AddDesignToFavorites() { //Construct the url in the form avy://Base.HeadId.HeadHex.BodyId.BodyHex.HairId.HairHex AvatarProperties props; props.url = "avy://"; props.url += mBase + "."; string s; s = mHeadFile.substr(0, mHeadFile.length() - 4); //get rid of .png s.erase(0, s.find_last_of(".")+1); //erase everything before the id props.url += s + "." + colorToHex(mHeadColor) + "."; s = mBodyFile.substr(0, mBodyFile.length() - 4); //get rid of .png s.erase(0, s.find_last_of(".")+1); //erase everything before the id props.url += s + "." + colorToHex(mBodyColor) + "."; s = mHairFile.substr(0, mHairFile.length() - 4); //get rid of .png s.erase(0, s.find_last_of(".")+1); //erase everything before the id props.url += s + "." + colorToHex(mHairColor); props.w = mCompositePreview->Width(); props.h = mCompositePreview->Height(); props.delay = 1000; props.flags = 0; props.pass = ""; avatarFavorites->UpdateAvatar(avatarFavorites->mWorkingFolder, mWorkingIndex, props); Die(); }
void copyColor(color *in, color *out) { out->r = in->r; out->g = in->g; out->b = in->b; out->hex = colorToHex(*in); }
void scaleColor(color colorIn[], color colorOut[], int numColors, int depth, float power) { for (int z = 0; z < depth ; z++) { double calc = pow((z/(depth*1.0)), power) * numColors; colorOut[z].r = colorIn[(int)calc].r; colorOut[z].g = colorIn[(int)calc].g; colorOut[z].b = colorIn[(int)calc].b; colorOut[z].hex = colorToHex(colorOut[z]); //printf("%d, %F, %d, %d, %02X%02X%02X\n", z, calc, numColors, (int)calc, colorOut[z].r, colorOut[z].g, colorOut[z].b); } }
void Node::dump(FILE * f, int width, int height) { char const * fillColor; char const * textColor; colorToHex(color_, fillColor, textColor); fprintf(f, "N%08x [style=filled; fillcolor=\"%s\"; fontcolor=\"%s\"; label=\"%d, %d\"; pos=\"%f,%f\" ];\n", this, fillColor, textColor, x_, y_, x_*0.5f, (height - 1 - y_)*0.5f); for (NodeList::iterator i = adjacentNodes_.begin(); i != adjacentNodes_.end(); ++i) { std::shared_ptr<Node> const & node = *i; if (id() <= node->id()) { fprintf(f, "N%08x -- N%08x; ", this, node.get()); } } fprintf(f, "\n"); }
std::string utils::colorToHex(const Color& color) { return colorToHex(color.getIntR(), color.getIntG(), color.getIntB()); }