当前位置: 首页>>代码示例>>C++>>正文


C++ wxBitmap::GetHeight方法代码示例

本文整理汇总了C++中wxBitmap::GetHeight方法的典型用法代码示例。如果您正苦于以下问题:C++ wxBitmap::GetHeight方法的具体用法?C++ wxBitmap::GetHeight怎么用?C++ wxBitmap::GetHeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在wxBitmap的用法示例。


在下文中一共展示了wxBitmap::GetHeight方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: AddTool

void CDragBar::AddTool(int id, const wxBitmap& bmp, const wxString& tooltip /*= wxEmptyString*/,
                                    const wxBitmap& bmpDisabled /*= wxNullBitmap*/)
{
  //all bitmaps must be same size
  if (m_bmpWidth == 0)
    m_bmpWidth = bmp.GetWidth();
  else {
    wxASSERT(m_bmpWidth == bmp.GetWidth());
  }

  if (m_bmpHeight == 0)
    m_bmpHeight = bmp.GetHeight();
  else {
    wxASSERT(m_bmpHeight == bmp.GetHeight());
  }

  if (bmpDisabled.IsOk()) {
    wxASSERT(m_bmpWidth == bmpDisabled.GetWidth());
    wxASSERT(m_bmpHeight == bmpDisabled.GetHeight());
  }

  DragBarItem item;
  item.id = id;
  item.bmp = bmp;
  item.bmpDisabled = bmpDisabled;
  item.tooltip = tooltip;
  item.enabled = true;

  m_items.push_back( item );
}
开发者ID:soundsrc,项目名称:pwsafe,代码行数:30,代码来源:dragbar.cpp

示例2: DrawButtonBarButtonForeground

void wxRibbonMetroArtProvider::DrawButtonBarButtonForeground(wxDC& dc, const wxRect& rect, wxRibbonButtonKind kind,
                                                             long state, const wxString& label,
                                                             const wxBitmap& bitmap_large, const wxBitmap& bitmap_small)
{
    switch(state & wxRIBBON_BUTTONBAR_BUTTON_SIZE_MASK) {
    case wxRIBBON_BUTTONBAR_BUTTON_LARGE: {
        const int padding = 2;
        dc.DrawBitmap(bitmap_large, rect.x + (rect.width - bitmap_large.GetWidth()) / 2, rect.y + padding, true);
        int ypos = rect.y + padding + bitmap_large.GetHeight() + padding;
        int arrow_width = kind == wxRIBBON_BUTTON_NORMAL ? 0 : 8;
        wxCoord label_w, label_h;
        dc.GetTextExtent(label, &label_w, &label_h);
        if(label_w + 2 * padding <= rect.width) {
            dc.DrawText(label, rect.x + (rect.width - label_w) / 2, ypos);
            if(arrow_width != 0) {
                DrawDropdownArrow(dc, rect.x + rect.width / 2, ypos + (label_h * 3) / 2, m_button_bar_label_colour);
            }
        } else {
            size_t breaki = label.Len();
            do {
                --breaki;
                if(wxRibbonCanLabelBreakAtPosition(label, breaki)) {
                    wxString label_top = label.Mid(0, breaki);
                    dc.GetTextExtent(label_top, &label_w, &label_h);
                    if(label_w + 2 * padding <= rect.width) {
                        dc.DrawText(label_top, rect.x + (rect.width - label_w) / 2, ypos);
                        ypos += label_h;
                        wxString label_bottom = label.Mid(breaki + 1);
                        dc.GetTextExtent(label_bottom, &label_w, &label_h);
                        label_w += arrow_width;
                        int iX = rect.x + (rect.width - label_w) / 2;
                        dc.DrawText(label_bottom, iX, ypos);
                        if(arrow_width != 0) {
                            DrawDropdownArrow(dc, iX + 2 + label_w - arrow_width, ypos + label_h / 2 + 1,
                                              m_button_bar_label_colour);
                        }
                        break;
                    }
                }
            } while(breaki > 0);
        }
    } break;
    case wxRIBBON_BUTTONBAR_BUTTON_MEDIUM: {
        int x_cursor = rect.x + 2;
        dc.DrawBitmap(bitmap_small, x_cursor, rect.y + (rect.height - bitmap_small.GetHeight()) / 2, true);
        x_cursor += bitmap_small.GetWidth() + 2;
        wxCoord label_w, label_h;
        dc.GetTextExtent(label, &label_w, &label_h);
        dc.DrawText(label, x_cursor, rect.y + (rect.height - label_h) / 2);
        x_cursor += label_w + 3;
        if(kind != wxRIBBON_BUTTON_NORMAL) {
            DrawDropdownArrow(dc, x_cursor, rect.y + rect.height / 2, m_button_bar_label_colour);
        }
        break;
    }
    default:
        // TODO
        break;
    }
}
开发者ID:eranif,项目名称:codelite,代码行数:60,代码来源:art_metro.cpp

示例3: CreateSplashScreenBitmap

wxBitmap clSplashScreen::CreateSplashScreenBitmap(const wxBitmap& origBmp)
{
    wxBitmap bmp;
    wxMemoryDC memDC;
    
    bmp = wxBitmap(origBmp.GetWidth(), origBmp.GetHeight());
    memDC.SelectObject(bmp);
    memDC.SetBrush(wxColour(63, 80, 24));
    memDC.SetPen(wxColour(63, 80, 24));
    memDC.DrawRectangle(0, 0, origBmp.GetWidth(), origBmp.GetHeight());
    memDC.DrawBitmap(origBmp, 0, 0, true);
    memDC.SetPen(*wxWHITE);
    memDC.SetBrush(*wxTRANSPARENT_BRUSH);
    memDC.DrawRectangle(0, 0, origBmp.GetWidth(), origBmp.GetHeight());

    wxFont font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
    font.SetPointSize(14);
    font.SetWeight(wxFONTWEIGHT_BOLD);
    
    memDC.SetFont(font);
    wxString versionString;
    versionString << "v" << CODELITE_VERSION_STRING;
    wxSize textSize = memDC.GetTextExtent(versionString);
    wxCoord textx, texty;
    textx = (bmp.GetWidth() - textSize.GetWidth()) - 5;
    texty = 5;
    memDC.DrawText(versionString, textx, texty);
    memDC.SelectObject(wxNullBitmap);
    return bmp;
}
开发者ID:capturePointer,项目名称:codelite,代码行数:30,代码来源:clsplashscreen.cpp

示例4: setImage

    void setImage(wxString path)
    {
        m_image_path = path;

        if(path.EndsWith(wxT(".icns"))) {
            wxExecute(wxT("sips -s format png '") + path + wxT("' --out /tmp/tmpicon.png"), wxEXEC_SYNC);
            path = wxT("/tmp/tmpicon.png");
        }

        m_image.LoadFile(path, wxBITMAP_TYPE_ANY);

        if(m_image.IsOk()) {
            if(m_image.GetWidth() > 50 or m_image.GetHeight() > 50) {
                wxImage tmp = m_image.ConvertToImage();
                tmp.Rescale(50, 50, wxIMAGE_QUALITY_HIGH);
                m_image = wxBitmap(tmp);
            }

            const int w = m_image.GetWidth();
            const int h = m_image.GetHeight();
            SetMinSize(wxSize(w + 20, h + 20));
            SetMaxSize(wxSize(w + 20, h + 20));
            Refresh(); // repaint needed to see change
        } else {
            wxMessageBox(_("Failed to load image"));
        }
    }
开发者ID:capturePointer,项目名称:codelite,代码行数:27,代码来源:macbundler.cpp

示例5: Draw

void wxHtmlImageCell::Draw(wxDC& dc, int x, int y,
                           int WXUNUSED(view_y1), int WXUNUSED(view_y2),
                           wxHtmlRenderingInfo& WXUNUSED(info))
{
    if ( m_showFrame )
    {
        dc.SetBrush(*wxTRANSPARENT_BRUSH);
        dc.SetPen(*wxBLACK_PEN);
        dc.DrawRectangle(x + m_PosX, y + m_PosY, m_Width, m_Height);
        x++, y++;
    }
    if ( m_bitmap )
    {
        // We add in the scaling from the desired bitmap width
        // and height, so we only do the scaling once.
        double imageScaleX = 1.0;
        double imageScaleY = 1.0;
        if (m_Width != m_bitmap->GetWidth())
            imageScaleX = (double) m_Width / (double) m_bitmap->GetWidth();
        if (m_Height != m_bitmap->GetHeight())
            imageScaleY = (double) m_Height / (double) m_bitmap->GetHeight();

        double us_x, us_y;
        dc.GetUserScale(&us_x, &us_y);
        dc.SetUserScale(us_x * imageScaleX, us_y * imageScaleY);

        dc.DrawBitmap(*m_bitmap, (int) ((x + m_PosX) / (imageScaleX)),
                                 (int) ((y + m_PosY) / (imageScaleY)), true);
        dc.SetUserScale(us_x, us_y);
    }
}
开发者ID:beanhome,项目名称:dev,代码行数:31,代码来源:m_image.cpp

示例6: Add

int wxImageList::Add( const wxBitmap &bitmap )
{
    wxASSERT_MSG( (bitmap.GetWidth() >= m_width && bitmap.GetHeight() == m_height)
                  || (m_width == 0 && m_height == 0),
                  _T("invalid bitmap size in wxImageList: this might work ")
                  _T("on this platform but definitely won't under Windows.") );

    // Mimic behavior of Windows ImageList_Add that automatically breaks up the added
    // bitmap into sub-images of the correct size
    if (m_width > 0 && bitmap.GetWidth() > m_width && bitmap.GetHeight() >= m_height)
    {
        int numImages = bitmap.GetWidth() / m_width;
        for (int subIndex = 0; subIndex < numImages; subIndex++)
        {
            wxRect rect(m_width * subIndex, 0, m_width, m_height);
            wxBitmap tmpBmp = bitmap.GetSubBitmap(rect);
            m_images.Append( new wxBitmap(tmpBmp) );
        }
    }
    else
    {
        m_images.Append( new wxBitmap(bitmap) );
    }

    if (m_width == 0 && m_height == 0)
    {
        m_width = bitmap.GetWidth();
        m_height = bitmap.GetHeight();
    }

    return m_images.GetCount() - 1;
}
开发者ID:Bluehorn,项目名称:wxPython,代码行数:32,代码来源:imaglist.cpp

示例7: ResizeBitmap

bool wxWizard::ResizeBitmap(wxBitmap& bmp)
{
    if (!GetBitmapPlacement())
        return false;

    if (bmp.Ok())
    {
        wxSize pageSize = m_sizerPage->GetSize();
        if (pageSize == wxSize(0,0))
            pageSize = GetPageSize();
        int bitmapWidth = wxMax(bmp.GetWidth(), GetMinimumBitmapWidth());
        int bitmapHeight = pageSize.y;

        if (!m_statbmp->GetBitmap().Ok() || m_statbmp->GetBitmap().GetHeight() != bitmapHeight)
        {
            wxBitmap bitmap(bitmapWidth, bitmapHeight);
            {
                wxMemoryDC dc;
                dc.SelectObject(bitmap);
                dc.SetBackground(wxBrush(m_bitmapBackgroundColour));
                dc.Clear();

                if (GetBitmapPlacement() & wxWIZARD_TILE)
                {
                    TileBitmap(wxRect(0, 0, bitmapWidth, bitmapHeight), dc, bmp);
                }
                else
                {
                    int x, y;

                    if (GetBitmapPlacement() & wxWIZARD_HALIGN_LEFT)
                        x = 0;
                    else if (GetBitmapPlacement() & wxWIZARD_HALIGN_RIGHT)
                        x = bitmapWidth - bmp.GetWidth();
                    else
                        x = (bitmapWidth - bmp.GetWidth())/2;

                    if (GetBitmapPlacement() & wxWIZARD_VALIGN_TOP)
                        y = 0;
                    else if (GetBitmapPlacement() & wxWIZARD_VALIGN_BOTTOM)
                        y = bitmapHeight - bmp.GetHeight();
                    else
                        y = (bitmapHeight - bmp.GetHeight())/2;

                    dc.DrawBitmap(bmp, x, y, true);
                    dc.SelectObject(wxNullBitmap);
                }
            }

            bmp = bitmap;
        }
    }

    return true;
}
开发者ID:jonntd,项目名称:dynamica,代码行数:55,代码来源:wizard.cpp

示例8: GetSize

    virtual wxSize GetSize() const {
        int xx, yy;
        wxBitmap bmp(1, 1);
        wxMemoryDC dc;
        dc.SelectObject(bmp);

        wxString s = m_value.GetString();
        wxFont f = m_font;
        dc.GetTextExtent(s, &xx, &yy, NULL, NULL, &f);

        // Adjust the height to fit the bitmap height at least
        yy < m_errorBmp.GetHeight() ? yy = m_errorBmp.GetHeight() : yy = yy;
        return wxSize(xx, yy);
    }
开发者ID:Hmaal,项目名称:codelite,代码行数:14,代码来源:new_build_tab.cpp

示例9: OverlaySymlink

static void OverlaySymlink(wxBitmap& bmp)
{
	// This is ugly, but apparently needed so that the data is _really_ in the right internal format
	bmp = bmp.ConvertToImage();
	wxBitmap symlink = wxArtProvider::GetBitmap(_T("ART_SYMLINK"),  wxART_OTHER, wxSize(bmp.GetWidth(), bmp.GetHeight())).ConvertToImage();

	wxAlphaPixelData target(bmp);
	wxAlphaPixelData source(symlink);

	int sx = bmp.GetWidth();
	if (symlink.GetWidth() < sx)
		sx = symlink.GetWidth();		
	int sy = bmp.GetHeight();
	if (symlink.GetHeight() < sy)
		sy = symlink.GetHeight();		

	// Do some rudimentary alpha copying
	wxAlphaPixelData::Iterator t(target);
	wxAlphaPixelData::Iterator s(source);
	for (int y = 0; y < sy; y++)
	{
		s.MoveTo(source, 0, y);
		t.MoveTo(target, 0, y);
		for (int x = 0; x < sx; x++, s++, t++)
			AlphaComposite_Over_Inplace(t, s);
	}
}
开发者ID:AbelTian,项目名称:filezilla,代码行数:27,代码来源:systemimagelist.cpp

示例10: DoSelect

void wxMemoryDCImpl::DoSelect( const wxBitmap& bitmap )
{
    if ( m_selected.Ok() )
    {
        m_selected.EndRawAccess() ;
        wxDELETE(m_graphicContext);
    }

    m_selected = bitmap;
    if (m_selected.Ok())
    {
        if ( m_selected.GetDepth() != 1 )
            m_selected.UseAlpha() ;
        m_selected.BeginRawAccess() ;
        m_width = bitmap.GetWidth();
        m_height = bitmap.GetHeight();
        CGColorSpaceRef genericColorSpace  = wxMacGetGenericRGBColorSpace();
        CGContextRef bmCtx = (CGContextRef) m_selected.GetHBITMAP();

        if ( bmCtx )
        {
            CGContextSetFillColorSpace( bmCtx, genericColorSpace );
            CGContextSetStrokeColorSpace( bmCtx, genericColorSpace );
            SetGraphicsContext( wxGraphicsContext::CreateFromNative( bmCtx ) );
        }
        m_ok = (m_graphicContext != NULL) ;
    }
    else
    {
        m_ok = false;
    }
}
开发者ID:BloodRedd,项目名称:gamekit,代码行数:32,代码来源:dcmemory.cpp

示例11: OnAddBitmap

bool wxBitmapComboBox::OnAddBitmap(const wxBitmap& bitmap)
{
    if ( bitmap.Ok() )
    {
        int width = bitmap.GetWidth();
        int height = bitmap.GetHeight();

        if ( m_usedImgSize.x <= 0 )
        {
            //
            // If size not yet determined, get it from this image.
            m_usedImgSize.x = width;
            m_usedImgSize.y = height;

            InvalidateBestSize();
            wxSize newSz = GetBestSize();
            wxSize sz = GetSize();
            if ( newSz.y > sz.y )
                SetSize(sz.x, newSz.y);
            else
                DetermineIndent();
        }

        wxCHECK_MSG(width == m_usedImgSize.x && height == m_usedImgSize.y,
                    false,
                    wxT("you can only add images of same size"));
    }

    return true;
}
开发者ID:252525fb,项目名称:rpcs3,代码行数:30,代码来源:bmpcboxg.cpp

示例12: wxBitmap

bool BM2CMP_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl )
{
    // Prj().MaybeLoadProjectSettings();

    m_BitmapFileName = aFileSet[0];

    if( !m_Pict_Image.LoadFile( m_BitmapFileName ) )
    {
        // LoadFile has its own UI, no need for further failure notification here
        return false;
    }

    m_Pict_Bitmap = wxBitmap( m_Pict_Image );

    int h  = m_Pict_Bitmap.GetHeight();
    int w  = m_Pict_Bitmap.GetWidth();

    // Determine image resolution in DPI (does not existing in all formats).
    // the resolution can be given in bit per inches or bit per cm in file
    m_imageDPI.x = m_Pict_Image.GetOptionInt( wxIMAGE_OPTION_RESOLUTIONX );
    m_imageDPI.y = m_Pict_Image.GetOptionInt( wxIMAGE_OPTION_RESOLUTIONY );

    if( m_imageDPI.x > 1 && m_imageDPI.y > 1 )
    {
        if( m_Pict_Image.GetOptionInt( wxIMAGE_OPTION_RESOLUTIONUNIT ) == wxIMAGE_RESOLUTION_CM )
        {
            // When the initial resolution is given in bits per cm,
            // experience shows adding 1.27 to the resolution converted in dpi
            // before convert to int value reduce the conversion error
            // but it is not perfect
            m_imageDPI.x = m_imageDPI.x * 2.54 + 1.27;
            m_imageDPI.y = m_imageDPI.y * 2.54 + 1.27;
        }
    }
    else    // fallback to the default value
        m_imageDPI.x = m_imageDPI.y = DEFAULT_DPI;

    // Display image info:
    // We are using ChangeValue here to avoid generating a wxEVT_TEXT event.
    m_DPIValueX->ChangeValue( wxString::Format( wxT( "%d" ), m_imageDPI.x ) );
    m_DPIValueY->ChangeValue( wxString::Format( wxT( "%d" ), m_imageDPI.y ) );
    updateImageInfo();

    m_InitialPicturePanel->SetVirtualSize( w, h );
    m_GreyscalePicturePanel->SetVirtualSize( w, h );
    m_BNPicturePanel->SetVirtualSize( w, h );

    m_Greyscale_Image.Destroy();
    m_Greyscale_Image = m_Pict_Image.ConvertToGreyscale( );

    if( m_rbOptions->GetSelection() > 0 )
        NegateGreyscaleImage( );

    m_Greyscale_Bitmap = wxBitmap( m_Greyscale_Image );

    m_NB_Image  = m_Greyscale_Image;
    Binarize( (double) m_sliderThreshold->GetValue()/m_sliderThreshold->GetMax() );

    return true;
}
开发者ID:BTR1,项目名称:kicad-source-mirror,代码行数:60,代码来源:bitmap2cmp_gui.cpp

示例13: SetBitmap

void wxStaticBitmap::SetBitmap(const wxBitmap& bitmap)
{
    m_bitmap = bitmap;
    InvalidateBestSize();
    SetSize(wxSize(bitmap.GetWidth(), bitmap.GetHeight()));
    Refresh() ;
}
开发者ID:HackLinux,项目名称:chandler-1,代码行数:7,代码来源:statbmp.cpp

示例14: Create

bool wxStaticBitmap::Create(wxWindow *parent, wxWindowID id,
           const wxBitmap& bitmap,
           const wxPoint& pos,
           const wxSize& s,
           long style,
           const wxString& name)
{
    SetName(name);
    wxSize size = s ;
    if ( bitmap.Ok() )
    {
        if ( size.x == -1 )
            size.x = bitmap.GetWidth() ;
        if ( size.y == -1 )
            size.y = bitmap.GetHeight() ;
    }

    m_backgroundColour = parent->GetBackgroundColour() ;
    m_foregroundColour = parent->GetForegroundColour() ;

    m_bitmap = bitmap;
    if ( id == -1 )
          m_windowId = (int)NewControlId();
    else
        m_windowId = id;

    m_windowStyle = style;

    bool ret = wxControl::Create( parent, id, pos, size, style , wxDefaultValidator , name );
    SetBestSize( size ) ;
    
    return ret;
}
开发者ID:HackLinux,项目名称:chandler-1,代码行数:33,代码来源:statbmp.cpp

示例15: OnAddBitmap

bool wxBitmapComboBoxBase::OnAddBitmap(const wxBitmap& bitmap)
{
    if ( bitmap.IsOk() )
    {
        int width = bitmap.GetWidth();
        int height = bitmap.GetHeight();

        if ( m_usedImgSize.x < 0 )
        {
            // If size not yet determined, get it from this image.
            m_usedImgSize.x = width;
            m_usedImgSize.y = height;

            // Adjust control size to vertically fit the bitmap
            wxWindow* ctrl = GetControl();
            ctrl->InvalidateBestSize();
            wxSize newSz = ctrl->GetBestSize();
            wxSize sz = ctrl->GetSize();
            if ( newSz.y > sz.y )
                ctrl->SetSize(sz.x, newSz.y);
            else
                DetermineIndent();
        }

        wxCHECK_MSG( width == m_usedImgSize.x && height == m_usedImgSize.y,
                     false,
                     "you can only add images of same size" );

        return true;
    }

    return false;
}
开发者ID:erwincoumans,项目名称:wxWidgets,代码行数:33,代码来源:bmpcboxcmn.cpp


注:本文中的wxBitmap::GetHeight方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。