本文整理汇总了C++中TRaster32P::getLy方法的典型用法代码示例。如果您正苦于以下问题:C++ TRaster32P::getLy方法的具体用法?C++ TRaster32P::getLy怎么用?C++ TRaster32P::getLy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TRaster32P
的用法示例。
在下文中一共展示了TRaster32P::getLy方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}
示例2: 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];
}
}
}
示例3: 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);
}
示例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: updateRaster
void SwatchViewer::updateRaster()
{
QMutexLocker sl(&m_mutex);
if (!m_enabled)
return;
if (!m_raster)
return;
if (m_bgPainter)
m_bgPainter->paint(m_raster);
else
m_raster->fill(TPixel32(127, 127, 127));
if (m_cameraMode && !m_cameraRect.isEmpty()) {
TPointD p0(m_cameraRect.x0, m_cameraRect.y0);
TPointD p1(m_cameraRect.x1, m_cameraRect.y1);
TPointD center(width() * 0.5, height() * 0.5);
TPoint transP0 = convert(m_aff * p0 + center);
TPoint transP1 = convert(m_aff * p1 + center);
TPoint p = convert((TPointD(transP1.x, transP1.y) - TPointD(transP0.x, transP0.y)) * 0.5);
TRect rect(transP0 - p, transP1 - p);
m_content->fillOutside(rect, TPixel32(255, 0, 0, 255));
m_content->fillOutside(rect.enlarge(TDimension(1, 1)), TPixel32(0, 0, 0, 0));
}
if (m_content)
TRop::over(m_raster, m_content);
int i;
for (i = 0; i < (int)m_points.size(); i++) {
if (m_points[i].m_pairFlag)
continue;
TPoint p = world2win(m_points[i].m_param->getValue(m_frame));
TRop::over(m_raster, m_crossIcon, p - TPoint(4, 4));
}
for (i = 0; i < (int)m_pointPairs.size(); i++) {
int i0 = m_pointPairs[i].first;
int i1 = m_pointPairs[i].second;
assert(i0 != i1);
assert(0 <= i0 && i0 < (int)m_points.size());
assert(0 <= i1 && i1 < (int)m_points.size());
TPoint p0 = world2win(m_points[i0].m_param->getValue(m_frame));
TPoint p1 = world2win(m_points[i1].m_param->getValue(m_frame));
TPoint delta = p1 - p0;
int len = tround(sqrt((double)(delta * delta)));
double phi = 0;
if (len > 0)
phi = 180 * atan2((double)delta.y, (double)delta.x) / TConsts::pi;
if (len > 500) {
// puo' succedere per zoom molto grandi.
// dovrei fare qualcosa, ma non so bene che cosa e non credo sia
// importantissimo
} else {
TRaster32P arrowShape = createArrowShape(len);
TAffine aff = TRotation(phi).place(0, arrowShape->getLy() / 2, p0.x, p0.y);
TRop::over(m_raster, arrowShape, aff);
// verrebbe la tentazione di usare il filtro TRop::Bilinear (piu'veloce),
// ma la qualita' ne risente molto
}
}
update();
}
示例15: brush
void TRop::brush(
TRaster32P ras,
const TPoint &aa,
const TPoint &bb,
int radius,
const TPixel32 &col)
{
TPoint a = aa;
TPoint b = bb;
if (a.y > b.y)
tswap(a, b); // a e' piu' in basso di b
int lx = ras->getLx();
int ly = ras->getLy();
ras->lock();
// ----- radius = 0
if (radius == 0) {
// k = +1/-1 se il rettangolo e' inclinato positivamente (0<=m)/negativamente (m<0)
// (se k<0 viene fatta una riflessione sulle ascisse prima di tornare alle
// coordinate "di schermo")
int k = 1;
int dy = b.y - a.y;
int dx = b.x - a.x;
if (dx < 0) {
dx = -dx;
k = -1;
}
assert(dx >= 0);
assert(dy >= 0);
double m; // m sara' definita solo per dx!=0)
if (dx > 0) {
m = dy / (double)dx;
}
//double length = sqrt(dx*dx + dy*dy);
const int alpha = dy, beta = -dx;
const int incE = alpha;
const int incNE = alpha + beta;
const int incN = beta;
// N.B. le coordinate sono relative ad un sist. di rif. con l'origine in a
// l'eq. della retta e' alpha * x + beta * y = 0
int yMin = tmax(a.y, 0) - a.y; // clipping y + cambio riferimento
int yMax = tmin(b.y, ly - 1) - a.y; // (trasporto dell'origine in a)
if (dx > 0 && m <= 1) {
// midpoint algorithm
TPoint segm;
if (dy == 0) // segmento orizzontale: inizializza segm
{
segm.x = 0;
segm.y = yMin;
} else // 0<m<=1 : inizializza segm
{
segm.x = tceil((yMin - 0.5) / m);
segm.y = yMin;
}
int dSegm = tfloor(alpha * (segm.x + 1) + beta * (segm.y + 0.5));
while (segm.y <= yMax) {
int count = 0; // i trati orizzontali di segm vengono disegnati in "blocco"
while (dSegm < 0 && segm.x <= dx) // Est: segm.x<=dx evita il ciclo
{ // infinito quando m=0 (incE=0)
dSegm = dSegm + incE;
segm.x++;
count++;
}
// NordEst
int xMin, xMax;
if (k > 0) {
xMin = tmax(a.x + segm.x - count, a.x, 0); // clipping x + ritorno alle
xMax = tmin(a.x + segm.x, b.x, lx - 1); // coordinate "di schermo"
} else {
xMin = tmax(a.x - segm.x, a.x - dx, 0); // clipping x + riflessione + ritorno
xMax = tmin(a.x - segm.x + count, a.x, lx - 1); // alle coordinate "di schermo"
}
TPixel32 *p = ras->pixels(segm.y + a.y) + xMin;
TPixel32 *q = p + (xMax - xMin);
while (p <= q)
*p++ = col;
dSegm = dSegm + incNE;
segm.x++;
segm.y++;
}
} else // m>1 oppure segmento verticale
{
// midpoint algorithm
TPoint segm;
if (dx == 0) // segmento verticale: inizializza segm
{
segm.x = 0;
segm.y = yMin;
} else // m>1 : inizializza segm
//.........这里部分代码省略.........