Ejemplo n.º 1
0
void GPolygon::setFillColor(string color) {
    fillColor = color;
    if (fillColor != "") {
        fillColor = convertRGBToColor(convertColorToRGB(color));
    }
    pp->setFillColor(this, fillColor);
}
Ejemplo n.º 2
0
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;
        }
    }
}
Ejemplo n.º 3
0
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);
}
Ejemplo n.º 4
0
void GObject::setColor(const std::string& color) {
    setColor(convertColorToRGB(color));
}
Ejemplo n.º 5
0
void GObject::setColor(string color) {
    setColor(convertColorToRGB(color));
}
Ejemplo n.º 6
0
string GObject::getColor() const {
   return convertRGBToColor(convertColorToRGB(color));
}
Ejemplo n.º 7
0
GBufferedImage::GBufferedImage(double x, double y, double width, double height,
                               std::string rgbBackground) {
    init(x, y, width, height, convertColorToRGB(rgbBackground));
}
Ejemplo n.º 8
0
void GBufferedImage::setRGB(double x, double y, std::string rgb) {
    setRGB(x, y, convertColorToRGB(rgb));
}
Ejemplo n.º 9
0
void GBufferedImage::fillRegion(double x, double y, double width, double height, std::string rgb) {
    fillRegion(x, y, width, height, convertColorToRGB(rgb));
}
Ejemplo n.º 10
0
void GBufferedImage::fill(std::string rgb) {
    fill(convertColorToRGB(rgb));
}