本文整理汇总了C++中GetFormat函数的典型用法代码示例。如果您正苦于以下问题:C++ GetFormat函数的具体用法?C++ GetFormat怎么用?C++ GetFormat使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetFormat函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PDxtexApp
HRESULT CDxtexDoc::Resize(DWORD dwWidthNew, DWORD dwHeightNew)
{
HRESULT hr;
LPDIRECT3DTEXTURE9 pmiptexNew;
LPDIRECT3DDEVICE9 pd3ddev = PDxtexApp()->Pd3ddev();
hr = pd3ddev->CreateTexture(dwWidthNew, dwHeightNew, m_numMips,
0, GetFormat(m_ptexOrig), D3DPOOL_MANAGED, &pmiptexNew, NULL);
if (FAILED(hr))
return hr;
if (FAILED(BltAllLevels(D3DCUBEMAP_FACE_FORCE_DWORD, m_ptexOrig, pmiptexNew)))
return hr;
ReleasePpo(&m_ptexOrig);
m_ptexOrig = pmiptexNew;
if( m_ptexNew != NULL )
{
hr = pd3ddev->CreateTexture(dwWidthNew, dwHeightNew, m_numMips,
0, GetFormat(m_ptexOrig), D3DPOOL_MANAGED, &pmiptexNew, NULL);
if (FAILED(hr))
return hr;
if (FAILED(BltAllLevels(D3DCUBEMAP_FACE_FORCE_DWORD, m_ptexNew, pmiptexNew)))
return hr;
ReleasePpo(&m_ptexNew);
m_ptexNew = pmiptexNew;
}
m_dwWidth = dwWidthNew;
m_dwHeight = dwHeightNew;
SetModifiedFlag(TRUE);
UpdateAllViews(NULL, 4);
return S_OK;
}
示例2: CALLED
void ESDSinkNode::GetFlavor(flavor_info * outInfo, int32 id)
{
CALLED();
outInfo->flavor_flags = B_FLAVOR_IS_GLOBAL;
// outInfo->possible_count = 0; // any number
outInfo->possible_count = 1; // only 1
outInfo->in_format_count = 0; // no inputs
outInfo->in_formats = 0;
outInfo->out_format_count = 0; // no outputs
outInfo->out_formats = 0;
outInfo->internal_id = id;
outInfo->name = new char[256];
strcpy(outInfo->name, "ESounD Out");
outInfo->info = new char[256];
strcpy(outInfo->info, "The ESounD Sink node outputs a network Enlightenment Sound Daemon.");
outInfo->kinds = /*B_TIME_SOURCE | *//*B_CONTROLLABLE | */ 0;
#if ENABLE_INPUT
outInfo->kinds |= B_BUFFER_PRODUCER | B_PHYSICAL_INPUT;
outInfo->out_format_count = 1; // 1 output
media_format * outformats = new media_format[outInfo->out_format_count];
GetFormat(&outformats[0]);
outInfo->out_formats = outformats;
#endif
outInfo->kinds |= B_BUFFER_CONSUMER | B_PHYSICAL_OUTPUT;
outInfo->in_format_count = 1; // 1 input
media_format * informats = new media_format[outInfo->in_format_count];
GetFormat(&informats[0]);
outInfo->in_formats = informats;
}
示例3: GetExtent
void Image::Resize(const Extent3D& extent, const ColorRGBAd& fillColor, const Offset3D& offset)
{
if (extent != GetExtent())
{
/* Store ownership of current image buffer in temporary image */
Image prevImage;
prevImage.extent_ = GetExtent();
prevImage.format_ = GetFormat();
prevImage.dataType_ = GetDataType();
prevImage.data_ = std::move(data_);
if ( extent.width > GetExtent().width ||
extent.height > GetExtent().height ||
extent.depth > GetExtent().depth )
{
/* Resize image buffer with fill color */
extent_ = extent;
data_ = GenerateImageBuffer(GetFormat(), GetDataType(), GetNumPixels(), fillColor);
}
else
{
/* Resize image buffer with uninitialized image buffer */
extent_ = extent;
data_ = GenerateEmptyByteBuffer(GetDataSize(), false);
}
/* Copy previous image into new image */
Blit(offset, prevImage, { 0, 0, 0 }, prevImage.GetExtent());
}
}
示例4: NS_WARNING
//-------------------------------------------------------------------------
NS_IMETHODIMP nsClipboard::HasDataMatchingFlavors(const char** aFlavorList,
PRUint32 aLength,
PRInt32 aWhichClipboard,
bool *_retval)
{
*_retval = false;
if (aWhichClipboard != kGlobalClipboard || !aFlavorList)
return NS_OK;
for (PRUint32 i = 0;i < aLength; ++i) {
#ifdef DEBUG
if (strcmp(aFlavorList[i], kTextMime) == 0)
NS_WARNING ( "DO NOT USE THE text/plain DATA FLAVOR ANY MORE. USE text/unicode INSTEAD" );
#endif
UINT format = GetFormat(aFlavorList[i]);
if (IsClipboardFormatAvailable(format)) {
*_retval = true;
break;
}
else {
// We haven't found the exact flavor the client asked for, but maybe we can
// still find it from something else that's on the clipboard...
if (strcmp(aFlavorList[i], kUnicodeMime) == 0) {
// client asked for unicode and it wasn't present, check if we have CF_TEXT.
// We'll handle the actual data substitution in the data object.
if (IsClipboardFormatAvailable(GetFormat(kTextMime)))
*_retval = true;
}
}
}
return NS_OK;
}
示例5: GetTextToFile
void MapServerDlg::UpdateEnabling()
{
GetTextToFile()->Enable(m_bToFile);
GetDotdotdot()->Enable(m_bToFile);
// For now, going straight to memory must be PNG
if (!m_bToFile)
GetFormat()->SetSelection(1);
GetFormat()->Enable(m_bToFile);
}
示例6: MOZ_ASSERT
bool
MemoryTextureClient::ToSurfaceDescriptor(SurfaceDescriptor& aDescriptor)
{
MOZ_ASSERT(IsValid());
if (!IsAllocated() || GetFormat() == gfx::FORMAT_UNKNOWN) {
return false;
}
aDescriptor = SurfaceDescriptorMemory(reinterpret_cast<uintptr_t>(mBuffer),
GetFormat());
return true;
}
示例7: MOZ_ASSERT
TemporaryRef<gfx::DataSourceSurface>
ImageDataSerializerBase::GetAsSurface()
{
MOZ_ASSERT(IsValid());
SurfaceBufferInfo* info = GetBufferInfo(mData);
gfx::IntSize size(info->width, info->height);
uint32_t stride = gfxASurface::BytesPerPixel(
gfx::SurfaceFormatToImageFormat(GetFormat())) * info->width;
RefPtr<gfx::DataSourceSurface> surf =
gfx::Factory::CreateWrappingDataSourceSurface(GetData(), stride, size, GetFormat());
return surf.forget();
}
示例8: MOZ_ASSERT
bool
ShmemTextureData::Serialize(SurfaceDescriptor& aOutDescriptor)
{
MOZ_ASSERT(GetFormat() != gfx::SurfaceFormat::UNKNOWN);
if (GetFormat() == gfx::SurfaceFormat::UNKNOWN) {
return false;
}
aOutDescriptor = SurfaceDescriptorBuffer(mDescriptor, MemoryOrShmem(mShmem));
return true;
}
示例9: LoadDDSFile
bool LoadDDSFile(TCHAR* pszFile, AMD_TC_Texture& texture)
{
FILE* pSourceFile = _tfopen(pszFile, _T("rb"));
if (!pSourceFile) return false;
DWORD dwFileHeader;
fread(&dwFileHeader, sizeof(DWORD), 1, pSourceFile);
if(dwFileHeader != DDS_HEADER)
{
_tprintf(_T("Source file is not a valid DDS.\n"));
fclose(pSourceFile);
return false;
}
DDSD2 ddsd;
fread(&ddsd, sizeof(DDSD2), 1, pSourceFile);
memset(&texture, 0, sizeof(texture));
texture.dwSize = sizeof(texture);
texture.dwWidth = ddsd.dwWidth;
texture.dwHeight = ddsd.dwHeight;
texture.dwPitch = ddsd.lPitch;
if(ddsd.ddpfPixelFormat.dwRGBBitCount==32)
texture.format = AMD_TC_FORMAT_ARGB_8888;
else if(ddsd.ddpfPixelFormat.dwRGBBitCount==24)
texture.format = AMD_TC_FORMAT_RGB_888;
else if(GetFormat(ddsd.ddpfPixelFormat.dwPrivateFormatBitCount) != AMD_TC_FORMAT_Unknown)
texture.format = GetFormat(ddsd.ddpfPixelFormat.dwPrivateFormatBitCount);
else if(GetFormat(ddsd.ddpfPixelFormat.dwFourCC) != AMD_TC_FORMAT_Unknown)
texture.format = GetFormat(ddsd.ddpfPixelFormat.dwFourCC);
else
{
_tprintf(_T("Unsupported source format.\n"));
fclose(pSourceFile);
return false;
}
// Init source texture
texture.dwDataSize = AMD_TC_CalculateBufferSize(&texture);
texture.pData = (AMD_TC_BYTE*) malloc(texture.dwDataSize);
fread(texture.pData, texture.dwDataSize, 1, pSourceFile);
fclose(pSourceFile);
return true;
}
示例10: doClose
int SUBTITLESOURCE::doClose()
{
int i,j;
if (GetFormat()==SUBFORMAT_SSA)
{
for (i=0;i<(int)dwNbrOfStyles;i++)
{
for (j=0;j<18;j++)
{
if (lplpSSAStyles[i]->lpcArray[j]) delete lplpSSAStyles[i]->lpcArray[j];
}
delete lplpSSAStyles[i];
}
for (j=0;j<14;j++)
{
if (lpSSAHeader->lpcArray && lpSSAHeader->lpcArray[j]) delete lpSSAHeader->lpcArray[j];
}
}
if (lplpSSAStyles) delete lplpSSAStyles;
if (lpSSAHeader) delete lpSSAHeader;
lplpSSAStyles=NULL;
lpSSAHeader=NULL;
return 0;
}
示例11: FindUnicodeFromPlainText
//
// FindUnicodeFromPlainText
//
// we are looking for text/unicode and we failed to find it on the clipboard first,
// try again with text/plain. If that is present, convert it to unicode.
//
bool
nsClipboard :: FindUnicodeFromPlainText ( IDataObject* inDataObject, UINT inIndex, void** outData, PRUint32* outDataLen )
{
bool dataFound = false;
// we are looking for text/unicode and we failed to find it on the clipboard first,
// try again with text/plain. If that is present, convert it to unicode.
nsresult loadResult = GetNativeDataOffClipboard(inDataObject, inIndex, GetFormat(kTextMime), nullptr, outData, outDataLen);
if ( NS_SUCCEEDED(loadResult) && *outData ) {
const char* castedText = reinterpret_cast<char*>(*outData);
PRUnichar* convertedText = nullptr;
PRInt32 convertedTextLen = 0;
nsPrimitiveHelpers::ConvertPlatformPlainTextToUnicode ( castedText, *outDataLen,
&convertedText, &convertedTextLen );
if ( convertedText ) {
// out with the old, in with the new
nsMemory::Free(*outData);
*outData = convertedText;
*outDataLen = convertedTextLen * sizeof(PRUnichar);
dataFound = true;
}
} // if plain text data on clipboard
return dataFound;
} // FindUnicodeFromPlainText
示例12: GetWorld
FTextureResource* UTextureRenderTarget2D::CreateResource()
{
UWorld* World = GetWorld();
ERHIFeatureLevel::Type FeatureLevel = World != nullptr ? World->FeatureLevel : GMaxRHIFeatureLevel;
if (FeatureLevel <= ERHIFeatureLevel::ES2)
{
EPixelFormat Format = GetFormat();
if ((!GSupportsRenderTargetFormat_PF_FloatRGBA && (Format == PF_FloatRGBA || Format == PF_FloatRGB))
|| Format == PF_A16B16G16R16)
{
OverrideFormat = PF_B8G8R8A8;
}
}
if (bAutoGenerateMips)
{
NumMips = FGenericPlatformMath::CeilToInt(FGenericPlatformMath::Log2(FGenericPlatformMath::Max(SizeX, SizeY)));
}
else
{
NumMips = 1;
}
FTextureRenderTarget2DResource* Result = new FTextureRenderTarget2DResource(this);
return Result;
}
示例13: WriteBitmap
void ImageWriter::WriteBitmap(Bitmap* bmp, ProgressCallback* callback)
{
if (bmp->GetWidth() != GetWidth()) XLI_THROW_INVALID_ARGUMENT("Bitmap must have same width as ImageWriter");
if (bmp->GetHeight() != GetHeight()) XLI_THROW_INVALID_ARGUMENT("Bitmap must have same height as ImageWriter");
if (bmp->GetFormat() != GetFormat()) XLI_THROW_INVALID_ARGUMENT("Bitmap must have same format as ImageWriter");
Write(bmp->GetPtr(), bmp->GetPitch(), callback);
}
示例14: BMediaNode
MediaReader::MediaReader(
size_t defaultChunkSize,
float defaultBitRate,
const flavor_info * info,
BMessage * config,
BMediaAddOn * addOn)
: BMediaNode("MediaReader"),
BBufferProducer(B_MEDIA_MULTISTREAM),
AbstractFileInterfaceNode(defaultChunkSize, defaultBitRate, info, config, addOn)
{
CALLED();
// null some fields
fBufferGroup = 0;
// start enabled
fOutputEnabled = true;
// don't overwrite available space, and be sure to terminate
strncpy(output.name,"MediaReader Output",B_MEDIA_NAME_LENGTH-1);
output.name[B_MEDIA_NAME_LENGTH-1] = '\0';
// initialize the output
output.node = media_node::null; // until registration
output.source = media_source::null; // until registration
output.destination = media_destination::null;
GetFormat(&output.format);
}
示例15: GetFormat
/// <summary>
/// Calculates the Julian date from the epoch parameter. The format of
/// the epoch can be JulianDate, Date or Packed date format.
/// </summary>
/// <param name="epoch">The time instance in JulianDate, Date or Packed date format</param>
/// <returns>The time instance in double</returns>
int Ephemeris::GetJulianDate(std::string epoch, double &julianDate)
{
DateTime dateTime;
std::string data = epoch.substr(2, epoch.length() - 2);
EpochFormat epochFormat = GetFormat(epoch);
switch (epochFormat)
{
case JulianDate:
julianDate = atof(data.c_str());
break;
case Date:
DateFormat(epoch, dateTime);
ToJulianDate(dateTime, julianDate);
break;
case PackedDate:
PackedDateFormat(epoch, dateTime);
ToJulianDate(dateTime, julianDate);
break;
case UndefinedFormat:
Error::_errMsg = "Undefined format for epoch!";
Error::PushLocation(__FILE__, __FUNCTION__, __LINE__);
return 1;
default:
Error::_errMsg = "Invalid value for epoch!";
Error::PushLocation(__FILE__, __FUNCTION__, __LINE__);
return 1;
}
return 0;
}