You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -83,7 +85,7 @@ class aperturePictureHandler implements FormatHandler {
83
85
image.grayscale();
84
86
constQset=newQuantizeSettings();
85
87
Qset.colors=2;
86
-
Qset.ditherMethod=1;
88
+
Qset.ditherMethod=1;
87
89
image.quantize(Qset);// 2 colors
88
90
89
91
letdata=null// now you're thinking with NoneTypes
@@ -159,9 +161,9 @@ function APFarray(data: Uint8Array): Uint8Array {
159
161
for(constbofdata){
160
162
letuh=0
161
163
if(ispalflipped){
162
-
uh=(1-pal.indexOf(b))*255
164
+
uh=(1-pal.indexOf(b))*255
163
165
}else{
164
-
uh=pal.indexOf(b)*255
166
+
uh=pal.indexOf(b)*255
165
167
}
166
168
temparray.push(uh)
167
169
if(temparray.length===320){
@@ -184,14 +186,17 @@ function encodeAPF(data: Uint8Array): String {
184
186
for(constpofq_data){
185
187
if(p===currun){
186
188
runlen+=1
187
-
if(runlen==94){runlen=0;apf+="~ "}
189
+
if(runlen==94){
190
+
runlen=0;
191
+
apf+="~ "
192
+
}
188
193
}else{
189
-
apf+=String.fromCharCode(runlen+32)
194
+
apf+=String.fromCharCode(runlen+32)
190
195
currun=p
191
196
runlen=1
192
197
}
193
198
}
194
-
apf+=String.fromCharCode(runlen+32);
199
+
apf+=String.fromCharCode(runlen+32);
195
200
returnapf;
196
201
}
197
202
@@ -251,5 +256,4 @@ function bitmapTo1BitBMP( // note i initially used 24-bit BMPs but the filesize
251
256
252
257
exportdefaultaperturePictureHandler;
253
258
254
-
// logical next step is to go from BMP to APF but that is far beyond my level of knowledge. if anyone wants to take a crack at it the original basic code is in the old ARG Wiki at http://portalwiki.asshatter.org/index.php/Aperture_Image_Format.html#GW-Basic_AMF.2FAPF_Viewer_Source
255
259
// if anyone wants to implement basic 1-bit colour, the .amf format is very simple, covered at http://portalwiki.asshatter.org/index.php/Aperture_Menu_Format.html. All you'd need to implement that is to check line 0 is APERTURE MENU FORMAT (c) 1985 and then line 1 is the colour info, comma separated. Idk what the RGB mappings for them are but the number meanings are at https://en.wikibooks.org/wiki/QBasic/Text_Output#Color_by_Number
0 commit comments