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


C++ drawImage函数代码示例

本文整理汇总了C++中drawImage函数的典型用法代码示例。如果您正苦于以下问题:C++ drawImage函数的具体用法?C++ drawImage怎么用?C++ drawImage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: animateLMorph

/* neglectible % of execution time */
static void
animateLMorph(struct state *st)
{
    int i;
    if (st->currGamma > st->maxGamma) {
        st->currGamma = 0.0;
        st->nFrom = st->nTo;
        st->nTo = st->nNext;
        st->aFrom = st->a[st->nFrom];
	st->aTo = st->a[st->nTo];
        do {
            st->nNext = RND(st->numFigs);
        } while (st->nNext == st->nTo);
	st->aNext = st->a[st->nNext];

	st->shift = RND(st->numPoints);
        if (RND(2)) {
            /* reverse the array to get more variation. */
            int    i1, i2;
            XPoint p;
            
            for (i1 = 0, i2 = st->numPoints - 1; i1 < st->numPoints / 2; i1++, i2--) {
                p = st->aNext[i1];
                st->aNext[i1] = st->aNext[i2];
                st->aNext[i2] = p;
            }
        }

	/* calculate the slopes */
	for (i = 0; i < st->numPoints ; i++) {
            st->aSlopeFrom[i].x = st->aSlopeTo[i].x;
            st->aSlopeFrom[i].y = st->aSlopeTo[i].y;
            st->aSlopeTo[i].x = st->aNext[i].x - st->aTo[i].x;
            st->aSlopeTo[i].y = (st->aNext[i].y - st->aTo[i].y);
	}
    }

    createPoints(st);
    drawImage(st);
    st->aPrev = st->aCurr;
    st->aCurr = st->aWork[st->nWork ^= 1];

    st->currGamma += st->deltaGamma;
}
开发者ID:davehorner,项目名称:XScreenSaverWin,代码行数:45,代码来源:lmorph.c

示例2: main

int main(){
   char image[HEIGHT][WIDTH][COLORS];
   char white[COLORS], red[COLORS];
   
   setColor(white, 255, 255, 255);
   setColor(red, 255, 0, 0);

   blankImage(image, white);

   putLine(image, 100, 300, 300, 400, red);
   putLine(image, 300, 400, 200, 150, red);
   putLine(image, 200, 150, 200, 450, red);
   putLine(image, 200, 450, 300, 200, red);
   putLine(image, 300, 200, 100, 300, red);

   drawImage(image);
   
   return 0;
}
开发者ID:shivae,项目名称:CPE101,代码行数:19,代码来源:star.c

示例3: main

int main(int argc, char* args[]) {
    if (!init()) {
        return INIT_FAILED;
    }
    if (!createWindow()) {
        return WINDOW_DRAW_FAILED;
    }
    SDL_Surface* background_image = loadImage("C:/Users/bry/Documents/Visual Studio 2015/Projects/Project1/Project1/x.bmp");
    drawInitialScreen();

    drawImage(background_image);

    gameLoop();

    SDL_DestroyWindow(window);
    SDL_Quit();

    return 0;
}
开发者ID:entropial,项目名称:Tetris,代码行数:19,代码来源:main.cpp

示例4: Fractal

void FractalForm::computeJulia(const Point& center, double zoom, std::size_t imageWidth, std::size_t imageHeight, const Point& computation)
{
  fractal_ = Fractal(center, zoom);
  ImageDraw draw(imageWidth, imageHeight, ColorSchemeFactory::getColorScheme());
  ProgressHandler progress(widget.progressBar);

  Julia algo(computation);
  fractal_.compute(draw, algo, progress);

  progress.setProgress(100);

  drawImage(draw.getImage());
  this->setCenter(fractal_.getCenter())
    ->setZoom(fractal_.getZoom())
    ->setIterations(fractal_.getIterations())
    ->setImageInfo(imageWidth, imageHeight)
    ->setColorScheme(ColorSchemeFactory::getColorScheme().getName())
    ->setTitle(fractal_.getName());
}
开发者ID:ariwez,项目名称:Fractal,代码行数:19,代码来源:FractalForm.cpp

示例5: al

void DesktopWindow::doDraw(DeviceContext *dc)
{
  AutoLock al(&m_bufferLock);
  int fbWidth  = m_framebuffer.getDimension().width;
  int fbHeight = m_framebuffer.getDimension().height;

  if (!fbWidth || !fbHeight) {
    Graphics graphics(dc);

    graphics.fillRect(m_clientArea.left, m_clientArea.top, 
                      m_clientArea.right, m_clientArea.bottom, &m_brush);
    return;
  }

  scrollProcessing(fbWidth, fbHeight);

  int iHorzPos = 0; 
  int iVertPos = 0; 

  if (m_showHorz) { 
    iHorzPos = m_sbar.getHorzPos();
  }

  if (m_showVert) {
    iVertPos = m_sbar.getVertPos();
  }

  m_scManager.setStartPoint(iHorzPos, iVertPos);

  Rect src, dst;
  m_scManager.getSourceRect(&src);
  m_scManager.getDestinationRect(&dst);

  int iWidth = m_clientArea.getWidth() - dst.getWidth();
  int iHeight = m_clientArea.getHeight() - dst.getHeight();

  if (iWidth || iHeight) {
    drawBackground(dc, &m_clientArea.toWindowsRect(), &dst.toWindowsRect());
  }

  drawImage(&src.toWindowsRect(), &dst.toWindowsRect());
}
开发者ID:sim0629,项目名称:tightvnc,代码行数:42,代码来源:DesktopWindow.cpp

示例6: drawBackground

void UIItem::drawSelf(Fw::DrawPane drawPane)
{
    if((drawPane & Fw::ForegroundPane) == 0)
        return;

    // draw style components in order
    if(m_backgroundColor.aF() > Fw::MIN_ALPHA) {
        Rect backgroundDestRect = m_rect;
        backgroundDestRect.expand(-m_borderWidth.top, -m_borderWidth.right, -m_borderWidth.bottom, -m_borderWidth.left);
        drawBackground(m_rect);
    }

    drawImage(m_rect);

    if(m_itemVisible && m_item) {
        Rect drawRect = getPaddingRect();
        Point dest = drawRect.bottomRight() + Point(1,1);

        int exactSize = std::max<int>(32, m_item->getExactSize());
        if(exactSize == 0)
            return;

        float scaleFactor = std::min<float>(drawRect.width() / (float)exactSize, drawRect.height() / (float)exactSize);
        dest += (m_item->getDisplacement() - Point(32,32)) * scaleFactor;

        g_painter->setColor(m_color);
        m_item->draw(dest, scaleFactor, true);

        if(m_font && (m_item->isStackable() || m_item->isChargeable()) && m_item->getCountOrSubType() > 1) {
            std::string count = stdext::to_string(m_item->getCountOrSubType());
            g_painter->setColor(Color(231, 231, 231));
            m_font->drawText(count, Rect(m_rect.topLeft(), m_rect.bottomRight() - Point(3, 0)), Fw::AlignBottomRight);
        }

        if(m_showId)
            m_font->drawText(stdext::to_string(m_item->getServerId()), m_rect, Fw::AlignBottomRight);
    }

    drawBorder(m_rect);
    drawIcon(m_rect);
    drawText(m_rect);
}
开发者ID:DSpeichert,项目名称:otclient,代码行数:42,代码来源:uiitem.cpp

示例7: while

void Graphics::drawImagePattern(Image *image, int x, int y, int w, int h)
{
    int iw = image->getWidth();
    int ih = image->getHeight();
    if (iw == 0 || ih == 0) return;

    int px = 0;                       // X position on pattern plane
    int py = 0;                       // Y position on pattern plane

    while (py < h) {
        while (px < w) {
            int dw = (px + iw >= w) ? w - px : iw;
            int dh = (py + ih >= h) ? h - py : ih;
            drawImage(image, 0, 0, x + px, y + py, dw, dh);
            px += iw;
        }
        py += ih;
        px = 0;
    }
}
开发者ID:igneus,项目名称:particled,代码行数:20,代码来源:graphics.cpp

示例8: loadImage

void KissPictureBox::onRenderPre() {
	loadImage(this->strImageFile);

	if (this->getWidthFit()) {
		this->dZoom = (float)this->getDimensions().w / (float)this->sfImage->w;
		this->dZoom += this->dZoomAdjust;
	}
	else {
		this->rotate_zoom(this->dRotation, 1.0f);

		if (this->bAutoSize) {
			this->calcZoomFactor(this->getDimensions().w, this->getDimensions().h);
			this->dZoom += this->dZoomAdjust;
		}
	}

	this->rotate_zoom(0.0f, this->dZoom);

	drawImage();
}
开发者ID:Ellorion,项目名称:KissSDLF,代码行数:20,代码来源:KissPictureBox.cpp

示例9: borderColor

void KisOpenGLCanvas2::renderCanvasGL()
{
    // Draw the border (that is, clear the whole widget to the border color)
    QColor widgetBackgroundColor = borderColor();
    glClearColor(widgetBackgroundColor.redF(), widgetBackgroundColor.greenF(), widgetBackgroundColor.blueF(), 1.0);
    glClear(GL_COLOR_BUFFER_BIT);

    if (d->displayFilter) {
        d->displayFilter->updateShader();
    }

    if (KisOpenGL::hasOpenGL3()) {
        d->quadVAO.bind();
    }
    drawCheckers();
    drawImage();
    if (KisOpenGL::hasOpenGL3()) {
        d->quadVAO.release();
    }
}
开发者ID:KDE,项目名称:krita,代码行数:20,代码来源:kis_opengl_canvas2.cpp

示例10: drawImage

void GraphicsContext::drawTiledImage(Image& image, const FloatRect& destination, const FloatRect& source, const FloatSize& tileScaleFactor,
    Image::TileRule hRule, Image::TileRule vRule, const ImagePaintingOptions& imagePaintingOptions)
{
    if (paintingDisabled())
        return;

    if (isRecording()) {
        m_displayListRecorder->drawTiledImage(image, destination, source, tileScaleFactor, hRule, vRule, imagePaintingOptions);
        return;
    }

    if (hRule == Image::StretchTile && vRule == Image::StretchTile) {
        // Just do a scale.
        drawImage(image, destination, source, imagePaintingOptions);
        return;
    }

    InterpolationQualityMaintainer interpolationQualityForThisScope(*this, imagePaintingOptions.m_interpolationQuality);
    image.drawTiled(*this, destination, source, tileScaleFactor, hRule, vRule, imagePaintingOptions.m_compositeOperator);
}
开发者ID:caiolima,项目名称:webkit,代码行数:20,代码来源:GraphicsContext.cpp

示例11: ogl_drawImageRegion

static void ogl_drawImageRegion(MAHandle image, const MARect *srcRect, const MAPoint2d *dstPoint, int transformMode) {	
	GLshort textureCoords[] = {
		(srcRect->left), (srcRect->top),
		(srcRect->left + srcRect->width), (srcRect->top),
		(srcRect->left + srcRect->width), (srcRect->top + srcRect->height),
		(srcRect->left), (srcRect->top + srcRect->height)
	};


	GLshort vertexCoords[] = {
		dstPoint->x, dstPoint->y,
		dstPoint->x+srcRect->width, dstPoint->y,
		dstPoint->x+srcRect->width, dstPoint->y+srcRect->height,
		dstPoint->x, dstPoint->y+srcRect->height
	};

	Texture* texture = getTexture(image);	

	drawImage(textureCoords, vertexCoords, texture);
}
开发者ID:AliSayed,项目名称:MoSync,代码行数:20,代码来源:GraphicsOpenGL.c

示例12: drawMedalsMenu

void drawMedalsMenu()
{
	int i;
	SDL_Rect rect;

	drawImage(menu.background, menu.x, menu.y, FALSE, 196);

	rect.x = menu.x + 5;
	rect.y = menu.y + 5;
	rect.w = menu.w;
	rect.h = menu.h;

	SDL_RenderSetClipRect(game.renderer, &rect);

	for (i=0;i<menu.widgetCount;i++)
	{
		drawWidget(menu.widgets[i], &menu, -1);
	}

	SDL_RenderSetClipRect(game.renderer, NULL);
}
开发者ID:riksweeney,项目名称:edgar,代码行数:21,代码来源:medals_menu.c

示例13: ofBackground

//--------------------------------------------------------------
void testApp::setup(){
    ofBackground(0);
    
    #ifdef RETINA_DISPLAY
        scale = 2;
        lineWidth = 2;
        lineLength = 6;
    #else
        scale = 1;
        lineWidth = 1;
        lineLength = 5;
    #endif
    
    screenWidth = ofGetScreenWidth();
    screenHeight = ofGetScreenHeight();
    
    fbo.allocate(screenWidth*scale, screenHeight*scale, GL_RGBA);
    
    drawImage();
    saveImage();
}
开发者ID:miurla,项目名称:DesktopPictureGenerator,代码行数:22,代码来源:testApp.cpp

示例14: XOJ_CHECK_TYPE

void DocumentView::drawElement(cairo_t* cr, Element* e)
{
	XOJ_CHECK_TYPE(DocumentView);

	if (e->getType() == ELEMENT_STROKE)
	{
		drawStroke(cr, (Stroke*) e);
	}
	else if (e->getType() == ELEMENT_TEXT)
	{
		drawText(cr, (Text*) e);
	}
	else if (e->getType() == ELEMENT_IMAGE)
	{
		drawImage(cr, (Image*) e);
	}
	else if (e->getType() == ELEMENT_TEXIMAGE)
	{
		drawTexImage(cr, (TexImage*) e);
	}
}
开发者ID:xournalpp,项目名称:xournalpp,代码行数:21,代码来源:DocumentView.cpp

示例15: getImageFromSelection

void FV_VisualDragText::mouseCut(UT_sint32 x, UT_sint32 y)
{
	getImageFromSelection(x,y);
	bool bPasteTableCol = (m_pView->getSelectionMode() == FV_SelectionMode_TableColumn);

	// flag up on the document level that we are dragging with the mouse
	// (in revisions mode the PT needs to be able to make a distinction between normal
	// cut/delete and the mouse cut)
	m_pView->getDocument()->setVDNDinProgress(true);
	
	if(bPasteTableCol)
	{
		m_pView->cmdCut();
	}
	else
	{
		PT_DocPosition pos1 = m_pView->getSelectionAnchor();
		PT_DocPosition pos2 = m_pView->getPoint();
		if(pos1 > pos2)
		{
			pos2 = m_pView->getSelectionAnchor();
			pos1 = m_pView->getPoint();
		}
		if(m_bSelectedRow)
		{
		    m_pView->copyToLocal(pos1,pos2);
		    m_pView->cmdDeleteRow(pos1+2);
		    m_pView->setSelectionMode(FV_SelectionMode_TableRow);
		}
		else
		{
		    m_pView->copyToLocal(pos1,pos2);
		    m_pView->cmdCharDelete(true,1);
		}
	}
	m_pView->getDocument()->setVDNDinProgress(false);
	
	m_pView->updateScreen(false);
	drawImage();
}
开发者ID:Distrotech,项目名称:abiword,代码行数:40,代码来源:fv_VisualDragText.cpp


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