//============================================================================== static String positionToPairOfValues (const RelativePositionedRectangle& position, const ComponentLayout* layout) { String x, y, w, h; positionToCode (position, layout, x, y, w, h); return castToFloat (x) + ", " + castToFloat (y); }
void JucerFillType::fillInGeneratedCode (GeneratedCode& code, String& paintMethodCode) const { String s; switch (mode) { case solidColour: s << "g.setColour (" << colourToCode (colour) << ");\n"; break; case linearGradient: case radialGradient: { String x1, y1, w, h, x2, y2; positionToCode (gradPos1, code.document->getComponentLayout(), x1, y1, w, h); positionToCode (gradPos2, code.document->getComponentLayout(), x2, y2, w, h); s << "g.setGradientFill (ColourGradient ("; const String indent (String::repeatedString (T(" "), s.length())); s << colourToCode (gradCol1) << ",\n" << indent << castToFloat (x1) << ", " << castToFloat (y1) << ",\n" << indent << colourToCode (gradCol2) << ",\n" << indent << castToFloat (x2) << ", " << castToFloat (y2) << ",\n" << indent << boolToString (mode == radialGradient) << "));\n"; break; } case imageBrush: { const String imageVariable ("cachedImage_" + imageResourceName + "_" + String (code.getUniqueSuffix())); code.addImageResourceLoader (imageVariable, imageResourceName); String x, y, w, h; positionToCode (imageAnchor, code.document->getComponentLayout(), x, y, w, h); s << "g.setTiledImageFill (*"; const String indent (String::repeatedString (T(" "), s.length())); s << imageVariable << ",\n" << indent << x << ", " << y << ",\n" << indent << valueToFloat (imageOpacity) << ");\n"; break; } default: jassertfalse break; } paintMethodCode += s; }