In Squeak, if I have the data for a PNG image, how can I put it into an ImageFrameMorph?
Using:
t7 _ (HTTPSocket httpGet: 'http://' , msServer , '/getavatar/' , t1) contents. t8 _ ImageFrameMorph new initFromForm: t7.
does not seem to work.
Offline
I assume it has something to do with PNGReadWriter.
Offline
PNGReadWriter createAFormFrom: t7
assuming you're talking about a PNG... now I forgot what we used.
Offline
I'm now trying this:
t7 _ (HTTPSocket httpGet: 'http://' , msServer , '/getavatar/' , t1) contents. scratchFrame write: t7 toFile: 'test.png'. t8 _ (FileStream readOnlyFileNamed: 'test.png') binary. t9 _ ImageReadWriter formFromStream: t8. t8 close. t10 _ ImageFrameMorph new initFromForm: t9. body addMorph: t10.
but it still doesn't work.
Offline
Trying
t7 _ (HTTPSocket httpGet: 'http://' , msServer , '/getavatar/' , t1) contents. scratchFrame write: t7 toFile: 'test.png'. t8 _ PNGReadWriter createAFormFrom: 'test.png'. t9 _ ImageFrameMorph new initFromForm: t8.
doesn't work either. It says that t8 is of type PNGReadWriter, not of the form type.
Offline
it's right. Take the first value of t8 (t8 first) to get the image.
Also, I don't see why you're writing to a file! createAFormFrom wants a stream (which is actually precisely t7), not a string! The latter will give you a pretty bad image.
Offline
LS97 wrote:
it's right. Take the first value of t8 (t8 first) to get the image.
Also, I don't see why you're writing to a file! createAFormFrom wants a stream (which is actually precisely t7), not a string! The latter will give you a pretty bad image.
…and then stop calling your temporary variables tn.
Offline
nXIII wrote:
LS97 wrote:
it's right. Take the first value of t8 (t8 first) to get the image.
Also, I don't see why you're writing to a file! createAFormFrom wants a stream (which is actually precisely t7), not a string! The latter will give you a pretty bad image.…and then stop calling your temporary variables tn.
Squeak automatically does that. I can't do anything about it.
Offline
jvvg wrote:
nXIII wrote:
LS97 wrote:
it's right. Take the first value of t8 (t8 first) to get the image.
Also, I don't see why you're writing to a file! createAFormFrom wants a stream (which is actually precisely t7), not a string! The latter will give you a pretty bad image.…and then stop calling your temporary variables tn.
Squeak automatically does that. I can't do anything about it.
Squeak automatically does that when you're missing a .changes file, because it has nowhere to put the method sources.
Offline
nXIII wrote:
jvvg wrote:
nXIII wrote:
…and then stop calling your temporary variables tn.Squeak automatically does that. I can't do anything about it.
Squeak automatically does that when you're missing a .changes file, because it has nowhere to put the method sources.
So if I make a .changes file, it won't automatically do that? I'll try that.
Offline