News:

;) This forum is the property of Proton software developers

Main Menu

www.picgraphic.com

Started by trastikata, Nov 12, 2024, 10:44 PM

Previous topic - Next topic

Fanie

Impressive, well done Dyanko !

I will later look at what and how you did.
The Chinese allow one to upload JPG images you create beforehand to their displays, the buttons and active controls (ie knobs/slides/meters) are then imposed on that.  It then looks very impressive while the processor actually only react to the inputs and output to indicators/meters/graphs.

trastikata

Hi Bob,

QuoteI have installed it in the Library folder C:\Users\Bob\PDS\Library\TftLib which seems to work

I didn't know it would work too if placed there, but every day we learn.

QuoteIn the fonts example you have used PortC.5 for both MISO & MOSI, is this correct or does it matter if I declare separate pins.

It really depends from display to display, some displays have separate MISO and MOSI lines, others have one bi-directional line for both data-in and out. Some don't allow at all reading from the graphic driver IC. But if you are not planning on using sprites or overlay effects, then you don't need to read from display RAM.

QuoteI have cut most of the fonts out as it would not fit in the 18F25K20, in my first project I will only be using numbers so is there a way of only including numbers to save space or does it have to have the whole character set.


You can use any number of fonts or not all, standard size fonts are about hundred, in BDF fonts you have maybe thousand or more to chose from. But you have to convert and crop the unnecessary glyphs. One thing - BDF fonts can not be scaled, therefore you need to convert them to the size you need, more information here:
https://picgraphic.com/TftLibrary2/Ttf_Bdf_Flashexe.html
https://picgraphic.com/TftLibrary2/BDF.html

QuoteOne suggestion for the site, I copied and pasted the Fonts example and it added extra lines in between the others when I pasted it. I wonder if the examples could be added to the downloads section or am I looking in the wrong place.

The site does add new lines between code, but why I don't know. As for the downloading code examples - it is my fault, I messed up the download link code.

At the top of the example page there is a download link, but you need to copy the link and remove the "file:///" string in front of it. Like this:

file:///https://picgraphic.com/TftLibrary2/lib/DemoFonts.rar

becomes

https://picgraphic.com/TftLibrary2/lib/DemoFonts.rar

trastikata

Quote from: Fanie on Jun 08, 2026, 08:53 AMThe Chinese allow one to upload JPG images you create beforehand to their displays, the buttons and active controls (ie knobs/slides/meters) are then imposed on that. 

Thank you Fanie.

Some of the display modules, they are true "TFT display modules" which have built in FLASH memory or graphic processor like LT7680A.

I am using only inexpensive 5$-15$ displays and this is why I have section in the library allowing the user to install FLASH memory which can use hundreds of backgrounds, buttons etc and using the FLASH memory is really fast and the code is optimized for data transfer from FLASH to TFT displays.

Anyway, I plan to add support for SRAM as a frame buffer and the new 4MBit chips from MC are ideal for this since they even allow 320x480 full frame buffer with about 40% of the SRAM left for sprite buffers, which is huge compared to the tiny RAM in PICs. Those buffers can make some very nice visual effects.

But this is for future, first I have to finish (almost done) the EPD section and then back to the TFT ... nevertheless, don't forget this is my hobby project, so no time-frame or deadline guarantee.  :)

D.

trastikata

#103
Some update,

it is the end of my current real work shift, so I get more free time to work on things I like.

I'm expanding and testing the new features of the TFT Library, here's a demo of the SD Card section handling multiple SD Card drive volumes. Currently the Library supports only one or rather the main drive volume. Now it has been expanded to support up to 8 card drive volumes - primary and logical. You can list and set any volume as the currently active.

In this demo:

- SD card is partitioned to 3 Primary and 3 Logical volumes
- The library gets the number of volumes
- Lists the volume names by their number
- Sets each of them as currently active
- Displays a bmp file, stored in the currently active volume

There are more functions to come, but first I need to test them.

SDPART.jpg

SDVOL.jpg


This is how the user code looks like:

    File_Init()
    bTemp = File_ListPartitions()
    TftPrintSndString(Str$(Dec bTemp), 1, 0,0,1, RED,BLACK,0)
    sTemp = File_PartitionName(1)
    TftPrintSndString(sTemp, 1, 0,1,1, RED,BLACK,0)
    sTemp = File_PartitionName(2)
    TftPrintSndString(sTemp, 1, 0,2,1, RED,BLACK,0)
    sTemp = File_PartitionName(3)
    TftPrintSndString(sTemp, 1, 0,3,1, RED,BLACK,0)
    sTemp = File_PartitionName(4)
    TftPrintSndString(sTemp, 1, 0,4,1, RED,BLACK,0)
    sTemp = File_PartitionName(5)
    TftPrintSndString(sTemp, 1, 0,5,1, RED,BLACK,0)
    sTemp = File_PartitionName(6)
    TftPrintSndString(sTemp, 1, 0,6,1, RED,BLACK,0)
    DelayMS 3000

    File_SetPartition(1)
    TftBmpFromSd("bird.bmp",0,0)
    DelayMS 2000
    File_SetPartition(2)
    TftBmpFromSd("cat.bmp",0,0)
    DelayMS 2000
    File_SetPartition(3)
    TftBmpFromSd("dog.bmp",0,0)
    DelayMS 2000
    File_SetPartition(4)
    TftBmpFromSd("bunny.bmp",0,0)
    DelayMS 2000
    File_SetPartition(5)
    TftBmpFromSd("frog.bmp",0,0)
    DelayMS 2000
    File_SetPartition(6)
    TftBmpFromSd("fox.bmp",0,0)

top204

That is amazing Dyanko.

Regards
Les

trastikata

#105
I'm pleased to announce that TFT Graphic Library 2 has been updated to v2.03 — and with this release, it's now called TFT & EPD Graphic Library 2!

www.picgraphic.com

Here are the highlights of what's changed:

  • Hardware support — Added hardware SPI support for newer PIC18-Q/K MCUs, which use a different hardware register set than earlier parts.

  • Performance — Speed optimizations in several places; touch now use fixed-point Q16.16 math instead of floating point.

  • EPD support — E-paper displays work quite differently from TFTs, so if you're new to EPDs, I'd strongly recommend reading through all the posted documentation before diving in.

  • SD Card — significant rework:
    • Fixed a major bug in FAT_TraverseClusters() that could corrupt a file when it was closed and reopened
    • Fat.inc now supports disk partitioning and partition addressing
    • File_Init() now correctly detects a missing card and returns an error within 2–3 seconds, instead of hanging for minutes
    • Added a number of new commands

  • 5. Shapes — Added a few new shape-drawing functions.

As always, I test as much as time allows, but like any hobby project, bugs are possible. If you find or suspect an anomaly, let me know here. I have a display on hand for every model I've posted support for, so I can test against real hardware — I just can't promise any particular timeframe.

Best regards,
D

Dompie

Wow, that is a really major expansion. And all the documentation has been fully updated, too! This must have involved a huge amount of work. Thanks so much for all the time and effort you put into it!!!

This is going to be an extensive study project during the winter months.

Johan

LeonJ

Hi Dyanko,

I've been using the previous version and found it excellent.

The newer SPI devices included and updates are most welcome.

Thanks for, what must be, a lot of hard work. It's much appreciated.

Regards,
Leon.

top204

#108
Wow.... 'Thank you' does not even come close to the appreciation you have from me and the compilers users Dyanko.

It is a work of art, and extremely useful in the real world.

Is the file really 999MB in length Dyanko? That is a very large download for people, including me, with my rather slow internet.

Again... Many thanks and very best regards my friend.
Les

trastikata

#109
Thank you all for the support — this is really just my hobby project.

Les,

The package includes two 644 MB ffmpeg encoder/decoder builds in the tools folder. I chose not to strip them down, and instead gave each its own tool subfolder, because it keeps things simple for the end user: one file, unpack, click, and use.

I've also bundled about 1 GB of TTF fonts for users to pick from when creating their own BDF font tables. The new BDF font converter tool is fully self-contained — it has its own window and calls the command-line executables silently in the background, so again it's just a few clicks, no external tools needed.

All told, that adds up to around 2 GB of unpacked resources.

The ffmpeg builds and the TTF fonts rarely change between versions, so your suggestion of offering a separate, trimmed-down download without them is a really good idea — I'll get that done soon.

================================== Update =====================================

I couldn't find anything online that actually deals with converting pictures for EPD displays while offering the user real choices. All the tools I found — whether online tools or applications — had limitations: no size control, no real conversion pipeline, no good transformation options, no picture control, and limited dithering options. Another thing missing was any output information, like resulting file size. So I decided to build my own, and I'm really pleased with how it turned out — a practical, one-click tool for the end user, with options I couldn't find anywhere else.

1.: Converts any picture into a compressed HEX byte table ready to drop into Positron BASIC, for driving EPD (e-paper) displays from 8-bit and 16-bit PIC microcontrollers. Supports black/white, black/white/red, and black/white/yellow panels.

2.: Open any source image, and it handles cropping/resizing to your target resolution, flattens any transparency onto a background color you pick (instead of just discarding it and leaving ugly fringing), and classifies every pixel into your panel's actual color set.

3.: Adjustable black/white and red/yellow thresholds, plus a full image-adjustment chain — brightness, contrast, gamma, saturation, sharpening (or blur, same slider, just negative), edge-preserving smoothing, and auto-levels. Every one of them updates the live preview instantly, so you're looking at the actual result while you drag, not exporting-and-checking on repeat.

4.: Thirteen dithering algorithms — Bayer, blue-noise-style, random, and clustered-dot halftone ordered dithering, plus the full error-diffusion family (Floyd-Steinberg, Atkinson, Jarvis-Judice-Ninke, Burkes, Stucki, Sierra, Two-Row Sierra, Sierra Lite) and Riemersma dithering along a Hilbert curve. Strength is adjustable, not just on/off.

5.: A live preview window with 1x-4x zoom for checking individual pixels, plus running counts of black/white/color pixels and the exact compressed HEX byte size — updating as you tweak anything, so you can see exactly how a setting trades visual quality against flash usage before you commit.

6.: Choose Bitmap, RLE, or Auto (picks whichever compresses smaller per plane), copy the generated HEX straight to clipboard, or save the classified result as a proper RGB565 BMP for reference.

FOX.png

Craig

Gee Dyanko It Looks Absolutely Wonderful, It is going to be Very Useful and with e-Paper it makes it Amazing Thank you for all the Hard work.
Regards Craig 

charliecoutas

If one could vote for a Genius, you would qualify for me every time! A good solid piece of work.

Charlie