这篇教程C++ GetPitch函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GetPitch函数的典型用法代码示例。如果您正苦于以下问题:C++ GetPitch函数的具体用法?C++ GetPitch怎么用?C++ GetPitch使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GetPitch函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: GetPitchvoid CBaseTexture::ClampToEdge(){ unsigned int imagePitch = GetPitch(m_imageWidth); unsigned int imageRows = GetRows(m_imageHeight); unsigned int texturePitch = GetPitch(m_textureWidth); unsigned int textureRows = GetRows(m_textureHeight); if (imagePitch < texturePitch) { unsigned int blockSize = GetBlockSize(); unsigned char *src = m_pixels + imagePitch - blockSize; unsigned char *dst = m_pixels; for (unsigned int y = 0; y < imageRows; y++) { for (unsigned int x = imagePitch; x < texturePitch; x += blockSize) memcpy(dst + x, src, blockSize); dst += texturePitch; } } if (imageRows < textureRows) { unsigned char *dst = m_pixels + imageRows * texturePitch; for (unsigned int y = imageRows; y < textureRows; y++) { memcpy(dst, dst - texturePitch, texturePitch); dst += texturePitch; } }}
开发者ID:AWilco,项目名称:xbmc,代码行数:29,
示例2: whilevoid CBaseTexture::Allocate(unsigned int width, unsigned int height, unsigned int format){ m_imageWidth = width; m_imageHeight = height; m_format = format; m_orientation = 0; m_textureWidth = m_imageWidth; m_textureHeight = m_imageHeight; if (m_format & XB_FMT_DXT_MASK) while (GetPitch() < g_Windowing.GetMinDXTPitch()) m_textureWidth += GetBlockSize(); if (!g_Windowing.SupportsNPOT((m_format & XB_FMT_DXT_MASK) != 0)) { m_textureWidth = PadPow2(m_textureWidth); m_textureHeight = PadPow2(m_textureHeight); } if (m_format & XB_FMT_DXT_MASK) { // DXT textures must be a multiple of 4 in width and height m_textureWidth = ((m_textureWidth + 3) / 4) * 4; m_textureHeight = ((m_textureHeight + 3) / 4) * 4; } // check for max texture size #define CLAMP(x, y) { if (x > y) x = y; } CLAMP(m_textureWidth, g_Windowing.GetMaxTextureSize()); CLAMP(m_textureHeight, g_Windowing.GetMaxTextureSize()); CLAMP(m_imageWidth, m_textureWidth); CLAMP(m_imageHeight, m_textureHeight); delete[] m_pixels; m_pixels = new unsigned char[GetPitch() * GetRows()];}
开发者ID:AWilco,项目名称:xbmc,代码行数:35,
示例3: Allocatevoid CBaseTexture::Update(unsigned int width, unsigned int height, unsigned int pitch, unsigned int format, const unsigned char *pixels, bool loadToGPU){ if (pixels == NULL) return; if (format & XB_FMT_DXT_MASK) return; Allocate(width, height, format); unsigned int srcPitch = pitch ? pitch : GetPitch(width); unsigned int srcRows = GetRows(height); unsigned int dstPitch = GetPitch(m_textureWidth); unsigned int dstRows = GetRows(m_textureHeight); if (srcPitch == dstPitch) memcpy(m_pixels, pixels, srcPitch * std::min(srcRows, dstRows)); else { const unsigned char *src = pixels; unsigned char* dst = m_pixels; for (unsigned int y = 0; y < srcRows && y < dstRows; y++) { memcpy(dst, src, std::min(srcPitch, dstPitch)); src += srcPitch; dst += dstPitch; } } ClampToEdge(); if (loadToGPU) LoadToGPU();}
开发者ID:69thelememt,项目名称:xbmc,代码行数:33,
示例4: whilevoid CBaseTexture::Allocate(unsigned int width, unsigned int height, unsigned int format){ m_imageWidth = m_originalWidth = width; m_imageHeight = m_originalHeight = height; m_format = format; m_orientation = 0; m_textureWidth = m_imageWidth; m_textureHeight = m_imageHeight; if (m_format & XB_FMT_DXT_MASK) while (GetPitch() < CServiceBroker::GetRenderSystem().GetMinDXTPitch()) m_textureWidth += GetBlockSize(); if (!CServiceBroker::GetRenderSystem().SupportsNPOT((m_format & XB_FMT_DXT_MASK) != 0)) { m_textureWidth = PadPow2(m_textureWidth); m_textureHeight = PadPow2(m_textureHeight); } if (m_format & XB_FMT_DXT_MASK) { // DXT textures must be a multiple of 4 in width and height m_textureWidth = ((m_textureWidth + 3) / 4) * 4; m_textureHeight = ((m_textureHeight + 3) / 4) * 4; } else { // align all textures so that they have an even width // in some circumstances when we downsize a thumbnail // which has an uneven number of pixels in width // we crash in CPicture::ScaleImage in ffmpegs swscale // because it tries to access beyond the source memory // (happens on osx and ios) // UPDATE: don't just update to be on an even width; // ffmpegs swscale relies on a 16-byte stride on some systems // so the textureWidth needs to be a multiple of 16. see ffmpeg // swscale headers for more info. m_textureWidth = ((m_textureWidth + 15) / 16) * 16; } // check for max texture size #define CLAMP(x, y) { if (x > y) x = y; } CLAMP(m_textureWidth, CServiceBroker::GetRenderSystem().GetMaxTextureSize()); CLAMP(m_textureHeight, CServiceBroker::GetRenderSystem().GetMaxTextureSize()); CLAMP(m_imageWidth, m_textureWidth); CLAMP(m_imageHeight, m_textureHeight); _aligned_free(m_pixels); m_pixels = NULL; if (GetPitch() * GetRows() > 0) { size_t size = GetPitch() * GetRows(); m_pixels = (unsigned char*) _aligned_malloc(size, 32); if (m_pixels == nullptr) { CLog::Log(LOGERROR, "%s - Could not allocate %zu bytes. Out of memory.", __FUNCTION__, size); } }}
开发者ID:Montellese,项目名称:xbmc,代码行数:59,
示例5: GetEyePositionVector3d cPlayer::GetThrowStartPos(void) const{ Vector3d res = GetEyePosition(); // Adjust the position to be just outside the player's bounding box: res.x += 0.16 * cos(GetPitch()); res.y += -0.1; res.z += 0.16 * sin(GetPitch()); return res;}
开发者ID:Kortak,项目名称:MCServer,代码行数:11,
示例6: ASSERTvoid CSSE2Surface32Intrinsic::OnCreated(){ ASSERT(GetBitDepth() == 32); ASSERT((GetPitch() & 0xF) == 0); ASSERT(GetVisibleWidth() && GetVisibleHeight()); ASSERT(sizeof(RGBQUAD) == 4); int width = GetVisibleWidth(); m_qwpl = GetPitch()/8; // qwords Per Line m_width = (width+3)/4; // 4 pixels at a time}
开发者ID:jetlive,项目名称:skiaming,代码行数:11,
示例7: whilevoid CBaseTexture::Allocate(unsigned int width, unsigned int height, unsigned int format){ m_imageWidth = m_originalWidth = width; m_imageHeight = m_originalHeight = height; m_format = format; m_orientation = 0; m_textureWidth = m_imageWidth; m_textureHeight = m_imageHeight; if (m_format & XB_FMT_DXT_MASK) while (GetPitch() < g_Windowing.GetMinDXTPitch()) m_textureWidth += GetBlockSize(); if (!g_Windowing.SupportsNPOT((m_format & XB_FMT_DXT_MASK) != 0)) { m_textureWidth = PadPow2(m_textureWidth); m_textureHeight = PadPow2(m_textureHeight); } if (m_format & XB_FMT_DXT_MASK) { // DXT textures must be a multiple of 4 in width and height m_textureWidth = ((m_textureWidth + 3) / 4) * 4; m_textureHeight = ((m_textureHeight + 3) / 4) * 4; } else { // align all textures so that they have an even width // in some circumstances when we downsize a thumbnail // which has an uneven number of pixels in width // we crash in CPicture::ScaleImage in ffmpegs swscale // because it tries to access beyond the source memory // (happens on osx and ios) // UPDATE: don't just update to be on an even width; // ffmpegs swscale relies on a 16-byte stride on some systems // so the textureWidth needs to be a multiple of 16. see ffmpeg // swscale headers for more info. m_textureWidth = ((m_textureWidth + 15) / 16) * 16; } // check for max texture size #define CLAMP(x, y) { if (x > y) x = y; } CLAMP(m_textureWidth, g_Windowing.GetMaxTextureSize()); CLAMP(m_textureHeight, g_Windowing.GetMaxTextureSize()); CLAMP(m_imageWidth, m_textureWidth); CLAMP(m_imageHeight, m_textureHeight); delete[] m_pixels; m_pixels = NULL; if (GetPitch() * GetRows() > 0) { m_pixels = new unsigned char[GetPitch() * GetRows()]; }}
开发者ID:davilla,项目名称:mrmc,代码行数:53,
示例8: GetScaling Matrix4* BMaxObject::GetRenderMatrix(Matrix4& mxWorld, int nRenderNumber /*= 0*/) { mxWorld.identity(); // order of rotation: roll * pitch * yaw , where roll is applied first. bool bIsIdentity = true; float fScaling = GetScaling(); if (fScaling != 1.f) { Matrix4 matScale; ParaMatrixScaling((Matrix4*)&matScale, fScaling, fScaling, fScaling); mxWorld = (bIsIdentity) ? matScale : matScale.Multiply4x3(mxWorld); bIsIdentity = false; } float fYaw = GetYaw(); if (fYaw != 0.f) { Matrix4 matYaw; ParaMatrixRotationY((Matrix4*)&matYaw, fYaw); mxWorld = (bIsIdentity) ? matYaw : matYaw.Multiply4x3(mxWorld); bIsIdentity = false; } if (GetPitch() != 0.f) { Matrix4 matPitch; ParaMatrixRotationX(&matPitch, GetPitch()); mxWorld = (bIsIdentity) ? matPitch : matPitch.Multiply4x3(mxWorld); bIsIdentity = false; } if (GetRoll() != 0.f) { Matrix4 matRoll; ParaMatrixRotationZ(&matRoll, GetRoll()); mxWorld = (bIsIdentity) ? matRoll : matRoll.Multiply4x3(mxWorld); bIsIdentity = false; } // world translation Vector3 vPos = GetRenderOffset(); mxWorld._41 += vPos.x; mxWorld._42 += vPos.y; mxWorld._43 += vPos.z; return &mxWorld; }
开发者ID:zhangleio,项目名称:NPLRuntime,代码行数:49,
示例9: GetWidthbool CImageEx::SetGray(){ int nWidth = GetWidth(); int nHeight = GetHeight(); BYTE* pArray = (BYTE*)GetBits(); int nPitch = GetPitch(); int nBitCount = GetBPP() / 8; for (int i = 0; i < nHeight; i++) { for (int j = 0; j < nWidth; j++) { int grayVal = (BYTE)(((*(pArray + nPitch * i + j * nBitCount) * 306) + (*(pArray + nPitch * i + j * nBitCount + 1) * 601) + (*(pArray + nPitch * i + j * nBitCount + 2) * 117) + 512 ) >> 10); // C++ GetPixel函数代码示例 C++ GetPin函数代码示例
|