Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweak the docs #85

Merged
merged 2 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/element.toit
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import bitmap show *
import .four-gray as four-gray
import .true-color as true-color
import .gray-scale as gray-scale
import .one-byte as one-byte
import .one-byte_ as one-byte
import .style show *
import .pixel-display
import font show Font
Expand Down
6 changes: 3 additions & 3 deletions src/four-gray.toit
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
// found in the LICENSE file.

/**
Constants useful for $PixelDisplay.four-gray.
Constants useful for $pixel-display.PixelDisplay.four-gray.
For use with e-paper displays with four tones of gray.
*/

import bitmap show *
import font show Font

import .pixel-display
import .two-bit-texture
import .two-bit-texture as two-bit
import .pixel-display as pixel-display
import .two-bit_ as two-bit

/// Color value for use with $PixelDisplay.four-gray.
WHITE ::= 0
Expand Down
8 changes: 6 additions & 2 deletions src/gray-scale.toit
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@
// found in the LICENSE file.

/**
Constants useful for $PixelDisplay.gray-scale.
Constants useful for $pixel-display.PixelDisplay.gray-scale.
These are displays with 8-bit pixels, where each pixel is a gray-scale value
from 0 (black) to 255 (white).
*/

import bitmap show *
import font show Font

import .pixel-display
import .one-byte
import .pixel-display as pixel-display
import .one-byte_

/// Color value for use with $PixelDisplay.gray-scale.
WHITE ::= 255
Expand Down
File renamed without changes.
22 changes: 18 additions & 4 deletions src/pixel-display.toit
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ import .bar-code
import .element
import .two-color as two-color
import .three-color as three-color
import .two-bit-texture as two-bit
import .two-bit_ as two-bit
import .four-gray as four-gray
import .true-color as true-color
import .gray-scale as gray-scale
import .several-color as several-color
import .one-byte as one-byte
import .one-byte_ as one-byte
import .style

FLAG-2-COLOR ::= 0b1
Expand Down Expand Up @@ -749,9 +749,24 @@ abstract class Canvas:
*/
abstract create-similar -> Canvas

/**
Sets all pixels in the canvas to the given color.
For true-color canvases, the color has the form 0xRRGGBB.
For gray-scale canvases, the color has the form 0xGG.
For other canvases types, constants are defined in their respective import
files.
*/
abstract set-all-pixels color/int -> none

/**
Returns true for true-color and gray-scale canvases that support
8-bit drawing methods.
*/
abstract supports-8-bit -> bool

/**
Returns true for gray-scale canvases and two-color black/white canvases.
*/
abstract gray-scale -> bool

/**
Expand Down Expand Up @@ -924,8 +939,7 @@ abstract class Canvas:
descenders or starts with a character like "J" or "/", which in many fonts
extend to the left of their origin.
*/
abstract text x/int y/int --text/string --color/int --font/Font --orientation/int
abstract text x/int y/int --text/string --color/int --font/Font
abstract text x/int y/int --text/string --color/int --font/Font --orientation/int=0

/**
Draws the given bitmap on the canvas.
Expand Down
2 changes: 1 addition & 1 deletion src/several-color.toit
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import bitmap show *
import font show Font
import .one-byte
import .one-byte_
import .two-color as two-color
import .pixel-display

Expand Down
2 changes: 1 addition & 1 deletion src/style.toit
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import bitmap show ORIENTATION-0 ORIENTATION-90 ORIENTATION-180 ORIENTATION-270
import font show Font

import .element as element
import .one-byte as one-byte
import .one-byte_ as one-byte
import .pixel-display

ALIGN-LEFT ::= 0
Expand Down
6 changes: 3 additions & 3 deletions src/three-color.toit
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
// found in the LICENSE file.

/**
Constants useful for $PixelDisplay.three-color.
Constants useful for $pixel-display.PixelDisplay.three-color.
For use with e-paper black, white, and red displays.
*/

import font show Font

import .pixel-display
import .two-bit-texture
import .two-bit-texture as two-bit
import .pixel-display as pixel-display
import .two-bit_ as two-bit

WHITE ::= 0
BLACK ::= 1
Expand Down
6 changes: 5 additions & 1 deletion src/true-color.toit
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@
// found in the LICENSE file.

/**
Functions and constants useful for the RGB $PixelDisplay.true-color display.
Functions and constants useful for the RGB
$pixel-display.PixelDisplay.true-color display.
See for example https://pkg.toit.io/search?query=color-tft
erikcorry marked this conversation as resolved.
Show resolved Hide resolved
*/

import binary show BIG-ENDIAN
import bitmap show *
import font show Font

import .gray-scale as gray-scale_
import .pixel-display
import .pixel-display as pixel-display

/**
Create a 24 bit color from three components in the 0-255 range.
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions src/two-color.toit
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// found in the LICENSE file.

/**
Constants useful for black-and-white $PixelDisplay.two-color.
Constants useful for black-and-white $pixel-display.PixelDisplay.two-color.
For use with e-paper displays and the SSD1306 128x64 display
(driver at https://pkg.toit.io/package/ssd1306&url=github.com%2Ftoitware%2Ftoit-ssd1306&index=latest)
*/
Expand All @@ -12,10 +12,10 @@ import bitmap show *
import font show Font

import .pixel-display
import .pixel-display as pixel-display

WHITE ::= 0
BLACK ::= 1
TRANSPARENT ::= 3

// The canvas contains a bitmapped ByteArray.
// Starts off with/ all pixels white.
Expand Down
4 changes: 2 additions & 2 deletions tests/texture-test-slow.toit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2020 Toitware ApS.
// Copyright (C) 2023 Toitware ApS.
// Use of this source code is governed by a Zero-Clause BSD license that can
// be found in the TESTS_LICENSE file.

Expand All @@ -10,7 +10,7 @@ import font show *

import pixel-display show Transform
import pixel-display.four-gray
import pixel-display.two-bit-texture as two-bit
import pixel-display.two-bit_ as two-bit
import pixel-display.three-color
import pixel-display.true-color
import pixel-display.two-color
Expand Down