bool GdiPrintContext::swapBuffer()
{
	//if (!isActivated() || isDrawing()) return false;
	if (isDrawing()) return false;
	if (NULL == memBmp_ || NULL == memDC_ || NULL == printDC_) return false;
	setDrawing(true);

	// copy off-screen buffer to window's DC
#if  1
	// method #1: [use DDB & DIB] the image is not scaled to fit the rectangle
	const bool ret = TRUE == BitBlt(
		printDC_,
		drawRegion_.left, drawRegion_.bottom, drawRegion_.getWidth(), drawRegion_.getHeight(), 
		memDC_,
		0, 0,  //drawRegion_.left, drawRegion_.bottom,
		SRCCOPY
	);
#elif 0
	// method #2: [use DDB & DIB] the image is scaled to fit the rectangle
	// caution:
	// all negative coordinate values are ignored.
	// instead, these values are regarded as absolute(positive) values.
	const bool ret = TRUE == StretchBlt(
		printDC_,
		drawRegion_.left, drawRegion_.bottom, drawRegion_.getWidth(), drawRegion_.getHeight(),
		memDC_,
		//(int)std::floor(viewingRegion_.left + 0.5), (int)std::floor(viewingRegion_.bottom + 0.5), (int)std::floor(viewingRegion_.getWidth() + 0.5), (int)std::floor(viewingRegion_.getHeight() + 0.5),
		0, 0, (int)std::floor(viewingRegion_.getWidth() + 0.5), (int)std::floor(viewingRegion_.getHeight() + 0.5),
		SRCCOPY
	);
#else
	// method #3: [use DIB] the image is scaled to fit the rectangle
	// caution:
	// all negative coordinate values are ignored.
	// instead, these values are regarded as absolute(positive) values.
	const bool ret = TRUE == StretchDIBits(
		printDC_,
		drawRegion_.left, drawRegion_.bottom, drawRegion_.getWidth(), drawRegion_.getHeight(),
		//(int)std::floor(viewingRegion_.left + 0.5), (int)std::floor(viewingRegion_.bottom + 0.5), (int)std::floor(viewingRegion_.getWidth() + 0.5), (int)std::floor(viewingRegion_.getHeight() + 0.5),
		0, 0, (int)std::floor(viewingRegion_.getWidth() + 0.5), (int)std::floor(viewingRegion_.getHeight() + 0.5),
		dibBits_,
		&bmiDIB,
		!isPaletteUsed_ ? DIB_RGB_COLORS : DIB_PAL_COLORS,
		SRCCOPY
	);
#endif

	setDrawing(false);
	return ret;
}
bool WglBitmapBufferedContext::swapBuffer()
{
	//if (!isActivated() || isDrawing()) return false;
	if (isDrawing()) return false;
	if (NULL == memBmp_ || NULL == memDC_ || NULL == hDC_) return false;
	setDrawing(true);

	// copy off-screen buffer to window's DC
	const bool ret = TRUE == BitBlt(
		hDC_,
		drawRegion_.left, drawRegion_.bottom,
		drawRegion_.getWidth(), drawRegion_.getHeight(), 
		memDC_,
		0, 0,  //drawRegion_.left, drawRegion_.bottom,
		SRCCOPY
	);

	setDrawing(false);
	return ret;
}
Exemplo n.º 3
0
void CMainFrame::ajoute_point_triangle_courant(float x, float y)
{
	Triangle * t = getTriangleCourant();
	switch( contexte_dessin.nb_points_definis)
	{
		case 0 : 
		case 1 :
			t->setP(contexte_dessin.nb_points_definis, x, y);
			contexte_dessin.nb_points_definis++;
			break;
		case 2 :
			t->setP(contexte_dessin.nb_points_definis, x, y);
			contexte_dessin.nb_points_definis = 0;
			setDrawing(false);
			ajouter_tri_courant_tab_tri();
			break;
		default :
			std::cout << "erreur : nb de points dans le triangle courant > 3 " << std::endl;
			break;
	}
}
Exemplo n.º 4
0
void Lottery::lotteryDrawing() {
    std::vector<int> lotteryNumbers;
    bool newNumber;
    const int SIZE = lottery->MAXNUMBERS;
    for(int i = 0; i < SIZE; i++) {
        int number;
        do {
            number = (rand() % 49 + 1);
            newNumber = true;
            for(int j = 0; j < i; j++) {
                if(lotteryNumbers[j] == number) {
                    newNumber = false;
                }
            }
        } while (!newNumber);
        lotteryNumbers.push_back(number);
    }
    for(int k = 0; k < lotteryNumbers.size(); k++) {
        std::cout << k + 1 << ". Number = " << lotteryNumbers[k] << std::endl;
    }
    std::cout << std::endl;
    lottery = new Ticket(lotteryNumbers);
    setDrawing(true);
}
Exemplo n.º 5
0
Lottery::Lottery() {
    srand(time(0));
    setDrawing(false);
}
Exemplo n.º 6
0
XlHdrFooterDrawing::~XlHdrFooterDrawing()
{
    setDrawing(NULL, 0);
}