Skip to content

Commit b800871

Browse files
authored
Bitmap rename (#5983)
* rename namespace bitmap to bitmaps * fix up namespaces * fix some more * update shims
1 parent 8f79305 commit b800871

File tree

12 files changed

+36
-30
lines changed

12 files changed

+36
-30
lines changed

libs/arcadeshield/_locales/arcadeshield-jsdoc-strings.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"Bitmap.setRows": "Copy row(s) of pixel from buffer to bitmap.",
2121
"Bitmap.transposed": "Returns a transposed bitmap (with X/Y swapped)",
2222
"Bitmap.width": "Get the width of the bitmap",
23-
"bitmap.create": "Create new empty (transparent) bitmap",
24-
"bitmap.doubledIcon": "Double the size of an icon",
25-
"bitmap.ofBuffer": "Create new bitmap with given content"
23+
"bitmaps.create": "Create new empty (transparent) bitmap",
24+
"bitmaps.doubledIcon": "Double the size of an icon",
25+
"bitmaps.ofBuffer": "Create new bitmap with given content"
2626
}
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
2-
"bitmap|block": "bitmap",
2+
"bitmaps|block": "bitmaps",
33
"{id:category}Bitmap": "Bitmap",
4+
"{id:category}Bitmaps": "Bitmaps",
45
"{id:category}__screenhelpers": "__screenhelpers"
56
}

libs/arcadeshield/shims.d.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33

44
declare interface Bitmap {
5+
/**
6+
* Get underlying buffer
7+
*/
8+
//% property shim=BitmapMethods::__buffer
9+
__buffer: Buffer;
10+
511
/**
612
* Get the width of the bitmap
713
*/
@@ -129,24 +135,24 @@ declare interface Bitmap {
129135
//% shim=BitmapMethods::overlapsWith
130136
overlapsWith(other: Bitmap, x: int32, y: int32): boolean;
131137
}
132-
declare namespace bitmap {
138+
declare namespace bitmaps {
133139

134140
/**
135141
* Create new bitmap with given content
136142
*/
137-
//% shim=bitmap::ofBuffer
143+
//% shim=bitmaps::ofBuffer
138144
function ofBuffer(buf: Buffer): Bitmap;
139145

140146
/**
141147
* Create new empty (transparent) bitmap
142148
*/
143-
//% shim=bitmap::create
149+
//% shim=bitmaps::create
144150
function create(width: int32, height: int32): Bitmap;
145151

146152
/**
147153
* Double the size of an icon
148154
*/
149-
//% shim=bitmap::doubledIcon
155+
//% shim=bitmaps::doubledIcon
150156
function doubledIcon(icon: Buffer): Buffer;
151157
}
152158

libs/arcadeshield/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ basic.showNumber(present ? 1 : 0)
66
// set palette before creating screen, which initializes the display
77
__screenhelpers.setPalette(hex`000000ffffffff2121ff93c4ff8135fff609249ca378dc52003fad87f2ff8e2ec4a4839f5c406ce5cdc491463d000000`)
88

9-
const screen = bitmap.create(
9+
const screen = bitmaps.create(
1010
__screenhelpers.displayWidth(),
1111
__screenhelpers.displayHeight()
1212
)

libs/bitmap/_locales/bitmap-jsdoc-strings.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
"Bitmap.setRows": "Copy row(s) of pixel from buffer to bitmap.",
3232
"Bitmap.transposed": "Returns a transposed bitmap (with X/Y swapped)",
3333
"Bitmap.width": "Get the width of the bitmap",
34-
"bitmap.create": "Create new empty (transparent) bitmap",
35-
"bitmap.doubledIcon": "Double the size of an icon",
36-
"bitmap.ofBuffer": "Create new bitmap with given content",
34+
"bitmaps.create": "Create new empty (transparent) bitmap",
35+
"bitmaps.doubledIcon": "Double the size of an icon",
36+
"bitmaps.ofBuffer": "Create new bitmap with given content",
3737
"helpers.imageRotated": "Returns an image rotated by 90, 180, 270 deg clockwise"
3838
}
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
2-
"bitmap|block": "bitmap",
2+
"bitmaps|block": "bitmaps",
33
"helpers|block": "helpers",
44
"{id:category}Bitmap": "Bitmap",
5+
"{id:category}Bitmaps": "Bitmaps",
56
"{id:category}Helpers": "Helpers"
67
}

libs/bitmap/bitmap.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1470,7 +1470,7 @@ void _fillPolygon4(Bitmap_ img, pxt::RefCollection *args) {
14701470

14711471
} // namespace BitmapMethods
14721472

1473-
namespace bitmap {
1473+
namespace bitmaps {
14741474
/**
14751475
* Create new bitmap with given content
14761476
*/
@@ -1480,7 +1480,7 @@ Bitmap_ ofBuffer(Buffer buf) {
14801480
}
14811481
}
14821482

1483-
namespace bitmap {
1483+
namespace bitmaps {
14841484
/**
14851485
* Create new empty (transparent) bitmap
14861486
*/
@@ -1509,7 +1509,7 @@ Buffer doubledIcon(Buffer icon) {
15091509
return t->buffer;
15101510
}
15111511

1512-
} // namespace bitmap
1512+
} // namespace bitmaps
15131513

15141514
// This is 6.5x faster than standard on word-aligned copy
15151515
// probably should move to codal

libs/bitmap/bitmap.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
type color = number
22

3-
namespace bitmap {
3+
namespace bitmaps {
44
export function repeatY(count: number, image: Bitmap) {
55
let arr = [image]
66
while (--count > 0)
@@ -15,7 +15,7 @@ namespace bitmap {
1515
w = Math.max(img.width, w)
1616
h += img.height
1717
}
18-
let r = bitmap.create(w, h)
18+
let r = bitmaps.create(w, h)
1919
let y = 0
2020
for (let img of images) {
2121
let x = (w - img.width) >> 1

libs/bitmap/shims.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,24 +135,24 @@ declare interface Bitmap {
135135
//% shim=BitmapMethods::overlapsWith
136136
overlapsWith(other: Bitmap, x: int32, y: int32): boolean;
137137
}
138-
declare namespace bitmap {
138+
declare namespace bitmaps {
139139

140140
/**
141141
* Create new bitmap with given content
142142
*/
143-
//% shim=bitmap::ofBuffer
143+
//% shim=bitmaps::ofBuffer
144144
function ofBuffer(buf: Buffer): Bitmap;
145145

146146
/**
147147
* Create new empty (transparent) bitmap
148148
*/
149-
//% shim=bitmap::create
149+
//% shim=bitmaps::create
150150
function create(width: int32, height: int32): Bitmap;
151151

152152
/**
153153
* Double the size of an icon
154154
*/
155-
//% shim=bitmap::doubledIcon
155+
//% shim=bitmaps::doubledIcon
156156
function doubledIcon(icon: Buffer): Buffer;
157157
}
158158

libs/fonts/font12.jres

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)