本文整理汇总了C++中bmp函数 的典型用法代码示例。如果您正苦于以下问题:C++ bmp函数的具体用法?C++ bmp怎么用?C++ bmp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bmp函数 的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: wxASSERT_MSG
wxRect wxWindow::ScrollNoRefresh(int dx, int dy, const wxRect *rectTotal)
{
wxASSERT_MSG( !dx || !dy, wxT("can't be used for diag scrolling") );
// the rect to refresh (which we will calculate)
wxRect rect;
if ( !dx && !dy )
{
// nothing to do
return rect;
}
// calculate the part of the window which we can just redraw in the new
// location
wxSize sizeTotal = rectTotal ? rectTotal->GetSize() : GetClientSize();
wxLogTrace(wxT("scroll"), wxT("rect is %dx%d, scroll by %d, %d"),
sizeTotal.x, sizeTotal.y, dx, dy);
// the initial and end point of the region we move in client coords
wxPoint ptSource, ptDest;
if ( rectTotal )
{
ptSource = rectTotal->GetPosition();
ptDest = rectTotal->GetPosition();
}
// the size of this region
wxSize size;
size.x = sizeTotal.x - abs(dx);
size.y = sizeTotal.y - abs(dy);
if ( size.x <= 0 || size.y <= 0 )
{
// just redraw everything as nothing of the displayed image will stay
wxLogTrace(wxT("scroll"), wxT("refreshing everything"));
rect = rectTotal ? *rectTotal : wxRect(0, 0, sizeTotal.x, sizeTotal.y);
}
else // move the part which doesn't change to the new location
{
// note that when we scroll the canvas in some direction we move the
// block which doesn't need to be refreshed in the opposite direction
if ( dx < 0 )
{
// scroll to the right, move to the left
ptSource.x -= dx;
}
else
{
// scroll to the left, move to the right
ptDest.x += dx;
}
if ( dy < 0 )
{
// scroll down, move up
ptSource.y -= dy;
}
else
{
// scroll up, move down
ptDest.y += dy;
}
#if wxUSE_CARET
// we need to hide the caret before moving or it will erase itself at
// the wrong (old) location
wxCaret *caret = GetCaret();
if ( caret )
caret->Hide();
#endif // wxUSE_CARET
// do move
wxClientDC dc(this);
wxBitmap bmp(size.x, size.y);
wxMemoryDC dcMem;
dcMem.SelectObject(bmp);
dcMem.Blit(wxPoint(0,0), size, &dc, ptSource
#if defined(__WXGTK__) && !defined(wxHAS_WORKING_GTK_DC_BLIT)
+ GetClientAreaOrigin()
#endif // broken wxGTK wxDC::Blit
);
dc.Blit(ptDest, size, &dcMem, wxPoint(0,0));
wxLogTrace(wxT("scroll"),
wxT("Blit: (%d, %d) of size %dx%d -> (%d, %d)"),
ptSource.x, ptSource.y,
size.x, size.y,
ptDest.x, ptDest.y);
// and now repaint the uncovered area
// FIXME: We repaint the intersection of these rectangles twice - is
// it bad? I don't think so as it is rare to scroll the window
// diagonally anyhow and so adding extra logic to compute
// rectangle intersection is probably not worth the effort
//.........这里部分代码省略.........
开发者ID:chromylei, 项目名称:third_party, 代码行数:101, 代码来源:winuniv.cpp
示例2: tmpRect
void
clAuiDockArt::DrawCaption(wxDC& dc, wxWindow* window, const wxString& text, const wxRect& rect, wxAuiPaneInfo& pane)
{
wxRect tmpRect(wxPoint(0, 0), rect.GetSize());
// Hackishly prevent assertions on linux
if(tmpRect.GetHeight() == 0) tmpRect.SetHeight(1);
if(tmpRect.GetWidth() == 0) tmpRect.SetWidth(1);
#ifdef __WXOSX__
tmpRect = rect;
window->PrepareDC(dc);
// Prepare the colours
wxColour bgColour, penColour, textColour;
textColour = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
bgColour = DrawingUtils::DarkColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE), 2.0);
; // Same as the notebook background colour
penColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW);
penColour = bgColour;
wxFont f = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
dc.SetFont(f);
dc.SetPen(penColour);
dc.SetBrush(bgColour);
dc.DrawRectangle(tmpRect);
// Fill the caption to look like OSX caption
wxColour topColour("#d3d2d3");
wxColour bottomColour("#e8e8e8");
dc.GradientFillLinear(tmpRect, topColour, bottomColour, wxNORTH);
dc.SetPen(penColour);
dc.SetBrush(*wxTRANSPARENT_BRUSH);
dc.DrawRectangle(tmpRect);
int caption_offset = 0;
if(pane.icon.IsOk()) {
DrawIcon(dc, tmpRect, pane);
caption_offset += pane.icon.GetWidth() + 3;
} else {
caption_offset = 3;
}
dc.SetTextForeground(textColour);
wxCoord w, h;
dc.GetTextExtent(wxT("ABCDEFHXfgkj"), &w, &h);
wxRect clip_rect = tmpRect;
clip_rect.width -= 3; // text offset
clip_rect.width -= 2; // button padding
if(pane.HasCloseButton()) clip_rect.width -= m_buttonSize;
if(pane.HasPinButton()) clip_rect.width -= m_buttonSize;
if(pane.HasMaximizeButton()) clip_rect.width -= m_buttonSize;
wxString draw_text = wxAuiChopText(dc, text, clip_rect.width);
wxSize textSize = dc.GetTextExtent(draw_text);
dc.SetTextForeground(textColour);
dc.DrawText(draw_text, tmpRect.x + 3 + caption_offset, tmpRect.y + ((tmpRect.height - textSize.y) / 2));
#else
wxBitmap bmp(tmpRect.GetSize());
{
wxMemoryDC memDc;
memDc.SelectObject(bmp);
wxGCDC gdc;
wxDC* pDC = NULL;
if(!DrawingUtils::GetGCDC(memDc, gdc)) {
pDC = &memDc;
} else {
pDC = &gdc;
}
// Prepare the colours
wxColour bgColour, penColour, textColour;
textColour = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
bgColour = DrawingUtils::DarkColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE), 2.0);
; // Same as the notebook background colour
penColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW);
penColour = bgColour;
wxFont f = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
pDC->SetFont(f);
pDC->SetPen(penColour);
pDC->SetBrush(bgColour);
pDC->DrawRectangle(tmpRect);
pDC->SetPen(penColour);
pDC->SetBrush(*wxTRANSPARENT_BRUSH);
pDC->DrawRectangle(tmpRect);
int caption_offset = 0;
if(pane.icon.IsOk()) {
DrawIcon(gdc, tmpRect, pane);
caption_offset += pane.icon.GetWidth() + 3;
} else {
caption_offset = 3;
}
pDC->SetTextForeground(textColour);
wxCoord w, h;
pDC->GetTextExtent(wxT("ABCDEFHXfgkj"), &w, &h);
//.........这里部分代码省略.........
开发者ID:HelloWangCheng, 项目名称:codelite, 代码行数:101, 代码来源:cl_aui_dock_art.cpp
示例3: get_time_precision
bool FliFormat::onSave(FileOp* fop)
{
Sprite* sprite = fop->document->getSprite();
unsigned char cmap[768];
unsigned char omap[768];
s_fli_header fli_header;
int c, times;
Palette *pal;
/* prepare fli header */
fli_header.filesize = 0;
fli_header.frames = 0;
fli_header.width = sprite->getWidth();
fli_header.height = sprite->getHeight();
if ((fli_header.width == 320) && (fli_header.height == 200))
fli_header.magic = HEADER_FLI;
else
fli_header.magic = HEADER_FLC;
fli_header.depth = 8;
fli_header.flags = 3;
fli_header.speed = get_time_precision(sprite);
fli_header.created = 0;
fli_header.updated = 0;
fli_header.aspect_x = 1;
fli_header.aspect_y = 1;
fli_header.oframe1 = fli_header.oframe2 = 0;
/* open the file to write in binary mode */
FileHandle f(open_file_with_exception(fop->filename, "wb"));
fseek(f, 128, SEEK_SET);
// Create the bitmaps
base::UniquePtr<Image> bmp(Image::create(IMAGE_INDEXED, sprite->getWidth(), sprite->getHeight()));
base::UniquePtr<Image> old(Image::create(IMAGE_INDEXED, sprite->getWidth(), sprite->getHeight()));
// Write frame by frame
for (FrameNumber frpos(0);
frpos < sprite->getTotalFrames();
++frpos) {
/* get color map */
pal = sprite->getPalette(frpos);
for (c=0; c<256; c++) {
cmap[3*c ] = rgba_getr(pal->getEntry(c));
cmap[3*c+1] = rgba_getg(pal->getEntry(c));
cmap[3*c+2] = rgba_getb(pal->getEntry(c));
}
/* render the frame in the bitmap */
clear_image(bmp, 0);
layer_render(sprite->getFolder(), bmp, 0, 0, frpos);
/* how many times this frame should be written to get the same
time that it has in the sprite */
times = sprite->getFrameDuration(frpos) / fli_header.speed;
for (c=0; c<times; c++) {
/* write this frame */
if (frpos == 0 && c == 0)
fli_write_frame(f, &fli_header, NULL, NULL,
(unsigned char *)bmp->getPixelAddress(0, 0), cmap, W_ALL);
else
fli_write_frame(f, &fli_header,
(unsigned char *)old->getPixelAddress(0, 0), omap,
(unsigned char *)bmp->getPixelAddress(0, 0), cmap, W_ALL);
/* update the old image and color-map to the new ones to compare later */
copy_image(old, bmp, 0, 0);
memcpy(omap, cmap, 768);
}
/* update progress */
fop_progress(fop, (float)(frpos.next()) / (float)(sprite->getTotalFrames()));
}
// Write the header and close the file
fli_write_header(f, &fli_header);
return true;
}
开发者ID:CalinLeafshade, 项目名称:aseprite, 代码行数:82, 代码来源:fli_format.cpp
示例4: GraphicsBenchmarkFrame
GraphicsBenchmarkFrame()
: wxFrame(NULL, wxID_ANY, "wxWidgets Graphics Benchmark")
{
SetClientSize(opts.width, opts.height);
#if wxUSE_GLCANVAS
m_glCanvas = NULL;
m_glContext = NULL;
if ( opts.useGL )
{
m_glCanvas = new wxGLCanvas(this, wxID_ANY, NULL,
wxPoint(0, 0),
wxSize(opts.width, opts.height));
m_glContext = new wxGLContext(m_glCanvas);
m_glContext->SetCurrent(*m_glCanvas);
glViewport(0, 0, opts.width, opts.height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1, 1, -1, 1, -1, 1);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
InitializeTexture(opts.width, opts.height);
m_glCanvas->Connect(
wxEVT_PAINT,
wxPaintEventHandler(GraphicsBenchmarkFrame::OnGLRender),
NULL,
this
);
}
else // Not using OpenGL
#endif // wxUSE_GLCANVAS
{
Connect(wxEVT_PAINT,
wxPaintEventHandler(GraphicsBenchmarkFrame::OnPaint));
}
Connect(wxEVT_SIZE, wxSizeEventHandler(GraphicsBenchmarkFrame::OnSize));
m_bitmapARGB.Create(64, 64, 32);
m_bitmapARGB.UseAlpha(true);
m_bitmapRGB.Create(64, 64, 24);
m_renderer = NULL;
if ( opts.useGC )
{
#ifdef __WXMSW__
if ( opts.renderer == GraphicsBenchmarkOptions::GDIPlus )
m_renderer = wxGraphicsRenderer::GetGDIPlusRenderer();
else if ( opts.renderer == GraphicsBenchmarkOptions::Direct2D )
m_renderer = wxGraphicsRenderer::GetDirect2DRenderer();
else if ( opts.renderer == GraphicsBenchmarkOptions::Cairo )
m_renderer = wxGraphicsRenderer::GetCairoRenderer();
// Check if selected renderer is operational.
if ( m_renderer )
{
wxBitmap bmp(16, 16);
wxMemoryDC memDC(bmp);
wxGraphicsContext* gc = m_renderer->CreateContext(memDC);
if ( !gc )
{
wxPrintf("Couldn't initialize '%s' graphics renderer.\n", m_renderer->GetName().c_str());
m_renderer = NULL;
}
delete gc;
}
#endif // __WXMSW__
if( !m_renderer )
m_renderer = wxGraphicsRenderer::GetDefaultRenderer();
}
Show();
}
开发者ID:CodeTickler, 项目名称:wxWidgets, 代码行数:77, 代码来源:graphics.cpp
示例5: dc
void SurfaceImpl::AlphaRectangle(PRectangle rc, int cornerSize,
ColourAllocated fill, int alphaFill,
ColourAllocated outline, int alphaOutline,
int /*flags*/) {
#if wxUSE_GRAPHICS_CONTEXT
wxGCDC dc(*(wxMemoryDC*)hdc);
wxColour penColour(wxColourFromCAandAlpha(outline, alphaOutline));
wxColour brushColour(wxColourFromCAandAlpha(fill, alphaFill));
dc.SetPen(wxPen(penColour));
dc.SetBrush(wxBrush(brushColour));
dc.DrawRoundedRectangle(wxRectFromPRectangle(rc), cornerSize);
return;
#else
#ifdef wxHAVE_RAW_BITMAP
// TODO: do something with cornerSize
wxUnusedVar(cornerSize);
int x, y;
wxRect r = wxRectFromPRectangle(rc);
wxBitmap bmp(r.width, r.height, 32);
wxAlphaPixelData pixData(bmp);
pixData.UseAlpha();
// Set the fill pixels
ColourDesired cdf(fill.AsLong());
int red = cdf.GetRed();
int green = cdf.GetGreen();
int blue = cdf.GetBlue();
wxAlphaPixelData::Iterator p(pixData);
for (y=0; y<r.height; y++) {
p.MoveTo(pixData, 0, y);
for (x=0; x<r.width; x++) {
p.Red() = wxPy_premultiply(red, alphaFill);
p.Green() = wxPy_premultiply(green, alphaFill);
p.Blue() = wxPy_premultiply(blue, alphaFill);
p.Alpha() = alphaFill;
++p;
}
}
// Set the outline pixels
ColourDesired cdo(outline.AsLong());
red = cdo.GetRed();
green = cdo.GetGreen();
blue = cdo.GetBlue();
for (x=0; x<r.width; x++) {
p.MoveTo(pixData, x, 0);
p.Red() = wxPy_premultiply(red, alphaOutline);
p.Green() = wxPy_premultiply(green, alphaOutline);
p.Blue() = wxPy_premultiply(blue, alphaOutline);
p.Alpha() = alphaOutline;
p.MoveTo(pixData, x, r.height-1);
p.Red() = wxPy_premultiply(red, alphaOutline);
p.Green() = wxPy_premultiply(green, alphaOutline);
p.Blue() = wxPy_premultiply(blue, alphaOutline);
p.Alpha() = alphaOutline;
}
for (y=0; y<r.height; y++) {
p.MoveTo(pixData, 0, y);
p.Red() = wxPy_premultiply(red, alphaOutline);
p.Green() = wxPy_premultiply(green, alphaOutline);
p.Blue() = wxPy_premultiply(blue, alphaOutline);
p.Alpha() = alphaOutline;
p.MoveTo(pixData, r.width-1, y);
p.Red() = wxPy_premultiply(red, alphaOutline);
p.Green() = wxPy_premultiply(green, alphaOutline);
p.Blue() = wxPy_premultiply(blue, alphaOutline);
p.Alpha() = alphaOutline;
}
// Draw the bitmap
hdc->DrawBitmap(bmp, r.x, r.y, true);
#else
wxUnusedVar(cornerSize);
wxUnusedVar(alphaFill);
wxUnusedVar(alphaOutline);
RectangleDraw(rc, outline, fill);
#endif
#endif
}
开发者ID:simple-codeblocks, 项目名称:Codeblocks, 代码行数:85, 代码来源:PlatWX.cpp
示例6: BWindow
AboutWindow::AboutWindow(void)
: BWindow(BRect(0.0, 0.0, 420.0, 266.0), "About Vision", B_TITLED_WINDOW,
B_WILL_DRAW | B_NOT_RESIZABLE | B_NOT_ZOOMABLE)
{
/*
* Function purpose: Construct
*/
BRect bounds(Bounds());
BBitmap* bmp(NULL);
fBackground = new BView(bounds, "background", B_FOLLOW_ALL_SIDES, B_WILL_DRAW);
fBackground->SetViewColor(255, 255, 255);
AddChild(fBackground);
if ((bmp = BTranslationUtils::GetBitmap('bits', "vision")) != 0) {
// BRect logo_bounds (bmp->Bounds());
fLogo =
new ClickView(bmp->Bounds().OffsetByCopy(16, 16), "image", B_FOLLOW_LEFT | B_FOLLOW_TOP,
B_WILL_DRAW, "http://vision.sourceforge.net");
fBackground->AddChild(fLogo);
fLogo->SetViewBitmap(bmp);
delete bmp;
bounds.Set(0.0, fLogo->Frame().bottom + 12, Bounds().right, Bounds().bottom);
}
fCredits = new BTextView(bounds, "credits", bounds.OffsetToCopy(B_ORIGIN).InsetByCopy(20, 0),
B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW);
fCredits->MakeSelectable(false);
fCredits->MakeEditable(false);
fCredits->SetStylable(true);
fCredits->SetAlignment(B_ALIGN_CENTER);
fBackground->AddChild(fCredits);
fCreditsText = "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
"Unit A\n[Vision]\n"
"{A-Z}\n"
"Alan Ellis (voidref)\n"
"Rene Gollent (AnEvilYak)\n"
"Todd Lair (tlair)\n"
"Wade Majors (kurros)\n\n\n\n"
"\n\n\n\nUnit B\n[Bowser]\n"
"{A-Z}\n"
"Andrew Bazan (Hiisi)\n"
"Rene Gollent (AnEvilYak)\n"
"Todd Lair (tlair)\n"
"Brian Luft (Electroly)\n"
"Wade Majors (kurros)\n"
"Jamie Wilkinson (project)\n\n\n\n"
"\n\n\n\nBrought to you in part by contributions from\n"
"{A-Z}\n"
"Seth Flaxman (Flax)\n"
"Joshua Jensen\n"
"Gord McLeod (G_McLeod)\n"
"John Robinson ([geo])\n"
"Bjorn Oksholen (GuinnessM)\n"
"Jean-Baptiste M. Quéru (jbq)\n"
"Humdinger\n"
"\n\n\n"
"\n\n\n\nUnit C\n[Support Crew]\n"
"Assistant to Wade Majors: Patches\n"
"Music Supervisor: Baron Arnold\n"
"Assistant to Baron Arnold: Ficus Kirkpatrick\n"
"Stunt Coordinator: Gilligan\n"
"Nude Scenes: Natalie Portman\n"
"Counselors: regurg and helix\n\n\n"
"No animals were injured during the production of this IRC client\n\n\n"
"Soundtrack available on Catastrophe Records\n\n\n\n"
"\n\n\n\nSpecial Thanks\n\n"
"Olathe\n"
"Terminus\n"
"Bob Maple\n"
"Ted Stodgell\n"
"Seth Flaxman\n"
"David Aquilina\n"
"Kurt von Finck\n"
"Kristine Gouveia\n"
"Be, Inc., Menlo Park, CA\n"
"Pizza Hut, Winter Haven, FL (now give me that free pizza Mike)\n\n\n"
"send all complaints and nipple pictures to kaye\n\n\n"
"\n\n\n\n\n"
"\"A human being should be able to change "
"a diaper, plan an invasion, butcher a "
"hog, conn a ship, design a building, "
"write a sonnet, balance accounts, build "
"a wall, set a bone, comfort the dying, "
"take orders, give orders, cooperate, act "
"alone, solve equations, analyze a new "
"problem, pitch manure, program a com"
"puter, cook a tasty meal, fight effi"
"ciently, die gallantly. Specialization "
//.........这里部分代码省略.........
开发者ID:carriercomm, 项目名称:Vision, 代码行数:101, 代码来源:AboutWindow.cpp
示例7: UnRef
bool wxIcon::LoadFile(
const wxString& filename, wxBitmapType type,
int desiredWidth, int desiredHeight )
{
UnRef();
if ( type == wxBITMAP_TYPE_ICON_RESOURCE )
{
OSType theId = 0 ;
if ( filename == wxT("wxICON_INFORMATION") )
{
theId = kAlertNoteIcon ;
}
else if ( filename == wxT("wxICON_QUESTION") )
{
theId = kAlertCautionIcon ;
}
else if ( filename == wxT("wxICON_WARNING") )
{
theId = kAlertCautionIcon ;
}
else if ( filename == wxT("wxICON_ERROR") )
{
theId = kAlertStopIcon ;
}
else
{
#if 0
Str255 theName ;
OSType theType ;
wxMacStringToPascal( name , theName ) ;
Handle resHandle = GetNamedResource( 'cicn' , theName ) ;
if ( resHandle != 0L )
{
GetResInfo( resHandle , &theId , &theType , theName ) ;
ReleaseResource( resHandle ) ;
}
#endif
}
if ( theId != 0 )
{
IconRef iconRef = NULL ;
verify_noerr( GetIconRef( kOnSystemDisk, kSystemIconsCreator, theId, &iconRef ) ) ;
if ( iconRef )
{
m_refData = new wxIconRefData( (WXHICON) iconRef ) ;
return true ;
}
}
return false ;
}
else
{
wxBitmapHandler *handler = wxBitmap::FindHandler( type );
if ( handler )
{
wxBitmap bmp ;
if ( handler->LoadFile( &bmp , filename, type, desiredWidth, desiredHeight ))
{
CopyFromBitmap( bmp ) ;
return true ;
}
return false ;
}
else
{
#if wxUSE_IMAGE
wxImage loadimage( filename, type );
if (loadimage.Ok())
{
if ( desiredWidth == -1 )
desiredWidth = loadimage.GetWidth() ;
if ( desiredHeight == -1 )
desiredHeight = loadimage.GetHeight() ;
if ( desiredWidth != loadimage.GetWidth() || desiredHeight != loadimage.GetHeight() )
loadimage.Rescale( desiredWidth , desiredHeight ) ;
wxBitmap bmp( loadimage );
CopyFromBitmap( bmp ) ;
return true;
}
#endif
}
}
return true ;
}
开发者ID:czxxjtu, 项目名称:wxPython-1, 代码行数:95, 代码来源:icon.cpp
示例8: bmp
wxIcon::wxIcon( const char bits[], int width, int height )
{
wxBitmap bmp( bits, width, height ) ;
CopyFromBitmap( bmp ) ;
}
开发者ID:czxxjtu, 项目名称:wxPython-1, 代码行数:5, 代码来源:icon.cpp
示例9: getPosition
void CtrlImage::draw( OSGraphics &rImage, int xDest, int yDest, int w, int h )
{
const Position *pPos = getPosition();
if( !pPos )
return;
int width = pPos->getWidth();
int height = pPos->getHeight();
if( width <= 0 || height <= 0 )
return;
rect region( pPos->getLeft(), pPos->getTop(),
pPos->getWidth(), pPos->getHeight() );
rect clip( xDest, yDest, w, h );
rect inter;
if( !rect::intersect( region, clip, &inter ) )
return;
if( m_resizeMethod == kScale )
{
// Use scaling method
if( width != m_pImage->getWidth() ||
height != m_pImage->getHeight() )
{
OSFactory *pOsFactory = OSFactory::instance( getIntf() );
// Rescale the image with the actual size of the control
ScaledBitmap bmp( getIntf(), *m_pBitmap, width, height );
delete m_pImage;
m_pImage = pOsFactory->createOSGraphics( width, height );
m_pImage->drawBitmap( bmp, 0, 0 );
}
rImage.drawGraphics( *m_pImage,
inter.x - pPos->getLeft(),
inter.y - pPos->getTop(),
inter.x, inter.y,
inter.width, inter.height );
}
else if( m_resizeMethod == kMosaic )
{
int xDest0 = pPos->getLeft();
int yDest0 = pPos->getTop();
// Use mosaic method
while( width > 0 )
{
int curWidth = __MIN( width, m_pImage->getWidth() );
height = pPos->getHeight();
int curYDest = yDest0;
while( height > 0 )
{
int curHeight = __MIN( height, m_pImage->getHeight() );
rect region1( xDest0, curYDest, curWidth, curHeight );
rect inter1;
if( rect::intersect( region1, clip, &inter1 ) )
{
rImage.drawGraphics( *m_pImage,
inter1.x - region1.x,
inter1.y - region1.y,
inter1.x, inter1.y,
inter1.width, inter1.height );
}
curYDest += curHeight;
height -= m_pImage->getHeight();
}
xDest0 += curWidth;
width -= m_pImage->getWidth();
}
}
else if( m_resizeMethod == kScaleAndRatioPreserved )
{
int w0 = m_pBitmap->getWidth();
int h0 = m_pBitmap->getHeight();
int scaled_height = width * h0 / w0;
int scaled_width = height * w0 / h0;
// new image scaled with aspect ratio preserved
// and centered inside the control boundaries
int w, h;
if( scaled_height > height )
{
w = scaled_width;
h = height;
m_x = ( width - w ) / 2;
m_y = 0;
}
else
{
w = width;
h = scaled_height;
m_x = 0;
m_y = ( height - h ) / 2;
}
// rescale the image if size changed
if( w != m_pImage->getWidth() ||
h != m_pImage->getHeight() )
{
OSFactory *pOsFactory = OSFactory::instance( getIntf() );
ScaledBitmap bmp( getIntf(), *m_pBitmap, w, h );
//.........这里部分代码省略.........
开发者ID:371816210, 项目名称:vlc_vlc, 代码行数:101, 代码来源:ctrl_image.cpp
示例10: bmp
void ImageHelper::SaveJPGImage(const achar* filepath, int32_t width, int32_t height, void* data, bool rev)
{
#if _WIN32
//GDI+を初期化する。
Gdiplus::GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
Gdiplus::GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
{
// bmpを作成する。
Gdiplus::Bitmap bmp(width, height);
auto p = (Color*) data;
for (int32_t y = 0; y < height; y++)
{
for (int32_t x = 0; x < width; x++)
{
if (rev)
{
auto src = p[x + width * (height - 1 - y)];
Gdiplus::Color dst(src.R, src.G, src.B);
bmp.SetPixel(x, y, dst);
}
else
{
auto src = p[x + width * y];
Gdiplus::Color dst(src.R, src.G, src.B);
bmp.SetPixel(x, y, dst);
}
}
}
// 保存
CLSID id;
UINT encoderNum = 0;
UINT encoderSize = 0;
Gdiplus::GetImageEncodersSize(&encoderNum, &encoderSize);
if (encoderSize == 0)
{
Gdiplus::GdiplusShutdown(gdiplusToken);
return;
}
auto imageCodecInfo = (Gdiplus::ImageCodecInfo*) malloc(encoderSize);
Gdiplus::GetImageEncoders(encoderNum, encoderSize, imageCodecInfo);
for (UINT i = 0; i < encoderNum; i++)
{
if (wcscmp(imageCodecInfo[i].MimeType, L"image/jpeg") == 0)
{
id = imageCodecInfo[i].Clsid;
free(imageCodecInfo);
imageCodecInfo = nullptr;
break;
}
}
if (imageCodecInfo != nullptr)
{
free(imageCodecInfo);
return;
}
bmp.Save(filepath, &id);
}
//GDI+を終了する。
Gdiplus::GdiplusShutdown(gdiplusToken);
return;
#else
return;
#endif // _WIN32
}
开发者ID:Pctg-x8, 项目名称:Altseed, 代码行数:74, 代码来源:asd.Graphics_Imp.cpp
示例11: Mouse
//.........这里部分代码省略.........
tool=5;
}
}
gg=help_bar(gg);
mousepos(cl,x5,y5);
while(x5>=6&&x5<=18&&y5>=120&&y5<=134)
{
mousepos(cl,x5,y5);
setcolor(0);
settextstyle(SMALL_FONT,0,4);
gg=1;
outtextxy(45,464,"FILLER");
if(cl==1)
{
tool=6;
}
}
gg=help_bar(gg);
mousepos(cl,x5,y5);
static int v=0;
if(x5>39 && x5<78 && y5>=42 && y5<=55) //save
{
if(cl==1)
{
char f[20];
hidemouse();
SBMP("temp.bmp");
if(op('b'))
{
strcpy(f,s);
if(!strchr(f,'.'))
strcat(f,".bmp");
int check;
check=rename("temp.bmp",f);
if(check==-1)
{
remove(f);
rename("temp.bmp",f);
}
}
if(v==0)
{
if(op('c'))
{
v=1;
if(!strchr(s,'.'))
strcat(s,".cpp");
strcpy(::f,s);
}
else if(bmp("temp.bmp",0,0))
{}
else
bmp(f,0,0);
}
if(bmp(f,0,0));
else
bmp("temp.bmp",0,0);
开发者ID:shvmgyl15, 项目名称:ISPAINT, 代码行数:67, 代码来源:ISPAINT.CPP
示例12: cbMessageBox
dlgAbout::dlgAbout(wxWindow* parent)
{
if (!wxXmlResource::Get()->LoadObject(this, parent, _T("dlgAbout"), _T("wxScrollingDialog")))
{
cbMessageBox(_("There was an error loading the \"About\" dialog from XRC file."),
_("Information"), wxICON_EXCLAMATION);
return;
}
XRCCTRL(*this, "wxID_CANCEL", wxButton)->SetDefault();
const wxString description = _("Welcome to ") + appglobals::AppName + _T(" ") +
appglobals::AppVersion + _T("!\n") + appglobals::AppName +
_(" is a full-featured IDE (Integrated Development Environment) "
"aiming to make the individual developer (and the development team) "
"work in a nice programming environment offering everything he/they "
"would ever need from a program of that kind.\n"
"Its pluggable architecture allows you, the developer, to add "
"any kind of functionality to the core program, through the use of "
"plugins...\n");
wxString file = ConfigManager::ReadDataPath() + _T("/images/splash_1312.png");
wxImage im; im.LoadFile(file, wxBITMAP_TYPE_PNG); im.ConvertAlphaToMask();
wxBitmap bmp(im);
wxMemoryDC dc;
dc.SelectObject(bmp);
cbSplashScreen::DrawReleaseInfo(dc);
wxStaticBitmap *bmpControl = XRCCTRL(*this, "lblTitle", wxStaticBitmap);
bmpControl->SetSize(im.GetWidth(),im.GetHeight());
bmpControl->SetBitmap(bmp);
XRCCTRL(*this, "lblBuildTimestamp", wxStaticText)->SetLabel(wxString(_("Build: ")) + appglobals::AppBuildTimestamp);
XRCCTRL(*this, "txtDescription", wxTextCtrl)->SetValue(description);
XRCCTRL(*this, "txtThanksTo", wxTextCtrl)->SetValue(_(
"Developers:\n"
"--------------\n"
"Yiannis Mandravellos: Developer - Project leader\n"
"Thomas Denk : Developer\n"
"Lieven de Cock : Developer\n"
"\"tiwag\" : Developer\n"
"Martin Halle : Developer\n"
"Biplab Modak : Developer\n"
"Jens Lody : Developer\n"
"Yuchen Deng : Developer\n"
"Teodor Petrov : Developer\n"
"Daniel Anselmi : Developer\n"
"Yuanhui Zhang : Developer\n"
"Damien Moore : Developer\n"
"Micah Ng : Developer\n"
"Ricardo Garcia : All-hands person\n"
"Paul A. Jimenez : Help and AStyle plugins\n"
"Thomas Lorblanches : CodeStat and Profiler plugins\n"
"Bartlomiej Swiecki : wxSmith RAD plugin\n"
"Jerome Antoine : ThreadSearch plugin\n"
"Pecan Heber : Keybinder, BrowseTracker, DragScroll\n"
" CodeSnippets plugins\n"
"Arto Jonsson : CodeSnippets plugin (passed on to Pecan)\n"
"Darius Markauskas : Fortran support\n"
"Mario Cupelli : Compiler support for embedded systems\n"
" User's manual\n"
"Jonas Zinn : Misc. wxSmith AddOns and plugins\n"
"Mirai Computing : cbp2make tool\n"
"Anders F Bjoerklund : wxMac compatibility\n"
"\n"
"Contributors (in no special order):\n"
"-----------------------------------\n"
"Daniel Orb : RPM spec file and packages\n"
"byo,elvstone, me22 : Conversion to Unicode\n"
"pasgui : Providing Ubuntu nightly packages\n"
"Hakki Dogusan : DigitalMars compiler support\n"
"ybx : OpenWatcom compiler support\n"
"Tim Baker : Patches for the direct-compile-mode\n"
" dependencies generation system\n"
"David Perfors : Unicode tester and future documentation writer\n"
"Sylvain Prat : Initial MSVC workspace and project importers\n"
"Chris Raschko : Design of the 3D logo for Code::Blocks\n"
"J.A. Ortega : 3D Icon based on the above\n"
"Alexandr Efremo : Providing OpenSuSe packages\n"
"Huki : Misc. Code-Completion improvements\n"
"stahta01 : Misc. patches for several enhancements\n"
"BlueHazzard : Misc. patches for several enhancements\n"
"\n"
"All contributors that provided patches.\n"
"The wxWidgets project (http://www.wxwidgets.org).\n"
"wxScintilla (http://sourceforge.net/projects/wxscintilla).\n"
"TinyXML parser (http://www.grinninglizard.com/tinyxml).\n"
"Squirrel scripting language (http://www.squirrel-lang.org).\n"
"The GNU Software Foundation (http://www.gnu.org).\n"
"Last, but not least, the open-source community."));
XRCCTRL(*this, "txtLicense", wxTextCtrl)->SetValue(LICENSE_GPL);
XRCCTRL(*this, "lblName", wxStaticText)->SetLabel(appglobals::AppName);
XRCCTRL(*this, "lblVersion", wxStaticText)->SetLabel(appglobals::AppActualVersionVerb);
XRCCTRL(*this, "lblSDK", wxStaticText)->SetLabel(appglobals::AppSDKVersion);
XRCCTRL(*this, "lblAuthor", wxStaticText)->SetLabel(_("The Code::Blocks Team"));
XRCCTRL(*this, "lblEmail", wxStaticText)->SetLabel(appglobals::AppContactEmail);
XRCCTRL(*this, "lblWebsite", wxStaticText)->SetLabel(appglobals::AppUrl);
#ifdef __WXMAC__
//.........这里部分代码省略.........
开发者ID:stahta01, 项目名称:codeblocks_svn2git_https_metadata, 代码行数:101, 代码来源:dlgabout.cpp
示例13: MusicAbstractMoveWidget
MusicRemoteWidget::MusicRemoteWidget(QWidget *parent)
: MusicAbstractMoveWidget(parent)
{
setWindowFlags( windowFlags() | Qt::WindowStaysOnTopHint);
drawWindowShadow(false);
QBitmap bmp(size());
bmp.fill();
QPainter p(&bmp);
p.setPen(Qt::NoPen);
p.setBrush(Qt::black);
p.drawRoundedRect(bmp.rect(), 4, 4);
setMask(bmp);
setMouseTracking(true);
m_showMainWindow = new QPushButton(this);
m_PreSongButton = new QPushButton(this);
m_NextSongButton = new QPushButton(this);
m_PlayButton = new QPushButton(this);
m_SettingButton = new QPushButton(this);
m_mainWidget = new QWidget(this);
m_mainWidget->setObjectName("mainWidget");
m_showMainWindow->setStyleSheet(MusicUIObject::MPushButtonStyle04);
m_showMainWindow->setIcon(QIcon(":/image/windowicon"));
m_PreSongButton->setIcon(QIcon(":/desktopTool/previousP"));
m_NextSongButton->setIcon(QIcon(":/desktopTool/nextP"));
m_PlayButton->setIcon(QIcon(":/desktopTool/play"));
m_SettingButton->setIcon(QIcon(":/desktopTool/setting"));
m_showMainWindow->setToolTip(tr("showMainWindow"));
m_PreSongButton->setToolTip(tr("Privious"));
m_NextSongButton->setToolTip(tr("Next"));
m_PlayButton->setToolTip(tr("Play"));
m_SettingButton->setToolTip(tr("showSetting"));
m_showMainWindow->setCursor(QCursor(Qt::PointingHandCursor));
m_PreSongButton->setCursor(QCursor(Qt::PointingHandCursor));
m_NextSongButton->setCursor(QCursor(Qt::PointingHandCursor));
m_PlayButton->setCursor(QCursor(Qt::PointingHandCursor));
m_SettingButton->setCursor(QCursor(Qt::PointingHandCursor));
connect(m_showMainWindow, SIGNAL(clicked()), SIGNAL(musicWindowSignal()));
connect(m_PlayButton, SIGNAL(clicked()), SIGNAL(musicKeySignal()));
connect(m_PreSongButton, SIGNAL(clicked()), SIGNAL(musicPlayPriviousSignal()));
connect(m_NextSongButton, SIGNAL(clicked()), SIGNAL(musicPlayNextSignal()));
connect(m_SettingButton, SIGNAL(clicked()), SIGNAL(musicSettingSignal()));
m_volumeWidget = new QWidget(m_mainWidget);
QHBoxLayout *volumnLayout = new QHBoxLayout(m_volumeWidget);
volumnLayout->setContentsMargins(0, 0, 0, 0);
volumnLayout->setSpacing(1);
m_volumeLabel = new QLabel(m_volumeWidget);
m_volumeLabel->setStyleSheet(MusicUIObject::MCustomStyle26);
m_volumeLabel->setFixedSize(QSize(20, 20));
m_volumeSlider = new QSlider(Qt::Horizontal, m_volumeWidget);
m_volumeSlider->setRange(0, 100);
m_volumeSlider->setStyleSheet(MusicUIObject::MSliderStyle04);
m_volumeSlider->setFixedWidth(45);
volumnLayout->addWidget(m_volumeLabel);
volumnLayout->addWidget(m_volumeSlider);
m_volumeSlider->setCursor(QCursor(Qt::PointingHandCursor));
connect(m_volumeSlider, SIGNAL(valueChanged(int)), SLOT(musicVolumeChanged(int)));
}
开发者ID:chenpusn, 项目名称:Musicplayer, 代码行数:62, 代码来源:musicremotewidget.cpp
示例14: SetBackgroundColours
void SetBackgroundColours(wxColour colStart, wxColour colEnd)
{
if ( !colStart.IsOk() )
{
// Determine the best colour(s) to use on our own.
#ifdef __WXMSW__
wxUxThemeEngine* const theme = GetTooltipTheme();
if ( theme )
{
wxUxThemeHandle hTheme(GetParent(), L"TOOLTIP");
COLORREF c1, c2;
if ( FAILED(theme->GetThemeColor
(
hTheme,
TTP_BALLOONTITLE,
0,
TMT_GRADIENTCOLOR1,
&c1
)) ||
FAILED(theme->GetThemeColor
(
hTheme,
TTP_BALLOONTITLE,
0,
TMT_GRADIENTCOLOR2,
&c2
)) )
{
c1 = 0xffffff;
c2 = 0xf0e5e4;
}
colStart = wxRGBToColour(c1);
colEnd = wxRGBToColour(c2);
}
else
#endif // __WXMSW__
{
colStart = wxSystemSettings::GetColour(wxSYS_COLOUR_INFOBK);
}
}
if ( colEnd.IsOk() )
{
// Use gradient-filled background bitmap.
const wxSize size = GetClientSize();
wxBitmap bmp(size);
{
wxMemoryDC dc(bmp);
dc.Clear();
dc.GradientFillLinear(size, colStart, colEnd, wxDOWN);
}
SetBackgroundBitmap(bmp);
}
else // Use solid colour.
{
SetBackgroundColour(colStart);
}
}
开发者ID:iokto, 项目名称:newton-dynamics, 代码行数:61, 代码来源:richtooltipg.cpp
示例15: getPosition
void CtrlList::makeImage()
{
if( m_pImage )
{
delete m_pImage;
}
// Get the size of the control
const Position *pPos = getPosition();
if( !pPos )
{
return;
}
int width = pPos->getWidth();
int height = pPos->getHeight();
int itemHeight = m_rFont.getSize() + LINE_INTERVAL;
// Create an image
OSFactory *pOsFactory = OSFactory::instance( getIntf() );
m_pImage = pOsFactory->createOSGraphics( width, height );
VarList::ConstIterator it = m_rList[m_lastPos];
// Draw the background
if( m_pBitmap )
{
// A background bitmap is given, so we scale it, ignoring the
// background colors
ScaledBitmap bmp( getIntf(), *m_pBitmap, width, height );
m_pImage->drawBitmap( bmp, 0, 0 );
// Take care of the selection color
for( int yPos = 0; yPos < height; yPos += itemHeight )
{
int rectHeight = __MIN( itemHeight, height - yPos );
if( it != m_rList.end() )
{
if( (*it).m_selected )
{
m_pImage->fillRect( 0, yPos, width, rectHeight,
m_selColor );
}
it++;
}
}
}
else
{
// No background bitmap, so use the 2 background colors
// Current background color
uint32_t bgColor = m_bgColor1;
for( int yPos = 0; yPos < height; yPos += itemHeight )
{
int rectHeight = __MIN( itemHeight, height - yPos );
if( it != m_rList.end() )
{
uint32_t color = ( (*it).m_selected ? m_selColor : bgColor );
m_pImage->fillRect( 0, yPos, width, rectHeight, color );
it++;
}
else
{
m_pImage->fillRect( 0, yPos, width, rectHeight, bgColor );
}
// Flip the background color
bgColor = ( bgColor == m_bgColor1 ? m_bgColor2 : m_bgColor1 );
}
}
// Draw the items
int yPos = 0;
for( it = m_rList[m_lastPos]; it != m_rList.end() && yPos < height; it++ )
{
UString *pStr = (UString*)(it->m_cString.get());
uint32_t color = ( it->m_playing ? m_playColor : m_fgColor );
// Draw the text
GenericBitmap *pText = m_rFont.drawString( *pStr, color, width );
if( !pText )
{
return;
}
yPos += itemHeight - pText->getHeight();
int ySrc = 0;
if( yPos < 0 )
{
ySrc = - yPos;
yPos = 0;
}
int lineHeight = __MIN( pText->getHeight() - ySrc, height - yPos );
m_pImage->drawBitmap( *pText, 0, ySrc, 0, yPos, pText->getWidth(),
lineHeight, true );
yPos += (pText->getHeight() - ySrc );
delete pText;
}
}
开发者ID:Kafay, 项目名称:vlc, 代码行数:97, 代码来源:ctrl_list.cpp
六六分期app的软件客服如何联系?不知道吗?加qq群【895510560】即可!标题:六六分期
阅读:18151| 2023-10-27
今天小编告诉大家如何处理win10系统火狐flash插件总是崩溃的问题,可能很多用户都不知
阅读:9635| 2022-11-06
今天小编告诉大家如何对win10系统删除桌面回收站图标进行设置,可能很多用户都不知道
阅读:8161| 2022-11-06
今天小编告诉大家如何对win10系统电脑设置节能降温的设置方法,想必大家都遇到过需要
阅读:8538| 2022-11-06
我们在使用xp系统的过程中,经常需要对xp系统无线网络安装向导设置进行设置,可能很多
阅读:8440| 2022-11-06
今天小编告诉大家如何处理win7系统玩cf老是与主机连接不稳定的问题,可能很多用户都不
阅读:9360| 2022-11-06
电脑对日常生活的重要性小编就不多说了,可是一旦碰到win7系统设置cf烟雾头的问题,很
阅读:8410| 2022-11-06
我们在日常使用电脑的时候,有的小伙伴们可能在打开应用的时候会遇见提示应用程序无法
阅读:7848| 2022-11-06
今天小编告诉大家如何对win7系统打开vcf文件进行设置,可能很多用户都不知道怎么对win
阅读:8395| 2022-11-06
今天小编告诉大家如何对win10系统s4开启USB调试模式进行设置,可能很多用户都不知道怎
阅读:7387| 2022-11-06
请发表评论