本文整理汇总了C++中TRaster32P::getRawData方法的典型用法代码示例。如果您正苦于以下问题:C++ TRaster32P::getRawData方法的具体用法?C++ TRaster32P::getRawData怎么用?C++ TRaster32P::getRawData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TRaster32P
的用法示例。
在下文中一共展示了TRaster32P::getRawData方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: buildLayers
// Copies the cmIn paint and ink colors to the output rasters.
void buildLayers(const TRasterCM32P &cmIn,
const std::vector<TPixel32> &palColors, TRaster32P &inkRaster,
TRaster32P &paintRaster) {
// Separate cmIn by copying the ink & paint colors directly to the layer
// rasters.
TPixelCM32 *cmPix, *cmBegin = (TPixelCM32 *)cmIn->getRawData();
TPixel32 *inkPix = (TPixel32 *)inkRaster->getRawData();
TPixel32 *paintPix = (TPixel32 *)paintRaster->getRawData();
unsigned int i, j, lx = cmIn->getLx(), ly = cmIn->getLy(),
wrap = cmIn->getWrap();
for (i = 0; i < ly; ++i) {
cmPix = cmBegin + i * wrap;
for (j = 0; j < lx; ++j, ++cmPix, ++inkPix, ++paintPix) {
*inkPix = palColors[cmPix->getInk()];
*paintPix = palColors[cmPix->getPaint()];
// Should pure colors be checked...?
}
}
}
示例2: 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);
}
示例3: subCompute
//.........这里部分代码省略.........
//#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
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
checkErrorsByGL
#if !CREATE_GL_CONTEXT_ONE_TIME
TRaster32P rasaux;
if (!wireframe) {
TRaster32P texture(texWidth, texHeight);
texture->clear();
rasaux = texture;
rasaux->lock();
texture->copy(rasIn);
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
glTexImage2D(GL_TEXTURE_2D, 0, 4, texWidth, texHeight, 0, GL_RGBA,
GL_UNSIGNED_BYTE, texture->getRawData());
}
#else
unsigned int texWidth = 1024;
unsigned int texHeight = 1024;
rasaux = rasIn;
rasaux->lock();
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, rasIn->getLx(), rasIn->getLy(),
GL_RGBA, GL_UNSIGNED_BYTE, rasIn->getRawData());
#endif
checkErrorsByGL
glEnable(GL_TEXTURE_2D);
// cfr. help: OpenGL/Programming tip/OpenGL Correctness Tips
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-rasterWidth * 0.5, rasterWidth * 0.5, -rasterHeight * 0.5,
rasterHeight * 0.5, -1, 1);
glViewport(0, 0, rasterWidth, rasterHeight);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glClear(GL_COLOR_BUFFER_BIT);
// do OpenGL draw
double lwTex = (double)(inBBoxLx - 1) / (double)(texWidth - 1);
示例4: sl
void TLevelReader3gp::load(const TRasterP &rasP, int frameIndex, const TPoint &pos, int shrinkX, int shrinkY)
{
TRaster32P ras = rasP;
{
QMutexLocker sl(&m_mutex);
ras->lock();
if (m_IOError != QTNoError)
goto error;
Rect rect;
rect.right = pos.x + ras->getLx();
rect.left = pos.x;
rect.bottom = pos.y + ras->getLy();
rect.top = pos.y;
GWorldPtr offscreenGWorld;
OSErr err;
#if defined TNZ_MACHINE_CHANNEL_ORDER_BGRM
OSType pixelFormat = k32BGRAPixelFormat;
#elif defined TNZ_MACHINE_CHANNEL_ORDER_MRGB
OSType pixelFormat = k32ARGBPixelFormat;
#endif
err = QTNewGWorldFromPtr(
&offscreenGWorld, pixelFormat,
&rect, 0, 0, 0, ras->getRawData(), ras->getWrap() * 4);
if (err != noErr) {
m_IOError = QTUnableToCreateResource;
goto error;
}
SetMovieBox(m_movie, &rect);
err = GetMoviesError();
if (err != noErr) {
m_IOError = QTUnableToSetMovieBox;
#if 0
DisposeGWorld(offscreenGWorld);
#endif
goto error;
}
#if 0
SetMovieGWorld(m_movie, offscreenGWorld, GetGWorldDevice(offscreenGWorld));
#endif
err = GetMoviesError();
if (err != noErr) {
m_IOError = QTUnableToSetMovieGWorld;
#if 0
DisposeGWorld(offscreenGWorld);
#endif
goto error;
}
TimeValue currentTime = currentTimes[frameIndex];
SetMovieTimeValue(m_movie, currentTime);
err = GetMoviesError();
if (err != noErr) {
m_IOError = QTUnableToSetTimeValue;
#if 0
DisposeGWorld(offscreenGWorld);
#endif
goto error;
}
err = UpdateMovie(m_movie);
if (err != noErr) {
m_IOError = QTUnableToUpdateMovie;
#if 0
DisposeGWorld(offscreenGWorld);
#endif
goto error;
}
MoviesTask(m_movie, 0);
err = GetMoviesError();
if (err != noErr) {
m_IOError = QTUnableToDoMovieTask;
#if 0
DisposeGWorld(offscreenGWorld);
#endif
goto error;
}
SetMovieGWorld(m_movie, 0, 0);
#if 0
DisposeGWorld(offscreenGWorld);
#endif
ras->unlock();
}
if (m_depth != 32) {
setMatteAndYMirror(rasP);
} else {
rasP->yMirror();
}
//.........这里部分代码省略.........
示例5: tglDraw
void tglDraw(const TRectD &rect, const TRaster32P &tex, bool blending)
{
CHECK_ERRORS_BY_GL;
glPushAttrib(GL_ALL_ATTRIB_BITS);
if (blending) {
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
unsigned int texWidth = 1;
unsigned int texHeight = 1;
while (texWidth < (unsigned int)tex->getLx())
texWidth = texWidth << 1;
while (texHeight < (unsigned int)tex->getLy())
texHeight = texHeight << 1;
double lwTex = 1.0;
double lhTex = 1.0;
TRaster32P texture;
unsigned int texLx = (unsigned int)tex->getLx();
unsigned int texLy = (unsigned int)tex->getLy();
if (texWidth != texLx ||
texHeight != texLy) {
texture = TRaster32P(texWidth, texHeight);
texture->fill(TPixel32(0, 0, 0, 0));
texture->copy(tex);
lwTex = (texLx) / (double)(texWidth);
lhTex = (texLy) / (double)(texHeight);
if (lwTex > 1.0)
lwTex = 1.0;
if (lhTex > 1.0)
lhTex = 1.0;
} else
texture = tex;
GLenum fmt =
#ifdef TNZ_MACHINE_CHANNEL_ORDER_BGRM
GL_BGRA_EXT;
#elif TNZ_MACHINE_CHANNEL_ORDER_MBGR
GL_ABGR_EXT;
#elif TNZ_MACHINE_CHANNEL_ORDER_RGBM
GL_RGBA;
#elif TNZ_MACHINE_CHANNEL_ORDER_MRGB
GL_BGRA;
#else
// Error PLATFORM NOT SUPPORTED
#error "unknown channel order!"
#endif
// Generate a texture id and bind it.
GLuint texId;
glGenTextures(1, &texId);
glBindTexture(GL_TEXTURE_2D, texId);
glPixelStorei(GL_UNPACK_ROW_LENGTH, texture->getWrap());
texture->lock();
glTexImage2D(GL_TEXTURE_2D,
0,
4,
texWidth,
texHeight,
0,
fmt,
#ifdef TNZ_MACHINE_CHANNEL_ORDER_MRGB
GL_UNSIGNED_INT_8_8_8_8_REV,
#else
GL_UNSIGNED_BYTE,
#endif
texture->getRawData());
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glEnable(GL_TEXTURE_2D);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
double rectLx = rect.getLx();
double rectLy = rect.getLy();
tglColor(TPixel32(0, 0, 0, 0));
glPushMatrix();
glTranslated(rect.x0, rect.y0, 0.0);
glBegin(GL_POLYGON);
glTexCoord2d(0, 0);
tglVertex(TPointD(0.0, 0.0));
glTexCoord2d(lwTex, 0);
//.........这里部分代码省略.........