• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ drawImage函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: drawImage

bool OpenGLGraphics::drawRescaledImage(Image *image, int srcX, int srcY,
                                       int dstX, int dstY,
                                       int width, int height,
                                       int desiredWidth, int desiredHeight,
                                       bool useColor)
{
    if (!image)
        return false;

    // Just draw the image normally when no resizing is necessary,
    if (width == desiredWidth && height == desiredHeight)
    {
        return drawImage(image, srcX, srcY, dstX, dstY,
                         width, height, useColor);
    }

    srcX += image->mBounds.x;
    srcY += image->mBounds.y;

    if (!useColor)
        glColor4f(1.0f, 1.0f, 1.0f, image->mAlpha);

    bindTexture(Image::mTextureType, image->mGLImage);

    setTexturingAndBlending(true);

    // Draw a textured quad.
    drawRescaledQuad(image, srcX, srcY, dstX, dstY, width, height,
                     desiredWidth, desiredHeight);

    if (!useColor)
    {
        glColor4ub(static_cast<GLubyte>(mColor.r),
                   static_cast<GLubyte>(mColor.g),
                   static_cast<GLubyte>(mColor.b),
                   static_cast<GLubyte>(mColor.a));
    }

    return true;
}
开发者ID:Ablu,项目名称:mana,代码行数:40,代码来源:openglgraphics.cpp


示例17: CV_RGB

void Draw::drawTexts(const Mat& src, Text*& text1, Text*& text2)
{
    Mat dst1 = src.clone();
    Mat dst2 = src.clone();
    
    Scalar red = CV_RGB(BRIGHTNESS,0,0);
    Scalar blue = CV_RGB(0,0,BRIGHTNESS);
    
    Point2f rect_points1[4], rect_points2[4];
    text1->rotatedRect.points( rect_points1);
    text2->rotatedRect.points( rect_points2);
    for( int j = 0; j < 4; j++ ) {
        line( dst1, rect_points1[j], rect_points1[(j+1)%4], red, 1, 8 );
        line( dst2, rect_points2[j], rect_points2[(j+1)%4], red, 1, 8 );
    }
    
    for (int j = 0; j < text1->objects.size(); j++) {
        if (j == 0) circle(dst1, text1->objects[j]->centroid, 3, red, 3);
        else if (j == text1->focusedIndex) circle(dst1, text1->objects[j]->centroid, 3, blue);
        else circle(dst1, text1->objects[j]->centroid, 3, red);
        
        if (text1->originIndexes[j] >= 0) {
            line(dst1, text1->objects[j]->centroid,
                 text1->objects[text1->originIndexes[j]]->centroid, red);
        }
    }
    
    for (int j = 0; j < text2->objects.size(); j++) {
        if (j == 0) circle(dst2, text2->objects[j]->centroid, 3, red, 3);
        else if (j == text2->focusedIndex) circle(dst2, text2->objects[j]->centroid, 3, blue);
        else circle(dst2, text2->objects[j]->centroid, 3, red);
        
        if (text2->originIndexes[j] >= 0) {
            line(dst2, text2->objects[j]->centroid,
                 text2->objects[text2->originIndexes[j]]->centroid, red);
        }
    }
    
    drawImage(dst1, dst2);
}
开发者ID:baba5246,项目名称:ActiveLearner,代码行数:40,代码来源:Draw.cpp


示例18: decodeProgressiveModeBitApproximation

void decodeProgressiveModeBitApproximation(TwoByte* st, TwoByte offset){
	int h = workingImage.getHeight();
	int w = workingImage.getWidth();
										
	Byte* imgd = workingImage.getImageData();
	unsigned int q = 1<<quantizationLevel;

	TwoByte* tblock = new TwoByte[192];
	Byte* idctblock = new Byte[192];

	for(int y = 0; y < h; y+=8){
		for(int x = 0; x < w; x+=8){
			for(int yy= 0; yy < 8; yy++){
				for(int xx = 0; xx < 8; xx++){
					int src = ((y + yy)*w + (x + xx))*3;
					int dest = (yy*8 + xx)*3;
					tblock[dest] = (st[src]-offset)*q;
					tblock[dest + 1] = (st[src + 1]-offset)*q;  
					tblock[dest + 2] = (st[src + 2]-offset)*q;  
				}
			}

			doIDCT(tblock, idctblock);
			
			for(int yy= 0; yy < 8; yy++){
				for(int xx = 0; xx < 8; xx++){
					int dest = ((y + yy)*w + (x + xx))*3;
					int src = (yy*8 + xx)*3;
					imgd[dest]  = idctblock[src];					
					imgd[dest + 1] = idctblock[src + 1];					
					imgd[dest + 2] = idctblock[src + 2];  					
				}
			}
		}
	}
		
	delete[] tblock;
	delete[] idctblock;
	drawImage(&workingImage, nextStart);		
}
开发者ID:atulkum,项目名称:imageProcessing,代码行数:40,代码来源:Image.cpp


示例19: gameOver

void gameOver(Outcome outcome, int score) {
    char* s = "";
    char buffer[39];
    switch (outcome) {
        case WIN:
            s = "You win! :D";
            break;
        case LOSE:
            s = "You lost. :(";
            break;
    }
    sprintf(buffer, "Score: %d", score);
    waitForVblank();
    drawImage(EnemyFleet);
    waitForVblank();
    drawString(30, 10, "GAME OVER", RED);
    drawString(50, 10, s, YELLOW);
    drawString(70, 10, buffer, YELLOW);
    drawString(90, 10, "Press Start to play again.", YELLOW);
    while (!KEY_DOWN_NOW(BUTTON_START));
    while (KEY_DOWN_NOW(BUTTON_START));
}
开发者ID:dong-brian,项目名称:2048Plus,代码行数:22,代码来源:game.c


示例20: WindowF

LRESULT CALLBACK WindowF(HWND hwnd, UINT message, WPARAM wParam,
                         LPARAM lParam)
{
    HDC hdc;
    PAINTSTRUCT ps;
    int x, y;

    switch (message)
    {
    case WM_CREATE:
        hdc = GetDC(hwnd);
        initialize(hwnd, hdc);
        ReleaseDC(hwnd, hdc);
        break;

    case WM_COMMAND:
        processCommand(LOWORD(wParam), hwnd);
        break;

    case WM_LBUTTONDOWN:
        x = LOWORD(lParam);
        y = HIWORD(lParam);
        processLeftButtonDown(hwnd, x, y);
        break;

    case WM_PAINT:
        hdc = BeginPaint(hwnd, &ps);
        drawImage(hdc);
        EndPaint(hwnd, &ps);
        break;

    case WM_DESTROY:
        cleanup();
        PostQuitMessage(0);
        break;
    }
    // Call the default window handler
    return DefWindowProc(hwnd, message, wParam, lParam);
}
开发者ID:dinesh1994,项目名称:GraphicsLab,代码行数:39,代码来源:Hyperbola.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ drawItem函数代码示例发布时间:2022-05-30
下一篇:
C++ drawGrid函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap