void BlendEffect::save(KXmlWriter &writer) { writer.startElement(BlendEffectId); saveCommonAttributes(writer); switch (m_blendMode) { case Normal: writer.addAttribute("mode", "normal"); break; case Multiply: writer.addAttribute("mode", "multiply"); break; case Screen: writer.addAttribute("mode", "screen"); break; case Darken: writer.addAttribute("mode", "darken"); break; case Lighten: writer.addAttribute("mode", "lighten"); break; } writer.addAttribute("in2", inputs().at(1)); writer.endElement(); }
void CompositeEffect::save(KoXmlWriter &writer) { writer.startElement(CompositeEffectId); saveCommonAttributes(writer); switch (m_operation) { case CompositeOver: writer.addAttribute("operator", "over"); break; case CompositeIn: writer.addAttribute("operator", "in"); break; case CompositeOut: writer.addAttribute("operator", "out"); break; case CompositeAtop: writer.addAttribute("operator", "atop"); break; case CompositeXor: writer.addAttribute("operator", "xor"); break; case Arithmetic: writer.addAttribute("operator", "arithmetic"); writer.addAttribute("k1", QString("%1").arg(m_k[0])); writer.addAttribute("k2", QString("%1").arg(m_k[1])); writer.addAttribute("k3", QString("%1").arg(m_k[2])); writer.addAttribute("k4", QString("%1").arg(m_k[3])); break; } writer.addAttribute("in2", inputs().at(1)); writer.endElement(); }
void ColorMatrixEffect::save(KoXmlWriter &writer) { writer.startElement(ColorMatrixEffectId); saveCommonAttributes(writer); switch (m_type) { case Matrix: { writer.addAttribute("type", "matrix"); QString matrix; for (int r = 0; r < MatrixRows; ++r) { for (int c = 0; c < MatrixCols; ++c) { matrix += QString("%1 ").arg(m_matrix[r*MatrixCols+c]); } } writer.addAttribute("values", matrix); } break; case Saturate: writer.addAttribute("type", "saturate"); writer.addAttribute("values", QString("%1").arg(m_value)); break; case HueRotate: writer.addAttribute("type", "hueRotate"); writer.addAttribute("values", QString("%1").arg(m_value)); break; case LuminanceAlpha: writer.addAttribute("type", "luminanceToAlpha"); break; } writer.endElement(); }
void MergeEffect::save(KXmlWriter &writer) { writer.startElement(MergeEffectId); saveCommonAttributes(writer); foreach(const QString &input, inputs()) { writer.startElement("feMergeNode"); writer.addAttribute("in", input); writer.endElement(); }
void FloodEffect::save(KoXmlWriter &writer) { writer.startElement(FloodEffectId); saveCommonAttributes(writer); writer.addAttribute("flood-color", m_color.name()); if (m_color.alpha() < 255) writer.addAttribute("flood-opacity", QString("%1").arg(m_color.alphaF())); writer.endElement(); }
void BlurEffect::save(KoXmlWriter &writer) { writer.startElement(BlurEffectId); saveCommonAttributes(writer); if (m_deviation.x() != m_deviation.y()) { writer.addAttribute("stdDeviation", QString("%1, %2").arg(m_deviation.x()).arg(m_deviation.y())); } else { writer.addAttribute("stdDeviation", m_deviation.x()); } writer.endElement(); }
void ImageEffect::save(KoXmlWriter &writer) { writer.startElement(ImageEffectId); saveCommonAttributes(writer); QByteArray ba; QBuffer buffer(&ba); buffer.open(QIODevice::WriteOnly); if (m_image.save(&buffer, "PNG")) { QMimeDatabase db; const QString mimeType(db.mimeTypeForData(ba).name()); writer.addAttribute("xlink:href", "data:" + mimeType + ";base64," + ba.toBase64()); } writer.endElement(); }
void MorphologyEffect::save(KoXmlWriter &writer) { writer.startElement(MorphologyEffectId); saveCommonAttributes(writer); if (m_operator != Erode ) writer.addAttribute("operator", "dilate"); if (!m_radius.isNull()) { if (m_radius.x() == m_radius.y()) { writer.addAttribute("radius", QString("%1").arg(m_radius.x())); } else { writer.addAttribute("radius", QString("%1 %2").arg(m_radius.x()).arg(m_radius.y())); } } writer.endElement(); }