PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Simple-Libraries
Learn
Simple Libraries
Display
libsimplegfx
drawPixel.c
1
/*
2
* @file drawPixel.c
3
*
4
* @author Matthew Matz
5
*
6
* @version 0.5
7
*
8
* @copyright Copyright (C) Parallax, Inc. 2019. See end of file for
9
* terms of use (MIT License).
10
*
11
* @brief This is a driver that allows the Propeller Multicore Microcontroller to
12
* draw text, shapes, and bitmap files on various screens and displays.
13
*
14
* @detail This helper-library allows the Propeller Multicore Microcontroller to
15
* draw pixels, lines, circles, recatngles, rounded rectagles, triangles, formatted text
16
* in multiple fonts, bitmap images stored on an SD card on various screens and displays.
17
* At Parallax, we would like to thank Adafruit Industries as parts of this library
18
* were dervied from the Adafruit GFX library for Arduino. Please submit bug reports,
19
* suggestions, and improvements to this code to editor@parallax.com.
20
*
21
* @note If fonts are installed, they occupy EEPROM addresses 40576 to 63359.
22
*/
23
24
25
26
27
#include "simplegfx.h"
28
29
30
void
drawPixel(
screen_t
*dev,
int
x
,
int
y,
int
color) {
31
if
((
x
>= 0) && (
x
< getDisplayWidth(dev)) && (y >= 0) && (y < getDisplayHeight(dev))) {
32
// Pixel is in-bounds. Rotate coordinates if needed.
33
switch
(dev->
rotation
) {
34
case
1:
35
gfx_swap(
x
, y);
36
x
= dev->
width
-
x
- 1;
37
break
;
38
case
2:
39
x
= dev->
width
-
x
- 1;
40
y = dev->
height
- y - 1;
41
break
;
42
case
3:
43
gfx_swap(
x
, y);
44
y = dev->
height
- y - 1;
45
break
;
46
}
47
dev->
deviceDrawPixel
(dev,
x
, y, color);
48
}
49
}
50
51
screen_st::height
int height
Definition:
simplegfx.h:116
screen_st::rotation
int rotation
Definition:
simplegfx.h:119
screen_st::deviceDrawPixel
void(* deviceDrawPixel)(struct screen_st *, int x, int y, int color)
Definition:
simplegfx.h:207
x
int x
Definition:
07 Box and Lines.c:13
screen_st::width
int width
Definition:
simplegfx.h:113
screen_st
Definition:
simplegfx.h:111
Generated on Fri May 20 2022 16:48:04 for PropWare by
1.8.17