E_paper, E_ink, Screen size 1.54", resolution 200x200, 4 wire spi, Waveshare, Black and White, Kl25Z, 8 wire print connector, supply 3.3 Volt, IL0373 Controller, font size is 8, 12, 16 and 24.

Dependencies:   mbed

Committer:
GerritPathuis
Date:
Mon Mar 26 17:20:56 2018 +0000
Revision:
1:d27a7e06c233
Parent:
0:665e04c85d8d
Child:
3:e4399b5ceb4b
Tussenstand

Who changed what in which revision?

UserRevisionLine numberNew contents of line
GerritPathuis 1:d27a7e06c233 1 /**
GerritPathuis 1:d27a7e06c233 2 * @filename : epdpaint.cpp
GerritPathuis 1:d27a7e06c233 3 * @brief : Paint tools
GerritPathuis 1:d27a7e06c233 4 * @author : Yehui from Waveshare
GerritPathuis 1:d27a7e06c233 5 *
GerritPathuis 1:d27a7e06c233 6 * Copyright (C) Waveshare September 9 2017
GerritPathuis 1:d27a7e06c233 7 *
GerritPathuis 1:d27a7e06c233 8 * Permission is hereby granted, free of charge, to any person obtaining a copy
GerritPathuis 1:d27a7e06c233 9 * of this software and associated documnetation files (the "Software"), to deal
GerritPathuis 1:d27a7e06c233 10 * in the Software without restriction, including without limitation the rights
GerritPathuis 1:d27a7e06c233 11 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
GerritPathuis 1:d27a7e06c233 12 * copies of the Software, and to permit persons to whom the Software is
GerritPathuis 1:d27a7e06c233 13 * furished to do so, subject to the following conditions:
GerritPathuis 1:d27a7e06c233 14 *
GerritPathuis 1:d27a7e06c233 15 * The above copyright notice and this permission notice shall be included in
GerritPathuis 1:d27a7e06c233 16 * all copies or substantial portions of the Software.
GerritPathuis 1:d27a7e06c233 17 *
GerritPathuis 1:d27a7e06c233 18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
GerritPathuis 1:d27a7e06c233 19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
GerritPathuis 1:d27a7e06c233 20 * FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
GerritPathuis 1:d27a7e06c233 21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
GerritPathuis 1:d27a7e06c233 22 * LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
GerritPathuis 1:d27a7e06c233 23 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
GerritPathuis 1:d27a7e06c233 24 * THE SOFTWARE.
GerritPathuis 1:d27a7e06c233 25 */
GerritPathuis 1:d27a7e06c233 26
GerritPathuis 1:d27a7e06c233 27 #include "epdpaint.h"
GerritPathuis 1:d27a7e06c233 28
GerritPathuis 1:d27a7e06c233 29 Paint::Paint(unsigned char* image, int width, int height) {
GerritPathuis 1:d27a7e06c233 30 this->rotate = ROTATE_0;
GerritPathuis 1:d27a7e06c233 31 this->image = image;
GerritPathuis 1:d27a7e06c233 32 /* 1 byte = 8 pixels, so the width should be the multiple of 8 */
GerritPathuis 1:d27a7e06c233 33 this->width = width % 8 ? width + 8 - (width % 8) : width;
GerritPathuis 1:d27a7e06c233 34 this->height = height;
GerritPathuis 1:d27a7e06c233 35 }
GerritPathuis 1:d27a7e06c233 36
GerritPathuis 1:d27a7e06c233 37 Paint::~Paint() {
GerritPathuis 1:d27a7e06c233 38 }
GerritPathuis 1:d27a7e06c233 39
GerritPathuis 1:d27a7e06c233 40 /**
GerritPathuis 1:d27a7e06c233 41 * @brief: clear the image
GerritPathuis 1:d27a7e06c233 42 */
GerritPathuis 1:d27a7e06c233 43 void Paint::Clear(int colored) {
GerritPathuis 1:d27a7e06c233 44 for (int x = 0; x < this->width; x++) {
GerritPathuis 1:d27a7e06c233 45 for (int y = 0; y < this->height; y++) {
GerritPathuis 1:d27a7e06c233 46 DrawAbsolutePixel(x, y, colored);
GerritPathuis 1:d27a7e06c233 47 }
GerritPathuis 1:d27a7e06c233 48 }
GerritPathuis 1:d27a7e06c233 49 }
GerritPathuis 1:d27a7e06c233 50
GerritPathuis 1:d27a7e06c233 51 /**
GerritPathuis 1:d27a7e06c233 52 * @brief: this draws a pixel by absolute coordinates.
GerritPathuis 1:d27a7e06c233 53 * this function won't be affected by the rotate parameter.
GerritPathuis 1:d27a7e06c233 54 */
GerritPathuis 1:d27a7e06c233 55 void Paint::DrawAbsolutePixel(int x, int y, int colored) {
GerritPathuis 1:d27a7e06c233 56 if (x < 0 || x >= this->width || y < 0 || y >= this->height) {
GerritPathuis 1:d27a7e06c233 57 return;
GerritPathuis 1:d27a7e06c233 58 }
GerritPathuis 1:d27a7e06c233 59 if (IF_INVERT_COLOR) {
GerritPathuis 1:d27a7e06c233 60 if (colored) {
GerritPathuis 1:d27a7e06c233 61 image[(x + y * this->width) / 8] |= 0x80 >> (x % 8);
GerritPathuis 1:d27a7e06c233 62 } else {
GerritPathuis 1:d27a7e06c233 63 image[(x + y * this->width) / 8] &= ~(0x80 >> (x % 8));
GerritPathuis 1:d27a7e06c233 64 }
GerritPathuis 1:d27a7e06c233 65 } else {
GerritPathuis 1:d27a7e06c233 66 if (colored) {
GerritPathuis 1:d27a7e06c233 67 image[(x + y * this->width) / 8] &= ~(0x80 >> (x % 8));
GerritPathuis 1:d27a7e06c233 68 } else {
GerritPathuis 1:d27a7e06c233 69 image[(x + y * this->width) / 8] |= 0x80 >> (x % 8);
GerritPathuis 1:d27a7e06c233 70 }
GerritPathuis 1:d27a7e06c233 71 }
GerritPathuis 1:d27a7e06c233 72 }
GerritPathuis 1:d27a7e06c233 73
GerritPathuis 1:d27a7e06c233 74 /**
GerritPathuis 1:d27a7e06c233 75 * @brief: Getters and Setters
GerritPathuis 1:d27a7e06c233 76 */
GerritPathuis 1:d27a7e06c233 77 unsigned char* Paint::GetImage(void) {
GerritPathuis 1:d27a7e06c233 78 return this->image;
GerritPathuis 1:d27a7e06c233 79 }
GerritPathuis 1:d27a7e06c233 80
GerritPathuis 1:d27a7e06c233 81 int Paint::GetWidth(void) {
GerritPathuis 1:d27a7e06c233 82 return this->width;
GerritPathuis 1:d27a7e06c233 83 }
GerritPathuis 1:d27a7e06c233 84
GerritPathuis 1:d27a7e06c233 85 void Paint::SetWidth(int width) {
GerritPathuis 1:d27a7e06c233 86 this->width = width % 8 ? width + 8 - (width % 8) : width;
GerritPathuis 1:d27a7e06c233 87 }
GerritPathuis 1:d27a7e06c233 88
GerritPathuis 1:d27a7e06c233 89 int Paint::GetHeight(void) {
GerritPathuis 1:d27a7e06c233 90 return this->height;
GerritPathuis 1:d27a7e06c233 91 }
GerritPathuis 1:d27a7e06c233 92
GerritPathuis 1:d27a7e06c233 93 void Paint::SetHeight(int height) {
GerritPathuis 1:d27a7e06c233 94 this->height = height;
GerritPathuis 1:d27a7e06c233 95 }
GerritPathuis 1:d27a7e06c233 96
GerritPathuis 1:d27a7e06c233 97 int Paint::GetRotate(void) {
GerritPathuis 1:d27a7e06c233 98 return this->rotate;
GerritPathuis 1:d27a7e06c233 99 }
GerritPathuis 1:d27a7e06c233 100
GerritPathuis 1:d27a7e06c233 101 void Paint::SetRotate(int rotate){
GerritPathuis 1:d27a7e06c233 102 this->rotate = rotate;
GerritPathuis 1:d27a7e06c233 103 }
GerritPathuis 1:d27a7e06c233 104
GerritPathuis 1:d27a7e06c233 105 /**
GerritPathuis 1:d27a7e06c233 106 * @brief: this draws a pixel by the coordinates
GerritPathuis 1:d27a7e06c233 107 */
GerritPathuis 1:d27a7e06c233 108 void Paint::DrawPixel(int x, int y, int colored) {
GerritPathuis 1:d27a7e06c233 109 int point_temp;
GerritPathuis 1:d27a7e06c233 110 if (this->rotate == ROTATE_0) {
GerritPathuis 1:d27a7e06c233 111 if(x < 0 || x >= this->width || y < 0 || y >= this->height) {
GerritPathuis 1:d27a7e06c233 112 return;
GerritPathuis 1:d27a7e06c233 113 }
GerritPathuis 1:d27a7e06c233 114 DrawAbsolutePixel(x, y, colored);
GerritPathuis 1:d27a7e06c233 115 } else if (this->rotate == ROTATE_90) {
GerritPathuis 1:d27a7e06c233 116 if(x < 0 || x >= this->height || y < 0 || y >= this->width) {
GerritPathuis 1:d27a7e06c233 117 return;
GerritPathuis 1:d27a7e06c233 118 }
GerritPathuis 1:d27a7e06c233 119 point_temp = x;
GerritPathuis 1:d27a7e06c233 120 x = this->width - y;
GerritPathuis 1:d27a7e06c233 121 y = point_temp;
GerritPathuis 1:d27a7e06c233 122 DrawAbsolutePixel(x, y, colored);
GerritPathuis 1:d27a7e06c233 123 } else if (this->rotate == ROTATE_180) {
GerritPathuis 1:d27a7e06c233 124 if(x < 0 || x >= this->width || y < 0 || y >= this->height) {
GerritPathuis 1:d27a7e06c233 125 return;
GerritPathuis 1:d27a7e06c233 126 }
GerritPathuis 1:d27a7e06c233 127 x = this->width - x;
GerritPathuis 1:d27a7e06c233 128 y = this->height - y;
GerritPathuis 1:d27a7e06c233 129 DrawAbsolutePixel(x, y, colored);
GerritPathuis 1:d27a7e06c233 130 } else if (this->rotate == ROTATE_270) {
GerritPathuis 1:d27a7e06c233 131 if(x < 0 || x >= this->height || y < 0 || y >= this->width) {
GerritPathuis 1:d27a7e06c233 132 return;
GerritPathuis 1:d27a7e06c233 133 }
GerritPathuis 1:d27a7e06c233 134 point_temp = x;
GerritPathuis 1:d27a7e06c233 135 x = y;
GerritPathuis 1:d27a7e06c233 136 y = this->height - point_temp;
GerritPathuis 1:d27a7e06c233 137 DrawAbsolutePixel(x, y, colored);
GerritPathuis 1:d27a7e06c233 138 }
GerritPathuis 1:d27a7e06c233 139 }
GerritPathuis 1:d27a7e06c233 140
GerritPathuis 1:d27a7e06c233 141 /**
GerritPathuis 1:d27a7e06c233 142 * @brief: this draws a charactor on the frame buffer but not refresh
GerritPathuis 1:d27a7e06c233 143 */
GerritPathuis 1:d27a7e06c233 144 void Paint::DrawCharAt(int x, int y, char ascii_char, sFONT* font, int colored) {
GerritPathuis 1:d27a7e06c233 145 int i, j;
GerritPathuis 1:d27a7e06c233 146 unsigned int char_offset = (ascii_char - ' ') * font->Height * (font->Width / 8 + (font->Width % 8 ? 1 : 0));
GerritPathuis 1:d27a7e06c233 147 const unsigned char* ptr = &font->table[char_offset];
GerritPathuis 1:d27a7e06c233 148
GerritPathuis 1:d27a7e06c233 149 for (j = 0; j < font->Height; j++) {
GerritPathuis 1:d27a7e06c233 150 for (i = 0; i < font->Width; i++) {
GerritPathuis 1:d27a7e06c233 151 if (pgm_read_byte(ptr) & (0x80 >> (i % 8))) {
GerritPathuis 1:d27a7e06c233 152 DrawPixel(x + i, y + j, colored);
GerritPathuis 1:d27a7e06c233 153 }
GerritPathuis 1:d27a7e06c233 154 if (i % 8 == 7) {
GerritPathuis 1:d27a7e06c233 155 ptr++;
GerritPathuis 1:d27a7e06c233 156 }
GerritPathuis 1:d27a7e06c233 157 }
GerritPathuis 1:d27a7e06c233 158 if (font->Width % 8 != 0) {
GerritPathuis 1:d27a7e06c233 159 ptr++;
GerritPathuis 1:d27a7e06c233 160 }
GerritPathuis 1:d27a7e06c233 161 }
GerritPathuis 1:d27a7e06c233 162 }
GerritPathuis 0:665e04c85d8d 163
GerritPathuis 1:d27a7e06c233 164 /**
GerritPathuis 1:d27a7e06c233 165 * @brief: this displays a string on the frame buffer but not refresh
GerritPathuis 1:d27a7e06c233 166 */
GerritPathuis 1:d27a7e06c233 167 void Paint::DrawStringAt(int x, int y, const char* text, sFONT* font, int colored) {
GerritPathuis 1:d27a7e06c233 168 const char* p_text = text;
GerritPathuis 1:d27a7e06c233 169 unsigned int counter = 0;
GerritPathuis 1:d27a7e06c233 170 int refcolumn = x;
GerritPathuis 1:d27a7e06c233 171
GerritPathuis 1:d27a7e06c233 172 /* Send the string character by character on EPD */
GerritPathuis 1:d27a7e06c233 173 while (*p_text != 0) {
GerritPathuis 1:d27a7e06c233 174 /* Display one character on EPD */
GerritPathuis 1:d27a7e06c233 175 DrawCharAt(refcolumn, y, *p_text, font, colored);
GerritPathuis 1:d27a7e06c233 176 /* Decrement the column position by 16 */
GerritPathuis 1:d27a7e06c233 177 refcolumn += font->Width;
GerritPathuis 1:d27a7e06c233 178 /* Point on the next character */
GerritPathuis 1:d27a7e06c233 179 p_text++;
GerritPathuis 1:d27a7e06c233 180 counter++;
GerritPathuis 1:d27a7e06c233 181 }
GerritPathuis 1:d27a7e06c233 182 }
GerritPathuis 1:d27a7e06c233 183
GerritPathuis 1:d27a7e06c233 184 /**
GerritPathuis 1:d27a7e06c233 185 * @brief: this draws a line on the frame buffer
GerritPathuis 1:d27a7e06c233 186 */
GerritPathuis 1:d27a7e06c233 187 void Paint::DrawLine(int x0, int y0, int x1, int y1, int colored) {
GerritPathuis 1:d27a7e06c233 188 /* Bresenham algorithm */
GerritPathuis 1:d27a7e06c233 189 int dx = x1 - x0 >= 0 ? x1 - x0 : x0 - x1;
GerritPathuis 1:d27a7e06c233 190 int sx = x0 < x1 ? 1 : -1;
GerritPathuis 1:d27a7e06c233 191 int dy = y1 - y0 <= 0 ? y1 - y0 : y0 - y1;
GerritPathuis 1:d27a7e06c233 192 int sy = y0 < y1 ? 1 : -1;
GerritPathuis 1:d27a7e06c233 193 int err = dx + dy;
GerritPathuis 1:d27a7e06c233 194
GerritPathuis 1:d27a7e06c233 195 while((x0 != x1) && (y0 != y1)) {
GerritPathuis 1:d27a7e06c233 196 DrawPixel(x0, y0 , colored);
GerritPathuis 1:d27a7e06c233 197 if (2 * err >= dy) {
GerritPathuis 1:d27a7e06c233 198 err += dy;
GerritPathuis 1:d27a7e06c233 199 x0 += sx;
GerritPathuis 1:d27a7e06c233 200 }
GerritPathuis 1:d27a7e06c233 201 if (2 * err <= dx) {
GerritPathuis 1:d27a7e06c233 202 err += dx;
GerritPathuis 1:d27a7e06c233 203 y0 += sy;
GerritPathuis 1:d27a7e06c233 204 }
GerritPathuis 1:d27a7e06c233 205 }
GerritPathuis 1:d27a7e06c233 206 }
GerritPathuis 1:d27a7e06c233 207
GerritPathuis 1:d27a7e06c233 208 /**
GerritPathuis 1:d27a7e06c233 209 * @brief: this draws a horizontal line on the frame buffer
GerritPathuis 1:d27a7e06c233 210 */
GerritPathuis 1:d27a7e06c233 211 void Paint::DrawHorizontalLine(int x, int y, int line_width, int colored) {
GerritPathuis 1:d27a7e06c233 212 int i;
GerritPathuis 1:d27a7e06c233 213 for (i = x; i < x + line_width; i++) {
GerritPathuis 1:d27a7e06c233 214 DrawPixel(i, y, colored);
GerritPathuis 1:d27a7e06c233 215 }
GerritPathuis 1:d27a7e06c233 216 }
GerritPathuis 1:d27a7e06c233 217
GerritPathuis 1:d27a7e06c233 218 /**
GerritPathuis 1:d27a7e06c233 219 * @brief: this draws a vertical line on the frame buffer
GerritPathuis 1:d27a7e06c233 220 */
GerritPathuis 1:d27a7e06c233 221 void Paint::DrawVerticalLine(int x, int y, int line_height, int colored) {
GerritPathuis 1:d27a7e06c233 222 int i;
GerritPathuis 1:d27a7e06c233 223 for (i = y; i < y + line_height; i++) {
GerritPathuis 1:d27a7e06c233 224 DrawPixel(x, i, colored);
GerritPathuis 1:d27a7e06c233 225 }
GerritPathuis 1:d27a7e06c233 226 }
GerritPathuis 1:d27a7e06c233 227
GerritPathuis 1:d27a7e06c233 228 /**
GerritPathuis 1:d27a7e06c233 229 * @brief: this draws a rectangle
GerritPathuis 1:d27a7e06c233 230 */
GerritPathuis 1:d27a7e06c233 231 void Paint::DrawRectangle(int x0, int y0, int x1, int y1, int colored) {
GerritPathuis 1:d27a7e06c233 232 int min_x, min_y, max_x, max_y;
GerritPathuis 1:d27a7e06c233 233 min_x = x1 > x0 ? x0 : x1;
GerritPathuis 1:d27a7e06c233 234 max_x = x1 > x0 ? x1 : x0;
GerritPathuis 1:d27a7e06c233 235 min_y = y1 > y0 ? y0 : y1;
GerritPathuis 1:d27a7e06c233 236 max_y = y1 > y0 ? y1 : y0;
GerritPathuis 1:d27a7e06c233 237
GerritPathuis 1:d27a7e06c233 238 DrawHorizontalLine(min_x, min_y, max_x - min_x + 1, colored);
GerritPathuis 1:d27a7e06c233 239 DrawHorizontalLine(min_x, max_y, max_x - min_x + 1, colored);
GerritPathuis 1:d27a7e06c233 240 DrawVerticalLine(min_x, min_y, max_y - min_y + 1, colored);
GerritPathuis 1:d27a7e06c233 241 DrawVerticalLine(max_x, min_y, max_y - min_y + 1, colored);
GerritPathuis 1:d27a7e06c233 242 }
GerritPathuis 1:d27a7e06c233 243
GerritPathuis 1:d27a7e06c233 244 /**
GerritPathuis 1:d27a7e06c233 245 * @brief: this draws a filled rectangle
GerritPathuis 1:d27a7e06c233 246 */
GerritPathuis 1:d27a7e06c233 247 void Paint::DrawFilledRectangle(int x0, int y0, int x1, int y1, int colored) {
GerritPathuis 1:d27a7e06c233 248 int min_x, min_y, max_x, max_y;
GerritPathuis 1:d27a7e06c233 249 int i;
GerritPathuis 1:d27a7e06c233 250 min_x = x1 > x0 ? x0 : x1;
GerritPathuis 1:d27a7e06c233 251 max_x = x1 > x0 ? x1 : x0;
GerritPathuis 1:d27a7e06c233 252 min_y = y1 > y0 ? y0 : y1;
GerritPathuis 1:d27a7e06c233 253 max_y = y1 > y0 ? y1 : y0;
GerritPathuis 1:d27a7e06c233 254
GerritPathuis 1:d27a7e06c233 255 for (i = min_x; i <= max_x; i++) {
GerritPathuis 1:d27a7e06c233 256 DrawVerticalLine(i, min_y, max_y - min_y + 1, colored);
GerritPathuis 1:d27a7e06c233 257 }
GerritPathuis 1:d27a7e06c233 258 }
GerritPathuis 1:d27a7e06c233 259
GerritPathuis 1:d27a7e06c233 260 /**
GerritPathuis 1:d27a7e06c233 261 * @brief: this draws a circle
GerritPathuis 1:d27a7e06c233 262 */
GerritPathuis 1:d27a7e06c233 263 void Paint::DrawCircle(int x, int y, int radius, int colored) {
GerritPathuis 1:d27a7e06c233 264 /* Bresenham algorithm */
GerritPathuis 1:d27a7e06c233 265 int x_pos = -radius;
GerritPathuis 1:d27a7e06c233 266 int y_pos = 0;
GerritPathuis 1:d27a7e06c233 267 int err = 2 - 2 * radius;
GerritPathuis 1:d27a7e06c233 268 int e2;
GerritPathuis 1:d27a7e06c233 269
GerritPathuis 1:d27a7e06c233 270 do {
GerritPathuis 1:d27a7e06c233 271 DrawPixel(x - x_pos, y + y_pos, colored);
GerritPathuis 1:d27a7e06c233 272 DrawPixel(x + x_pos, y + y_pos, colored);
GerritPathuis 1:d27a7e06c233 273 DrawPixel(x + x_pos, y - y_pos, colored);
GerritPathuis 1:d27a7e06c233 274 DrawPixel(x - x_pos, y - y_pos, colored);
GerritPathuis 1:d27a7e06c233 275 e2 = err;
GerritPathuis 1:d27a7e06c233 276 if (e2 <= y_pos) {
GerritPathuis 1:d27a7e06c233 277 err += ++y_pos * 2 + 1;
GerritPathuis 1:d27a7e06c233 278 if(-x_pos == y_pos && e2 <= x_pos) {
GerritPathuis 1:d27a7e06c233 279 e2 = 0;
GerritPathuis 1:d27a7e06c233 280 }
GerritPathuis 1:d27a7e06c233 281 }
GerritPathuis 1:d27a7e06c233 282 if (e2 > x_pos) {
GerritPathuis 1:d27a7e06c233 283 err += ++x_pos * 2 + 1;
GerritPathuis 1:d27a7e06c233 284 }
GerritPathuis 1:d27a7e06c233 285 } while (x_pos <= 0);
GerritPathuis 1:d27a7e06c233 286 }
GerritPathuis 1:d27a7e06c233 287
GerritPathuis 1:d27a7e06c233 288 /**
GerritPathuis 1:d27a7e06c233 289 * @brief: this draws a filled circle
GerritPathuis 1:d27a7e06c233 290 */
GerritPathuis 1:d27a7e06c233 291 void Paint::DrawFilledCircle(int x, int y, int radius, int colored) {
GerritPathuis 1:d27a7e06c233 292 /* Bresenham algorithm */
GerritPathuis 1:d27a7e06c233 293 int x_pos = -radius;
GerritPathuis 1:d27a7e06c233 294 int y_pos = 0;
GerritPathuis 1:d27a7e06c233 295 int err = 2 - 2 * radius;
GerritPathuis 1:d27a7e06c233 296 int e2;
GerritPathuis 1:d27a7e06c233 297
GerritPathuis 1:d27a7e06c233 298 do {
GerritPathuis 1:d27a7e06c233 299 DrawPixel(x - x_pos, y + y_pos, colored);
GerritPathuis 1:d27a7e06c233 300 DrawPixel(x + x_pos, y + y_pos, colored);
GerritPathuis 1:d27a7e06c233 301 DrawPixel(x + x_pos, y - y_pos, colored);
GerritPathuis 1:d27a7e06c233 302 DrawPixel(x - x_pos, y - y_pos, colored);
GerritPathuis 1:d27a7e06c233 303 DrawHorizontalLine(x + x_pos, y + y_pos, 2 * (-x_pos) + 1, colored);
GerritPathuis 1:d27a7e06c233 304 DrawHorizontalLine(x + x_pos, y - y_pos, 2 * (-x_pos) + 1, colored);
GerritPathuis 1:d27a7e06c233 305 e2 = err;
GerritPathuis 1:d27a7e06c233 306 if (e2 <= y_pos) {
GerritPathuis 1:d27a7e06c233 307 err += ++y_pos * 2 + 1;
GerritPathuis 1:d27a7e06c233 308 if(-x_pos == y_pos && e2 <= x_pos) {
GerritPathuis 1:d27a7e06c233 309 e2 = 0;
GerritPathuis 1:d27a7e06c233 310 }
GerritPathuis 1:d27a7e06c233 311 }
GerritPathuis 1:d27a7e06c233 312 if(e2 > x_pos) {
GerritPathuis 1:d27a7e06c233 313 err += ++x_pos * 2 + 1;
GerritPathuis 1:d27a7e06c233 314 }
GerritPathuis 1:d27a7e06c233 315 } while(x_pos <= 0);
GerritPathuis 1:d27a7e06c233 316 }
GerritPathuis 1:d27a7e06c233 317
GerritPathuis 1:d27a7e06c233 318 /* END OF FILE */
GerritPathuis 1:d27a7e06c233 319
GerritPathuis 1:d27a7e06c233 320
GerritPathuis 1:d27a7e06c233 321
GerritPathuis 1:d27a7e06c233 322
GerritPathuis 1:d27a7e06c233 323
GerritPathuis 1:d27a7e06c233 324
GerritPathuis 1:d27a7e06c233 325
GerritPathuis 1:d27a7e06c233 326
GerritPathuis 1:d27a7e06c233 327
GerritPathuis 1:d27a7e06c233 328
GerritPathuis 1:d27a7e06c233 329
GerritPathuis 1:d27a7e06c233 330
GerritPathuis 1:d27a7e06c233 331
GerritPathuis 1:d27a7e06c233 332
GerritPathuis 1:d27a7e06c233 333
GerritPathuis 1:d27a7e06c233 334
GerritPathuis 1:d27a7e06c233 335
GerritPathuis 1:d27a7e06c233 336
GerritPathuis 1:d27a7e06c233 337
GerritPathuis 1:d27a7e06c233 338
GerritPathuis 1:d27a7e06c233 339
GerritPathuis 1:d27a7e06c233 340
GerritPathuis 1:d27a7e06c233 341
GerritPathuis 1:d27a7e06c233 342