void GPolygon::setFillColor(string color) { fillColor = color; if (fillColor != "") { fillColor = convertRGBToColor(convertColorToRGB(color)); } pp->setFillColor(this, fillColor); }
void GBufferedImage::load(const std::string& filename) { // for efficiency, let's at least check whether the file exists // and throw error immediately rather than contacting the back-end if (!fileExists(filename)) { error("GBufferedImage::load: file not found: " + filename); } std::string result = pp->gbufferedimage_load(this, filename); result = Base64::decode(result); std::istringstream input(result); std::string line; if (!getline(input, line)) { error("GBufferedImage::load: image data does not contain valid width"); } m_width = stringToInteger(line); if (!getline(input, line)) { error("GBufferedImage::load: image data does not contain valid height"); } m_height = stringToInteger(line); for (int y = 0; y < m_height; y++) { for (int x = 0; x < m_width; x++) { if (!getline(input, line)) { error("GBufferedImage::load: image data does not contain valid pixel (x=" + integerToString(x) + ", y=" + integerToString(y) + ")"); } int px = convertColorToRGB(line); m_pixels[y][x] = px; } } }
void GArc::setFillColor(const std::string& color) { fillColor = color; if (fillColor == "") { if (isFilled()) { setFilled(false); } } else { fillColor = convertRGBToColor(convertColorToRGB(color)); if (!isFilled()) { setFilled(true); } } stanfordcpplib::getPlatform()->gobject_setFillColor(this, fillColor); }
void GObject::setColor(const std::string& color) { setColor(convertColorToRGB(color)); }
void GObject::setColor(string color) { setColor(convertColorToRGB(color)); }
string GObject::getColor() const { return convertRGBToColor(convertColorToRGB(color)); }
GBufferedImage::GBufferedImage(double x, double y, double width, double height, std::string rgbBackground) { init(x, y, width, height, convertColorToRGB(rgbBackground)); }
void GBufferedImage::setRGB(double x, double y, std::string rgb) { setRGB(x, y, convertColorToRGB(rgb)); }
void GBufferedImage::fillRegion(double x, double y, double width, double height, std::string rgb) { fillRegion(x, y, width, height, convertColorToRGB(rgb)); }
void GBufferedImage::fill(std::string rgb) { fill(convertColorToRGB(rgb)); }