/** * @param brush brush info to send */ void SessionState::sendToolSelect(const dpcore::Brush& brush) { host_->sendPacket( protocol::ToolSelect( host_->localuser_, brush.subpixel()?SUBPIXEL:0, brush.blendingMode(), encodeColor(brush.color(1), brush.opacity(1)), encodeColor(brush.color(0), brush.opacity(0)), brush.radius(1), brush.radius(0), qRound(brush.hardness(1)*255), qRound(brush.hardness(0)*255), brush.spacing() ) ); }
uint32_t getPseudocolorClassColor(Layer* pLayer, int32_t id) { PseudocolorLayer* pPseudo = dynamic_cast<PseudocolorLayer*>(pLayer); if (pPseudo == NULL) { setLastError(SIMPLE_BAD_PARAMS); return 0; } ColorType color = pPseudo->getClassColor(id); if (!color.isValid()) { setLastError(SIMPLE_NOT_FOUND); return 0; } setLastError(SIMPLE_NO_ERROR); return encodeColor(color); }
int getRasterLayerColormapValues(Layer* pLayer, uint32_t* pColormap) { RasterLayer* pRaster = dynamic_cast<RasterLayer*>(pLayer); if (pRaster == NULL || pColormap == NULL) { setLastError(SIMPLE_BAD_PARAMS); return 1; } const std::vector<ColorType>& colormap = pRaster->getColorMap().getTable(); if (colormap.size() != 256) { setLastError(SIMPLE_NO_MEM); return 1; } for (size_t idx = 0; idx < colormap.size(); ++idx) { pColormap[idx] = encodeColor(colormap[idx]); } setLastError(SIMPLE_NO_ERROR); return 0; }