本文整理汇总了C++中wxSize::Set方法的典型用法代码示例。如果您正苦于以下问题:C++ wxSize::Set方法的具体用法?C++ wxSize::Set怎么用?C++ wxSize::Set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxSize
的用法示例。
在下文中一共展示了wxSize::Set方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AdjustPanelBestSize
void TestDialog::AdjustPanelBestSize( const wxSize & panelBestSize, wxSize &finalPanelSize, wxSize &finalClientSize)
{
wxString log;
const wxSize clientSize = GetClientSize();
log << wxT("\nClient size is ") << clientSize;
wxCollapsiblePane *cpane = wxDynamicCast( FindWindow(ID_COLLPANE), wxCollapsiblePane );
// size of borders, margins and other controls
const wxSize restSize = clientSize - cpane->GetSize();
log << wxT("\nSize of dialog minus collpane is ") << restSize;
// For that, this is how big the dialog has to be. If expected client width is less that current width, we keep
// the same width. For height, we just add the height required by the panel to our current client height since
// so far the panel's client height was 0
const wxSize dlgBestClientSize( clientSize.x > panelBestSize.x? clientSize.x: panelBestSize.x + restSize.x,
panelBestSize.y + clientSize.y );
log << wxT("\nFor that, the dialog has to be ") << dlgBestClientSize;
// Available screen size (minus any app bars, status bars, etc
const wxSize dispSize = GetCurrentUsableDisplaySize(this);
log << wxT("\nBut the display size is only ") << dispSize;
wxSize decoSize( GetSize() - clientSize );
log << wxT("\nWindow decorations are ") << GetSize() << wxT(" minus ") << clientSize << wxT(", that is ") << decoSize;
if ( decoSize.x == 0 )
decoSize.x = 2*wxSystemSettings::GetMetric( wxSYS_BORDER_X, this);
if (decoSize.y == 0 )
decoSize.y = 2*wxSystemSettings::GetMetric( wxSYS_BORDER_Y, this) + wxSystemSettings::GetMetric(wxSYS_CAPTION_Y, this);
log << wxT("\nFinal Window decorations are ") << decoSize;
// This is how big the client size could be. Basically, the entire screen minus all window decorations
const wxSize maxClientSize = dispSize - decoSize;
log << wxT("\nSo the max possible client size is ") << maxClientSize;
// We only get as big as we need to be, so as to not cover up the entire screen unnecessarily
finalClientSize.Set( wxMin(maxClientSize.x, dlgBestClientSize.x), wxMin(maxClientSize.y, dlgBestClientSize.y) );
log << wxT("\nSo the final client size is ") << finalClientSize;
finalPanelSize.Set( wxMin( (finalClientSize.x - restSize.x), panelBestSize.x), finalClientSize.y - restSize.y - cpane->GetSize().y );
log << wxT("\nSo the final panel size is ") << finalPanelSize;
wxLogDebug(log);
}
示例2: GetSize
bool wxVideoXANIM::GetSize(wxSize& size) const
{
if (m_size[0] == 0)
return false;
size.Set(m_size[0], m_size[1]);
return true;
}
示例3: readDDS
bool ImageReader::readDDS( wxSize& po_size, BGR*& po_colors, uint8*& po_alphas ) const {
Assert( isValidHeader( m_data.GetPointer( ), m_data.GetSize( ) ) );
// Get header
if ( m_data.GetSize( ) < sizeof( DDSHeader ) ) {
return false;
}
auto header = reinterpret_cast<const DDSHeader*>( m_data.GetPointer( ) );
// Ensure some of the values are correct
if ( header->magic != FCC_DDS ||
header->size != sizeof( DDSHeader ) -4 ||
header->pixelFormat.size != sizeof( DDSPixelFormat ) ) {
return false;
}
po_colors = nullptr;
po_alphas = nullptr;
// Determine the pixel format
if ( header->pixelFormat.flags & 0x40 ) { // 0x40 = DDPF_RGB, uncompressed data
if ( !this->processUncompressedDDS( header, reinterpret_cast<RGB*&>( po_colors ), po_alphas ) ) {
return false;
}
} else if ( header->pixelFormat.flags & 0x4 ) { // 0x4 = DDPF_FOURCC, compressed
const BGRA* data = reinterpret_cast<const BGRA*>( &m_data[sizeof( *header )] );
switch ( header->pixelFormat.fourCC ) {
case FCC_DXT1:
this->processDXT1( data, header->width, header->height, po_colors, po_alphas );
break;
case FCC_DXT2:
case FCC_DXT3:
this->processDXT3( data, header->width, header->height, po_colors, po_alphas );
break;
case FCC_DXT4:
case FCC_DXT5:
this->processDXT5( data, header->width, header->height, po_colors, po_alphas );
break;
case FCC_R32F:
break;
}
} else if ( header->pixelFormat.flags & 0x20000 ) { // 0x20000 = DDPF_LUMINANCE, single-byte color
if ( !this->processLuminanceDDS( header, reinterpret_cast<RGB*&>( po_colors ) ) ) {
return false;
}
}
if ( !!po_colors ) {
po_size.Set( header->width, header->height );
}
return !!po_colors;
}
示例4: readATEX
bool ImageReader::readATEX( wxSize& po_size, BGR*& po_colors, uint8*& po_alphas ) const {
Assert( isValidHeader( m_data.GetPointer( ), m_data.GetSize( ) ) );
auto atex = reinterpret_cast<const ANetAtexHeader*>( m_data.GetPointer( ) );
// Determine mipmap0 size and bail if the file is too small
if ( m_data.GetSize( ) >= sizeof( ANetAtexHeader ) +sizeof( uint32 ) ) {
auto mipMap0Size = *reinterpret_cast<const uint32*>( &m_data[sizeof( ANetAtexHeader )] );
if ( mipMap0Size + sizeof( ANetAtexHeader ) > m_data.GetSize( ) ) {
po_size.Set( 0, 0 );
return false;
}
} else {
po_size.Set( 0, 0 );
return false;
}
// Init some fields
auto data = reinterpret_cast<const uint8_t*>( m_data.GetPointer( ) );
po_colors = nullptr;
po_alphas = nullptr;
uint16 width = atex->width;
uint16 height = atex->height;
// Hack for read 126x64 ATEX
if ( width == 126 && height == 64 ) {
width = 128;
}
// Allocate output
auto output = allocate<BGRA>( width * height );
uint32_t outputBufferSize;
// Uncompress
switch ( atex->formatInteger ) {
case FCC_DXT1:
if ( gw2dt::compression::inflateTextureFileBuffer( m_data.GetSize( ), data, outputBufferSize, reinterpret_cast<uint8_t*>( output ) ) ) {
this->processDXT1( output, width, height, po_colors, po_alphas );
}
break;
case FCC_DXT2:
case FCC_DXT3:
case FCC_DXTN:
if ( gw2dt::compression::inflateTextureFileBuffer( m_data.GetSize( ), data, outputBufferSize, reinterpret_cast< uint8_t* >( output ) ) ) {
this->processDXT3( output, width, height, po_colors, po_alphas );
}
break;
case FCC_DXT4:
case FCC_DXT5:
if ( gw2dt::compression::inflateTextureFileBuffer( m_data.GetSize( ), data, outputBufferSize, reinterpret_cast< uint8_t* >( output ) ) ) {
this->processDXT5( output, width, height, po_colors, po_alphas );
}
break;
case FCC_DXTA:
if ( gw2dt::compression::inflateTextureFileBuffer( m_data.GetSize( ), data, outputBufferSize, reinterpret_cast< uint8_t* >( output ) ) ) {
this->processDXTA( reinterpret_cast< uint64* >( output ), width, height, po_colors );
}
break;
case FCC_DXTL:
if ( gw2dt::compression::inflateTextureFileBuffer( m_data.GetSize( ), data, outputBufferSize, reinterpret_cast<uint8_t*>( output ) ) ) {
this->processDXT5( output, width, height, po_colors, po_alphas );
for ( uint i = 0; i < ( static_cast<uint>( width ) * static_cast<uint>( height ) ); i++ ) {
po_colors[i].r = ( po_colors[i].r * po_alphas[i] ) / 0xff;
po_colors[i].g = ( po_colors[i].g * po_alphas[i] ) / 0xff;
po_colors[i].b = ( po_colors[i].b * po_alphas[i] ) / 0xff;
}
}
break;
case FCC_3DCX:
if ( gw2dt::compression::inflateTextureFileBuffer( m_data.GetSize( ), data, outputBufferSize, reinterpret_cast< uint8_t* >( output ) ) ) {
this->process3DCX( reinterpret_cast<RGBA*>( output ), width, height, po_colors, po_alphas );
}
break;
default:
freePointer( output );
return false;
}
freePointer( output );
if ( po_colors ) {
po_size.Set( width, height );
return true;
}
return false;
}