Main Site Documentation

DrawImage method


#41

This is how to read files from SD http://docs.ghielectronics.com/software/tinyclr/tutorials/filesystem.html

The Bitmap can be constructed with a stream.

I have not tried this…but please let us know if you do. Note that this will only work with BMP for now (for internal reasons) but will support GIF and JPEG later.

By the way, there is 4MB of QSPI flash that has not been used yet. So one day in the future, you will get an additional 4MB of storage :slight_smile:

var sd = StorageController.FromName(@"GHIElectronics.TinyCLR.NativeApis.STM32F4.SdCardStorageController\0");
var drive = FileSystem.Mount(sd.Hdc);
var file = new FileStream($@"{drive.Name}image.bmp", FileMode.Open);
var bt = new Bitmap(file);

#42

is it an NTSF file system?


#43

Only FAT is supported


#44

Nonetheless, files can be written to the SD from a PC (?)


#45

Of course they can.


#46

there is ‘resource1.GetBitmap’. Is there a getgif ?


#47

Gus told you this earlier::::::

GetBitmap for now.


#48

Actually, get bitmap does not mean BMP. It means create a bitmap object from any supported image format.

What happens when you add a gif and then try to get bitmap on that gif resource?


#49

I added an icon as a gif to resources. It increased the size by about 3200 bytes.
I added the same icon as a bitmap. It increased the size by about 11000 bytes


#50

Most important question - were you able to use the GIF? If so, great, it’ll save you on application space, but it’s still going to be a bitmap internally so once loaded you’re still going to use the same memory


#51

Same RAM, not flash. Just to clarify.


#52

yes, agreed, it’s application execution space that will remain static, even though the deployment space is smaller.


#53

So the flash will be smaller by using a GIF (yes it did work fine). RAM is used during execution, how much RAM is available ? I could be using several icons at a time, if the RAM used is the bmp size then I may still be in trouble (??)


#54

You have a of RAM. I will be very surprised if you use up all the RAM and it will be because you did something wrong.


#55

Mow much RAM ?


#56

The module ships with 32MB of RAM. Your free RAM is probably over 20MB.


#57

Ok, no problem then