void FixtureTile6::updateFrame(uint8_t* packets) const { if (_sourceData == NULL) return; int tileX, tileY, startx, endx; uint8_t* pIndex; startx = 0; endx = _fixtureWidth/2-1; tileX = startx; tileY = _fixtureHeight-1; pIndex = packets + newProtocol.getPacketSize() * (_startChannel-1) + newProtocol.getHeaderSize(); int xscale = (int)floor(_videoW/(_fixtureWidth*1.0)); int yscale = (int)floor(_videoH/(_fixtureHeight*1.0)); while(1) { #if ENABLE_LOGGING std::cout << "Writing x: " << tileX << " y: " << tileY << " to address " << (void*)pIndex << "\n"; #endif int xx = _videoX + tileX * xscale; int yy = _videoY + tileY * yscale; if (xx >= 0 && xx < _sourceWidth && yy >= 0 && yy < _sourceHeight) { memcpy(pIndex, _sourceData + (xx + yy * _sourceWidth) * _sourceChannels, 3); } else { memset(pIndex, 0, 3); } pIndex += 3; tileX++; if (tileX > endx) { tileY--; if (tileY < 0) { if (endx == _fixtureWidth - 1) break; startx = endx + 1; endx = _fixtureWidth - 1; tileY = _fixtureHeight - 1; pIndex = packets + newProtocol.getPacketSize() * (_startChannel) + newProtocol.getHeaderSize(); } tileX = startx; } } }
void FixtureTile::updateFrame(uint8_t* packets) const { if (_sourceData == NULL) return; int tileX, tileY; uint8_t* pIndex; tileX = _fixtureWidth-1; tileY = _fixtureHeight/2-1; pIndex = packets + newProtocol.getPacketSize() * (_startChannel-1) + newProtocol.getHeaderSize(); int xscale = (int)floor(_videoW/(_fixtureWidth*1.0)); int yscale = (int)floor(_videoH/(_fixtureHeight*1.0)); while (tileY < _fixtureHeight) { #if ENABLE_LOGGING std::cout << "Writing x: " << tileX << " y: " << tileY << " to address " << (void*)pIndex << "\n"; #endif int scale = 8; memcpy(pIndex, _sourceData + (_videoX + tileX*xscale + (_videoY + tileY*yscale) * _sourceWidth) * _sourceChannels, 3); pIndex+=3; tileX--; if (tileX < 0) { tileX = _fixtureWidth-1; if (tileY == 0) { tileY = _fixtureHeight/2; pIndex = packets + newProtocol.getPacketSize() * (_startChannel) + newProtocol.getHeaderSize(); } else if (tileY < _fixtureHeight/2) { tileY--; } else { tileY++; } } } }
void FixtureRGB::updateFrame(uint8_t* packets) const { memcpy(packets + oldProtocol.getHeaderSize() + _address, _values, 3); }
void FixtureTileDC::updateFrame(uint8_t* packets) const { if (_sourceData == NULL) return; int tileX, tileY; uint8_t* pIndex; int quadrant = 0; tileX = _fixtureWidth/2-1; tileY = 0; pIndex = packets + oldProtocol.getPacketSize() * (_startChannel-1) + oldProtocol.getHeaderSize(); int xscale = (int)floor(_videoW/(_fixtureWidth*1.0)); int yscale = (int)floor(_videoH/(_fixtureHeight*1.0)); int tileYtop = _fixtureHeight/2; int tileXright = -1; while (true) { #if ENABLE_LOGGING std::cout << "Writing x: " << tileX << " y: " << tileY << " to address " << (void*)pIndex << "\n"; #endif int xx, yy; int rotation = getRotation() % 360; if (rotation % 90 != 0) rotation = 0; if (rotation == 0) { xx = _videoX + tileX * xscale; yy = _videoY + (_fixtureHeight - tileY - 1) * yscale; } else if (rotation == 90) { xx = _videoX + (_fixtureHeight - tileY - 1) * yscale; yy = _videoY + tileX * xscale; } else if (rotation == 180) { xx = _videoX + (_fixtureWidth - tileX - 1) * xscale; yy = _videoY + tileY * yscale; } else if (rotation == 270) { xx = _videoX + tileY * yscale; yy = _videoY + (_fixtureWidth - tileX - 1) * xscale; } if (xx >= 0 && xx < _sourceWidth && yy >= 0 && yy < _sourceHeight) { memcpy(pIndex, _sourceData + (xx + yy * _sourceWidth) * _sourceChannels, 3); } else { memset(pIndex, 0, 3); } pIndex += 3; tileY++; if (tileY >= tileYtop) { tileX--; tileY = tileYtop - _fixtureHeight/2; if (tileX <= tileXright) { if (quadrant == 0) { quadrant = 1; tileX = _fixtureWidth/2 - 1; tileY = _fixtureHeight/2; tileYtop = _fixtureHeight; } else if (quadrant == 1) { quadrant = 2; tileX = _fixtureWidth - 1; tileY = _fixtureHeight/2; tileXright = _fixtureWidth/2 - 1; } else if (quadrant == 2) { quadrant = 3; tileX = _fixtureWidth - 1; tileY = 0; tileYtop = _fixtureHeight/2; } else if (quadrant == 3) { break; } } } } }
void FixtureStrip::updateFrame(uint8_t* packets) const { memcpy(packets + oldProtocol.getHeaderSize() + _address, _bytes, _length * 3); }