#include "basicDrawingPaintArea.h" pixel::pixel () { this->drawR = 255; this->drawG = 0; this->drawB = 0; this->lineStartX = 0; this->lineStartY = 0; } pixel::~pixel () { } void pixel::draw (HDC hdc, int x, int y) { SetPixel(hdc, x, y, RGB(drawR, drawG, drawB)); } void pixel::drawLine (HDC hdc, int endX, int endY) { HPEN penNow = CreatePen(PS_SOLID, 1, RGB(drawR, drawG, drawB)); //Create pen to draw with //Tell the graphics handler to use the pen just created. It returns the pen it was previously //using. You should store and give that pen back, once the graphics handler has finished HPEN penPrevious = (HPEN)SelectObject(hdc, penNow); MoveToEx(hdc, lineStartX, lineStartY, NULL); LineTo(hdc, endX, endY); SelectObject(hdc, penPrevious); //Give the previous pen back DeleteObject(penNow); //Destroy our pen } void pixel::setDrawColour (int r, int g, int b) { this->drawR = r; this->drawG = g; this->drawB = b; } void pixel::setLineStart (int x, int y) { this->lineStartX = x; this->lineStartY = y; }