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:
Sat Mar 31 08:40:16 2018 +0000
Revision:
10:08e026240a5f
Parent:
3:e4399b5ceb4b
Minor text update

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 3:e4399b5ceb4b 151 //if (pgm_read_byte(ptr) & (0x80 >> (i % 8))) {
GerritPathuis 3:e4399b5ceb4b 152 if (*(ptr) & (0x80 >> (i % 8))) {
GerritPathuis 1:d27a7e06c233 153 DrawPixel(x + i, y + j, colored);
GerritPathuis 1:d27a7e06c233 154 }
GerritPathuis 1:d27a7e06c233 155 if (i % 8 == 7) {
GerritPathuis 1:d27a7e06c233 156 ptr++;
GerritPathuis 1:d27a7e06c233 157 }
GerritPathuis 1:d27a7e06c233 158 }
GerritPathuis 1:d27a7e06c233 159 if (font->Width % 8 != 0) {
GerritPathuis 1:d27a7e06c233 160 ptr++;
GerritPathuis 1:d27a7e06c233 161 }
GerritPathuis 1:d27a7e06c233 162 }
GerritPathuis 1:d27a7e06c233 163 }
GerritPathuis 0:665e04c85d8d 164
GerritPathuis 1:d27a7e06c233 165 /**
GerritPathuis 1:d27a7e06c233 166 * @brief: this displays a string on the frame buffer but not refresh
GerritPathuis 1:d27a7e06c233 167 */
GerritPathuis 1:d27a7e06c233 168 void Paint::DrawStringAt(int x, int y, const char* text, sFONT* font, int colored) {
GerritPathuis 1:d27a7e06c233 169 const char* p_text = text;
GerritPathuis 1:d27a7e06c233 170 unsigned int counter = 0;
GerritPathuis 1:d27a7e06c233 171 int refcolumn = x;
GerritPathuis 1:d27a7e06c233 172
GerritPathuis 1:d27a7e06c233 173 /* Send the string character by character on EPD */
GerritPathuis 1:d27a7e06c233 174 while (*p_text != 0) {
GerritPathuis 1:d27a7e06c233 175 /* Display one character on EPD */
GerritPathuis 1:d27a7e06c233 176 DrawCharAt(refcolumn, y, *p_text, font, colored);
GerritPathuis 1:d27a7e06c233 177 /* Decrement the column position by 16 */
GerritPathuis 1:d27a7e06c233 178 refcolumn += font->Width;
GerritPathuis 1:d27a7e06c233 179 /* Point on the next character */
GerritPathuis 1:d27a7e06c233 180 p_text++;
GerritPathuis 1:d27a7e06c233 181 counter++;
GerritPathuis 1:d27a7e06c233 182 }
GerritPathuis 1:d27a7e06c233 183 }
GerritPathuis 1:d27a7e06c233 184
GerritPathuis 1:d27a7e06c233 185 /**
GerritPathuis 1:d27a7e06c233 186 * @brief: this draws a line on the frame buffer
GerritPathuis 1:d27a7e06c233 187 */
GerritPathuis 1:d27a7e06c233 188 void Paint::DrawLine(int x0, int y0, int x1, int y1, int colored) {
GerritPathuis 1:d27a7e06c233 189 /* Bresenham algorithm */
GerritPathuis 1:d27a7e06c233 190 int dx = x1 - x0 >= 0 ? x1 - x0 : x0 - x1;
GerritPathuis 1:d27a7e06c233 191 int sx = x0 < x1 ? 1 : -1;
GerritPathuis 1:d27a7e06c233 192 int dy = y1 - y0 <= 0 ? y1 - y0 : y0 - y1;
GerritPathuis 1:d27a7e06c233 193 int sy = y0 < y1 ? 1 : -1;
GerritPathuis 1:d27a7e06c233 194 int err = dx + dy;
GerritPathuis 1:d27a7e06c233 195
GerritPathuis 1:d27a7e06c233 196 while((x0 != x1) && (y0 != y1)) {
GerritPathuis 1:d27a7e06c233 197 DrawPixel(x0, y0 , colored);
GerritPathuis 1:d27a7e06c233 198 if (2 * err >= dy) {
GerritPathuis 1:d27a7e06c233 199 err += dy;
GerritPathuis 1:d27a7e06c233 200 x0 += sx;
GerritPathuis 1:d27a7e06c233 201 }
GerritPathuis 1:d27a7e06c233 202 if (2 * err <= dx) {
GerritPathuis 1:d27a7e06c233 203 err += dx;
GerritPathuis 1:d27a7e06c233 204 y0 += sy;
GerritPathuis 1:d27a7e06c233 205 }
GerritPathuis 1:d27a7e06c233 206 }
GerritPathuis 1:d27a7e06c233 207 }
GerritPathuis 1:d27a7e06c233 208
GerritPathuis 1:d27a7e06c233 209 /**
GerritPathuis 1:d27a7e06c233 210 * @brief: this draws a horizontal line on the frame buffer
GerritPathuis 1:d27a7e06c233 211 */
GerritPathuis 1:d27a7e06c233 212 void Paint::DrawHorizontalLine(int x, int y, int line_width, int colored) {
GerritPathuis 1:d27a7e06c233 213 int i;
GerritPathuis 1:d27a7e06c233 214 for (i = x; i < x + line_width; i++) {
GerritPathuis 1:d27a7e06c233 215 DrawPixel(i, y, colored);
GerritPathuis 1:d27a7e06c233 216 }
GerritPathuis 1:d27a7e06c233 217 }
GerritPathuis 1:d27a7e06c233 218
GerritPathuis 1:d27a7e06c233 219 /**
GerritPathuis 1:d27a7e06c233 220 * @brief: this draws a vertical line on the frame buffer
GerritPathuis 1:d27a7e06c233 221 */
GerritPathuis 1:d27a7e06c233 222 void Paint::DrawVerticalLine(int x, int y, int line_height, int colored) {
GerritPathuis 1:d27a7e06c233 223 int i;
GerritPathuis 1:d27a7e06c233 224 for (i = y; i < y + line_height; i++) {
GerritPathuis 1:d27a7e06c233 225 DrawPixel(x, i, colored);
GerritPathuis 1:d27a7e06c233 226 }
GerritPathuis 1:d27a7e06c233 227 }
GerritPathuis 1:d27a7e06c233 228
GerritPathuis 1:d27a7e06c233 229 /**
GerritPathuis 1:d27a7e06c233 230 * @brief: this draws a rectangle
GerritPathuis 1:d27a7e06c233 231 */
GerritPathuis 1:d27a7e06c233 232 void Paint::DrawRectangle(int x0, int y0, int x1, int y1, int colored) {
GerritPathuis 1:d27a7e06c233 233 int min_x, min_y, max_x, max_y;
GerritPathuis 1:d27a7e06c233 234 min_x = x1 > x0 ? x0 : x1;
GerritPathuis 1:d27a7e06c233 235 max_x = x1 > x0 ? x1 : x0;
GerritPathuis 1:d27a7e06c233 236 min_y = y1 > y0 ? y0 : y1;
GerritPathuis 1:d27a7e06c233 237 max_y = y1 > y0 ? y1 : y0;
GerritPathuis 1:d27a7e06c233 238
GerritPathuis 1:d27a7e06c233 239 DrawHorizontalLine(min_x, min_y, max_x - min_x + 1, colored);
GerritPathuis 1:d27a7e06c233 240 DrawHorizontalLine(min_x, max_y, max_x - min_x + 1, colored);
GerritPathuis 1:d27a7e06c233 241 DrawVerticalLine(min_x, min_y, max_y - min_y + 1, colored);
GerritPathuis 1:d27a7e06c233 242 DrawVerticalLine(max_x, min_y, max_y - min_y + 1, colored);
GerritPathuis 1:d27a7e06c233 243 }
GerritPathuis 1:d27a7e06c233 244
GerritPathuis 1:d27a7e06c233 245 /**
GerritPathuis 1:d27a7e06c233 246 * @brief: this draws a filled rectangle
GerritPathuis 1:d27a7e06c233 247 */
GerritPathuis 1:d27a7e06c233 248 void Paint::DrawFilledRectangle(int x0, int y0, int x1, int y1, int colored) {
GerritPathuis 1:d27a7e06c233 249 int min_x, min_y, max_x, max_y;
GerritPathuis 1:d27a7e06c233 250 int i;
GerritPathuis 1:d27a7e06c233 251 min_x = x1 > x0 ? x0 : x1;
GerritPathuis 1:d27a7e06c233 252 max_x = x1 > x0 ? x1 : x0;
GerritPathuis 1:d27a7e06c233 253 min_y = y1 > y0 ? y0 : y1;
GerritPathuis 1:d27a7e06c233 254 max_y = y1 > y0 ? y1 : y0;
GerritPathuis 1:d27a7e06c233 255
GerritPathuis 1:d27a7e06c233 256 for (i = min_x; i <= max_x; i++) {
GerritPathuis 1:d27a7e06c233 257 DrawVerticalLine(i, min_y, max_y - min_y + 1, colored);
GerritPathuis 1:d27a7e06c233 258 }
GerritPathuis 1:d27a7e06c233 259 }
GerritPathuis 1:d27a7e06c233 260
GerritPathuis 1:d27a7e06c233 261 /**
GerritPathuis 1:d27a7e06c233 262 * @brief: this draws a circle
GerritPathuis 1:d27a7e06c233 263 */
GerritPathuis 1:d27a7e06c233 264 void Paint::DrawCircle(int x, int y, int radius, int colored) {
GerritPathuis 1:d27a7e06c233 265 /* Bresenham algorithm */
GerritPathuis 1:d27a7e06c233 266 int x_pos = -radius;
GerritPathuis 1:d27a7e06c233 267 int y_pos = 0;
GerritPathuis 1:d27a7e06c233 268 int err = 2 - 2 * radius;
GerritPathuis 1:d27a7e06c233 269 int e2;
GerritPathuis 1:d27a7e06c233 270
GerritPathuis 1:d27a7e06c233 271 do {
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 DrawPixel(x - x_pos, y - y_pos, colored);
GerritPathuis 1:d27a7e06c233 276 e2 = err;
GerritPathuis 1:d27a7e06c233 277 if (e2 <= y_pos) {
GerritPathuis 1:d27a7e06c233 278 err += ++y_pos * 2 + 1;
GerritPathuis 1:d27a7e06c233 279 if(-x_pos == y_pos && e2 <= x_pos) {
GerritPathuis 1:d27a7e06c233 280 e2 = 0;
GerritPathuis 1:d27a7e06c233 281 }
GerritPathuis 1:d27a7e06c233 282 }
GerritPathuis 1:d27a7e06c233 283 if (e2 > x_pos) {
GerritPathuis 1:d27a7e06c233 284 err += ++x_pos * 2 + 1;
GerritPathuis 1:d27a7e06c233 285 }
GerritPathuis 1:d27a7e06c233 286 } while (x_pos <= 0);
GerritPathuis 1:d27a7e06c233 287 }
GerritPathuis 1:d27a7e06c233 288
GerritPathuis 1:d27a7e06c233 289 /**
GerritPathuis 1:d27a7e06c233 290 * @brief: this draws a filled circle
GerritPathuis 1:d27a7e06c233 291 */
GerritPathuis 1:d27a7e06c233 292 void Paint::DrawFilledCircle(int x, int y, int radius, int colored) {
GerritPathuis 1:d27a7e06c233 293 /* Bresenham algorithm */
GerritPathuis 1:d27a7e06c233 294 int x_pos = -radius;
GerritPathuis 1:d27a7e06c233 295 int y_pos = 0;
GerritPathuis 1:d27a7e06c233 296 int err = 2 - 2 * radius;
GerritPathuis 1:d27a7e06c233 297 int e2;
GerritPathuis 1:d27a7e06c233 298
GerritPathuis 1:d27a7e06c233 299 do {
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 DrawPixel(x - x_pos, y - y_pos, colored);
GerritPathuis 1:d27a7e06c233 304 DrawHorizontalLine(x + x_pos, y + y_pos, 2 * (-x_pos) + 1, colored);
GerritPathuis 1:d27a7e06c233 305 DrawHorizontalLine(x + x_pos, y - y_pos, 2 * (-x_pos) + 1, colored);
GerritPathuis 1:d27a7e06c233 306 e2 = err;
GerritPathuis 1:d27a7e06c233 307 if (e2 <= y_pos) {
GerritPathuis 1:d27a7e06c233 308 err += ++y_pos * 2 + 1;
GerritPathuis 1:d27a7e06c233 309 if(-x_pos == y_pos && e2 <= x_pos) {
GerritPathuis 1:d27a7e06c233 310 e2 = 0;
GerritPathuis 1:d27a7e06c233 311 }
GerritPathuis 1:d27a7e06c233 312 }
GerritPathuis 1:d27a7e06c233 313 if(e2 > x_pos) {
GerritPathuis 1:d27a7e06c233 314 err += ++x_pos * 2 + 1;
GerritPathuis 1:d27a7e06c233 315 }
GerritPathuis 1:d27a7e06c233 316 } while(x_pos <= 0);
GerritPathuis 1:d27a7e06c233 317 }
GerritPathuis 1:d27a7e06c233 318
GerritPathuis 1:d27a7e06c233 319 /* END OF FILE */
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
GerritPathuis 1:d27a7e06c233 343