本文整理汇总了C++中TRaster32P::getLx方法的典型用法代码示例。如果您正苦于以下问题:C++ TRaster32P::getLx方法的具体用法?C++ TRaster32P::getLx怎么用?C++ TRaster32P::getLx使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TRaster32P
的用法示例。
在下文中一共展示了TRaster32P::getLx方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rectFill
void FullColorAreaFiller::rectFill(const TRect &rect,
const FillParameters ¶ms,
bool onlyUnfilled) {
TRect bbox = m_ras->getBounds();
TRect r = rect * bbox;
if (r.isEmpty()) return;
TRaster32P workRas = m_ras->extract(r);
TRaster32P copy = workRas->clone();
TPixel32 color = params.m_palette->getStyle(params.m_styleId)->getMainColor();
// Fillo tutto il quadaratino con color
int x, y;
for (y = 0; y < workRas->getLy(); y++) {
TPixel32 *line = workRas->pixels(y);
for (x = 0; x < workRas->getLx(); x++)
*(line + x) = overPix(color, workRas->pixels(y)[x]);
}
FillParameters paramsApp = params;
TPixel32 refColor;
for (y = 0; y < workRas->getLy(); y++) {
paramsApp.m_p = TPoint(0, y);
if (y == 0 ||
refColor != workRas->pixels(paramsApp.m_p.y)[paramsApp.m_p.x]) {
fill(workRas, copy, paramsApp);
refColor = workRas->pixels(paramsApp.m_p.y)[paramsApp.m_p.x];
}
}
for (y = 0; y < workRas->getLy(); y++) {
paramsApp.m_p = TPoint(workRas->getLx() - 1, y);
if (y == 0 ||
refColor != workRas->pixels(paramsApp.m_p.y)[paramsApp.m_p.x]) {
fill(workRas, copy, paramsApp);
refColor = workRas->pixels(paramsApp.m_p.y)[paramsApp.m_p.x];
}
}
for (x = 0; x < workRas->getLx(); x++) {
paramsApp.m_p = TPoint(x, 0);
if (x == 0 ||
refColor != workRas->pixels(paramsApp.m_p.y)[paramsApp.m_p.x]) {
fill(workRas, copy, paramsApp);
refColor = workRas->pixels(paramsApp.m_p.y)[paramsApp.m_p.x];
}
}
for (x = 0; x < workRas->getLx(); x++) {
paramsApp.m_p = TPoint(x, workRas->getLy() - 1);
if (x == 0 ||
refColor != workRas->pixels(paramsApp.m_p.y)[paramsApp.m_p.x]) {
fill(workRas, copy, paramsApp);
refColor = workRas->pixels(paramsApp.m_p.y)[paramsApp.m_p.x];
}
}
}
示例2: clearMatte_border
static void clearMatte_border(const TRaster32P &ras, int border0, int border1)
{
assert(border0 < border1);
// Horizontal
clearMatte(ras, border0, border0, ras->getLx() - border0, border1);
clearMatte(ras, border0, ras->getLy() - border1, ras->getLx() - border0, ras->getLy() - border0);
// Vertical
clearMatte(ras, border0, border1, border1, ras->getLy() - border1);
clearMatte(ras, ras->getLx() - border1, border1, ras->getLx() - border0, ras->getLy() - border1);
}
示例3: setMatteAndYMirror
//------------------------------------------------
inline void setMatteAndYMirror(const TRaster32P &ras)
{
ras->lock();
TPixel32 *upRow = ras->pixels();
TPixel32 *dwRow = ras->pixels(ras->getLy() - 1);
int hLy = (int)(ras->getLy() / 2. + 0.5); //piccola pessimizzazione...
int wrap = ras->getWrap();
int lx = ras->getLx();
TPixel32 *upPix = 0;
TPixel32 *lastPix = ras->pixels(hLy);
while (upPix < lastPix) {
upPix = upRow;
TPixel32 *dwPix = dwRow;
TPixel32 *endPix = upPix + lx;
while (upPix < endPix) {
TPixel32 tmpPix(upPix->r, upPix->g, upPix->b, 0xff);
*upPix = *dwPix;
upPix->m = 0xff;
*dwPix = tmpPix;
++upPix;
++dwPix;
}
upRow += wrap;
dwRow -= wrap;
}
ras->unlock();
}
示例4: scale
void MeshTexturizer::Imp::allocateTextures(int groupIdx, const TRaster32P &ras, const TRaster32P &aux,
int x, int y, int textureLx, int textureLy,
bool premultiplied)
{
TextureData *data = m_textureDatas[groupIdx].get();
// Test the specified texture allocation
if (testTextureAlloc(textureLx, textureLy)) {
TPointD scale(data->m_geom.getLx() / (double)ras->getLx(),
data->m_geom.getLy() / (double)ras->getLy());
TRectD tileGeom(
TRectD(
scale.x * (x - TOTAL_BORDER), scale.y * (y - TOTAL_BORDER),
scale.x * (x + textureLx + TOTAL_BORDER), scale.y * (y + textureLy + TOTAL_BORDER)) +
data->m_geom.getP00());
GLuint texId = textureAlloc(ras, aux, x, y, textureLx, textureLy, premultiplied);
TextureData::TileData td = {texId, tileGeom};
data->m_tileDatas.push_back(td);
return;
}
if (textureLx <= 1 && textureLy <= 1)
return; // No texture can be allocated
// The texture could not be allocated. Then, bisecate and branch.
if (textureLx > textureLy) {
int textureLx_2 = textureLx >> 1;
allocateTextures(groupIdx, ras, aux, x, y, textureLx_2, textureLy, premultiplied);
allocateTextures(groupIdx, ras, aux, x + textureLx_2, y, textureLx_2, textureLy, premultiplied);
} else {
示例5: computeCentroid
TPoint computeCentroid(const TRaster32P &r) {
TPoint ret(1, 1);
TRasterGR8P raux(r->getLx() + 2, r->getLy() + 2);
if (fillByteRaster(r, raux)) doComputeCentroid(raux, ret);
ret.x--;
ret.y--; /* per il bordo aggiunto */
return ret;
}
示例6:
static void addBackground32(TRaster32P ras, const TPixel32 &col)
{
ras->lock();
int nrows = ras->getLy();
while (nrows-- > 0) {
TPixel32 *pix = ras->pixels(nrows);
TPixel32 *endPix = pix + ras->getLx();
while (pix < endPix) {
*pix = overPix(col, *pix);
pix++;
}
}
ras->unlock();
}
示例7: swapRBChannels
void TRop::swapRBChannels(const TRaster32P &r) {
int lx = r->getLx();
int y = r->getLy();
r->lock();
while (--y >= 0) {
TPixel32 *pix = r->pixels(y);
TPixel32 *endPix = pix + lx;
while (pix < endPix) {
tswap(pix->r, pix->b);
++pix;
}
}
r->unlock();
}
示例8: do_over
void do_over(TRaster32P rout, const TRasterGR8P &rup, const TPixel32 &color)
{
assert(rout->getSize() == rup->getSize());
for (int y = rout->getLy(); --y >= 0;) {
TPixel32 *out_pix = rout->pixels(y);
TPixel32 *const out_end = out_pix + rout->getLx();
const TPixelGR8 *up_pix = rup->pixels(y);
for (; out_pix < out_end; ++out_pix, ++up_pix) {
double v = up_pix->value / 255.0;
TPixel32 up(troundp(v * color.r), troundp(v * color.g), troundp(v * color.b), troundp(v * color.m));
*out_pix = overPix(*out_pix, up);
}
}
}
示例9: my_do_over
//Usata tinylinetest
static void my_do_over(TRaster32P rout, const TRasterGR8P &rup)
{
assert(rout->getSize() == rup->getSize());
for (int y = rout->getLy(); --y >= 0;) {
TPixel32 *out_pix = rout->pixels(y);
TPixel32 *const out_end = out_pix + rout->getLx();
const TPixelGR8 *up_pix = rup->pixels(y);
for (; out_pix < out_end; ++out_pix, ++up_pix) {
int v = up_pix->value;
out_pix->r = out_pix->r * v / 255;
out_pix->g = out_pix->r;
out_pix->b = out_pix->r;
}
}
}
示例10: write
void Writer::write(const TRaster32P &ras, Processor *processor)
{
m_context->makeCurrent();
glClear(GL_COLOR_BUFFER_BIT);
if (ras) {
glRasterPos2d(0, 0);
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); // ras->getWrap());
glDrawPixels(ras->getLx(), ras->getLy(), TGL_FMT, TGL_TYPE, ras->getRawData());
}
if (processor) {
processor->draw();
}
glRasterPos2d(0, 0);
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); // ras->getWrap());
glReadPixels(0, 0, m_raster->getLx(), m_raster->getLy(), TGL_FMT, TGL_TYPE, m_raster->getRawData());
TImageP img = TRasterImageP(m_raster);
m_levelWriter->getFrameWriter(++m_frameCount)->save(img);
}
示例11: process
void DummyProcessor::process(TRaster32P raster)
{
if (isActive()) {
int x, y, lx = raster->getLx(), ly = raster->getLy();
m_dummyData.clear();
m_dummyData.resize(ly, 0);
std::vector<int> hues(lx);
for (y = 0; y < ly; y++) {
TPixel32 *pix = raster->pixels(y);
for (x = 0; x < lx; x++) {
int hsv[3];
rgb2hsv(hsv, *pix);
hues[x] = hsv[0];
pix++;
}
std::pair<int, int> range;
for (x = 0; x + 1 < lx; x++)
if (abs(hues[x] - hues[x + 1]) > 5)
break;
m_dummyData[y] = x;
}
}
}
示例12:
void Convert2Tlv::buildInksForNAAImage(TRasterCM32P &rout, const TRaster32P &rin)
{
std::map<TPixel, int>::iterator it;
TPixel curColor = TPixel::Transparent;
int i, j;
int curIndex;
//prima passata: identifico i colori di inchiostro e metto in rout i pixel di inchiostro puro
for (i = 0; i < rin->getLy(); i++) {
TPixel *pixin = rin->pixels(i);
TPixelCM32 *pixout = rout->pixels(i);
for (j = 0; j < rin->getLx(); j++, pixin++, pixout++) {
TPixel colorIn;
/*- treat white/transparent pixels as transparent -*/
if (*pixin == TPixel(255, 255, 255) || *pixin == TPixel::Transparent) {
*pixout = TPixelCM32(0, 0, 255);
continue;
}
if (curColor != *pixin) {
curColor = *pixin;
if ((it = m_colorMap.find(curColor)) == m_colorMap.end()) {
if (m_lastIndex < 4095)
m_colorMap[curColor] = ++m_lastIndex;
curIndex = m_lastIndex;
} else
curIndex = it->second;
}
*pixout = TPixelCM32(curIndex, 0, 0);
}
}
if (m_colorMap.empty())
m_colorMap[TPixel::Black] = ++m_lastIndex;
}
示例13: copyAndSwapRBChannels
TRaster32P TRop::copyAndSwapRBChannels(const TRaster32P &srcRaster) {
TRaster32P newRaster(srcRaster->getSize());
int lx = srcRaster->getLx();
int y = srcRaster->getLy();
srcRaster->lock();
newRaster->lock();
while (--y >= 0) {
TPixel32 *pix = srcRaster->pixels(y);
TPixel32 *newpix = newRaster->pixels(y);
TPixel32 *endPix = pix + lx;
while (pix < endPix) {
newpix->r = pix->b;
newpix->g = pix->g;
newpix->b = pix->r;
newpix->m = pix->m;
++pix;
++newpix;
}
}
srcRaster->unlock();
newRaster->unlock();
return newRaster;
}
示例14: makeDataRaster
void OutlineVectorizer::makeDataRaster(const TRasterP &src)
{
m_vimage = new TVectorImage();
if (!src)
return;
m_src = src;
clearNodes();
clearJunctions();
int x, y, ii = 0;
TRaster32P srcRGBM = (TRaster32P)m_src;
TRasterCM32P srcCM = (TRasterCM32P)m_src;
TRasterGR8P srcGR = (TRasterGR8P)m_src;
// Inizializzo DataRasterP per i casi in cui si ha un TRaster32P, un TRasterGR8P o un TRasterCM32P molto grande
DataRasterP dataRaster(m_src->getSize().lx + 2, m_src->getSize().ly + 2);
if (srcRGBM || srcGR || (srcCM && srcCM->getLx() * srcCM->getLy() > 5000000)) {
int ly = dataRaster->getLy();
int lx = dataRaster->getLx();
int wrap = dataRaster->getWrap();
DataPixel *dataPix0 = dataRaster->pixels(0);
DataPixel *dataPix1 = dataRaster->pixels(0) + m_src->getLx() + 1;
for (y = 0; y < ly; y++, dataPix0 += wrap, dataPix1 += wrap) {
dataPix0->m_pos.x = 0;
dataPix1->m_pos.x = lx - 1;
dataPix0->m_pos.y = dataPix1->m_pos.y = y;
dataPix0->m_value = dataPix1->m_value = 0;
dataPix0->m_ink = dataPix1->m_ink = false;
dataPix0->m_node = dataPix1->m_node = 0;
}
dataPix0 = dataRaster->pixels(0);
dataPix1 = dataRaster->pixels(ly - 1);
for (x = 0; x < lx; x++, dataPix0++, dataPix1++) {
dataPix0->m_pos.x = dataPix1->m_pos.x = x;
dataPix0->m_pos.y = 0;
dataPix1->m_pos.y = ly - 1;
dataPix0->m_value = dataPix1->m_value = 0;
dataPix0->m_ink = dataPix1->m_ink = false;
dataPix0->m_node = dataPix1->m_node = 0;
}
}
if (srcRGBM) {
assert(m_palette);
int inkId = m_palette->getClosestStyle(m_configuration.m_inkColor);
if (!inkId || m_configuration.m_inkColor != m_palette->getStyle(inkId)->getMainColor()) {
inkId = m_palette->getStyleCount();
m_palette->getStylePage(1)->insertStyle(1, m_configuration.m_inkColor);
m_palette->setStyle(inkId, m_configuration.m_inkColor);
}
assert(inkId);
m_dataRasterArray.push_back(std::pair<int, DataRasterP>(inkId, dataRaster));
int maxDistance2 = m_configuration.m_threshold * m_configuration.m_threshold;
for (y = 0; y < m_src->getLy(); y++) {
TPixel32 *inPix = srcRGBM->pixels(y);
TPixel32 *inEndPix = inPix + srcRGBM->getLx();
DataPixel *dataPix = dataRaster->pixels(y + 1) + 1;
x = 0;
while (inPix < inEndPix) {
*dataPix = DataPixel();
int distance2 = colorDistance2(m_configuration.m_inkColor, *inPix);
if (y == 0 || y == m_src->getLy() - 1 || x == 0 || x == m_src->getLx() - 1 || inPix->m == 0) {
dataPix->m_value = 255;
dataPix->m_ink = false;
} else {
dataPix->m_value = (inPix->r + 2 * inPix->g + inPix->b) >> 2;
dataPix->m_ink = (distance2 < maxDistance2);
}
dataPix->m_pos.x = x++;
dataPix->m_pos.y = y;
dataPix->m_node = 0;
inPix++;
dataPix++;
}
}
} else if (srcGR) {
示例15: subCompute
void subCompute(TRasterFxPort &m_input, TTile &tile, double frame,
const TRenderSettings &ri, TPointD p00, TPointD p01,
TPointD p11, TPointD p10, int details, bool wireframe,
TDimension m_offScreenSize, bool isCast) {
TPixel32 bgColor;
TRectD outBBox, inBBox;
outBBox = inBBox = TRectD(tile.m_pos, TDimensionD(tile.getRaster()->getLx(),
tile.getRaster()->getLy()));
m_input->getBBox(frame, inBBox, ri);
if (inBBox == TConsts::infiniteRectD) // e' uno zerario
inBBox = outBBox;
int inBBoxLx = (int)inBBox.getLx() / ri.m_shrinkX;
int inBBoxLy = (int)inBBox.getLy() / ri.m_shrinkY;
if (inBBox.isEmpty()) return;
if (p00 == p01 && p00 == p10 && p00 == p11 &&
!isCast) // significa che non c'e' deformazione
{
m_input->compute(tile, frame, ri);
return;
}
TRaster32P rasIn;
TPointD rasInPos;
if (!wireframe) {
if (ri.m_bpp == 64 || ri.m_bpp == 48) {
TRaster64P aux = TRaster64P(inBBoxLx, inBBoxLy);
rasInPos = TPointD(inBBox.x0 / ri.m_shrinkX, inBBox.y0 / ri.m_shrinkY);
TTile tmp(aux, rasInPos);
m_input->compute(tmp, frame, ri);
rasIn = TRaster32P(inBBoxLx, inBBoxLy);
TRop::convert(rasIn, aux);
} else {
rasInPos = TPointD(inBBox.x0 / ri.m_shrinkX, inBBox.y0 / ri.m_shrinkY);
TTile tmp(TRaster32P(inBBoxLx, inBBoxLy), rasInPos);
m_input->allocateAndCompute(tmp, rasInPos, TDimension(inBBoxLx, inBBoxLy),
TRaster32P(), frame, ri);
rasIn = tmp.getRaster();
}
}
unsigned int texWidth = 2;
unsigned int texHeight = 2;
while (texWidth < (unsigned int)inBBoxLx) texWidth = texWidth << 1;
while (texHeight < (unsigned int)inBBoxLy) texHeight = texHeight << 1;
while (texWidth > 1024 || texHeight > 1024) // avevo usato la costante
// GL_MAX_TEXTURE_SIZE invece di
// 1024, ma non funzionava!
{
inBBoxLx = inBBoxLx >> 1;
inBBoxLy = inBBoxLy >> 1;
texWidth = texWidth >> 1;
texHeight = texHeight >> 1;
}
if (rasIn->getLx() != inBBoxLx || rasIn->getLy() != inBBoxLy) {
TRaster32P rasOut = TRaster32P(inBBoxLx, inBBoxLy);
TRop::resample(rasOut, rasIn,
TScale((double)rasOut->getLx() / rasIn->getLx(),
(double)rasOut->getLy() / rasIn->getLy()));
rasIn = rasOut;
}
int rasterWidth = tile.getRaster()->getLx() + 2;
int rasterHeight = tile.getRaster()->getLy() + 2;
assert(rasterWidth > 0);
assert(rasterHeight > 0);
TRectD clippingRect =
TRectD(tile.m_pos,
TDimensionD(tile.getRaster()->getLx(), tile.getRaster()->getLy()));
#if CREATE_GL_CONTEXT_ONE_TIME
int ret = wglMakeCurrent(m_offScreenGL.m_offDC, m_offScreenGL.m_hglRC);
assert(ret == TRUE);
#else
TOfflineGL offScreenRendering(TDimension(rasterWidth, rasterHeight));
//#ifdef _WIN32
offScreenRendering.makeCurrent();
//#else
//#if defined(LINUX) || defined(MACOSX)
// offScreenRendering.m_offlineGL->makeCurrent();
//#endif
#endif
checkErrorsByGL
// disabilito quello che non mi serve per le texture
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
glDisable(GL_DITHER);
glDisable(GL_DEPTH_TEST);
glCullFace(GL_FRONT);
glDisable(GL_STENCIL_TEST);
glDisable(GL_LOGIC_OP);
// creo la texture in base all'immagine originale
//.........这里部分代码省略.........