Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added gradients, low BPP bitmaps, text pixel length #25

Merged
merged 1 commit into from Nov 1, 2016

Conversation

softegg
Copy link
Contributor

@softegg softegg commented Mar 12, 2016

Additional graphics routines by Tim Trzepacz, SoftEgg LLC added December 2015
(And then accidentally deleted and rewritten March 2016. Oops!)
(Needs patch-1 also.)

Gradient support
fillRectVGradient - fills area with vertical gradient
fillRectHGradient - fills area with horizontal gradient
fillScreenVGradient - fills screen with vertical gradient
fillScreenHGradient - fills screen with horizontal gradient

Additional Color Support
color565toRGB - converts 565 format 16 bit color to RGB
color565toRGB14 - converts 16 bit 565 format color to 14 bit RGB (2 bits clear for math and sign)
RGB14tocolor565 - converts 14 bit RGB back to 16 bit 565 format color

Low Memory Bitmap Support
writeRect8BPP - write 8 bit per pixel paletted bitmap
writeRect4BPP - write 4 bit per pixel paletted bitmap
writeRect2BPP - write 2 bit per pixel paletted bitmap
writeRect1BPP - write 1 bit per pixel paletted bitmap

String Pixel Length support
strPixelLen - gets pixel length of given ASCII string

Additional graphics routines by Tim Trzepacz, SoftEgg LLC added December 2015
(And then accidentally deleted and rewritten March 2016. Oops!)
Gradient support 
		fillRectVGradient	- fills area with vertical gradient
		fillRectHGradient	- fills area with horizontal gradient
		fillScreenVGradient - fills screen with vertical gradient
 		fillScreenHGradient - fills screen with horizontal gradient

Additional Color Support
		color565toRGB		- converts 565 format 16 bit color to RGB
		color565toRGB14		- converts 16 bit 565 format color to 14 bit RGB (2 bits clear for math and sign)
		RGB14tocolor565		- converts 14 bit RGB back to 16 bit 565 format color

Low Memory Bitmap Support
		writeRect8BPP - 	write 8 bit per pixel paletted bitmap
		writeRect4BPP - 	write 4 bit per pixel paletted bitmap
		writeRect2BPP - 	write 2 bit per pixel paletted bitmap
		writeRect1BPP - 	write 1 bit per pixel paletted bitmap

String Pixel Length support 
		strPixelLen			- gets pixel length of given ASCII string
@PaulStoffregen
Copy link
Owner

This looks really awesome. Sorry I haven't had time to review it yet. I'm crazy busy with the Prop Shield beta at this moment.

I do have some long-term concerns about balancing features versus maintaining backwards compatibility with Adafruit GFX. Here's a message to put that in context. Any thoughts?
https://forum.pjrc.com/threads/33315-Teensy-3-2-and-Nextion-Display?p=99250&viewfull=1#post99250

Again, please accept my apology for delay. I probably won't be able to merge this (or even really look at it) for several days. But I won't forget... if you don't hear by next week, please ping me.

@softegg
Copy link
Contributor Author

softegg commented Mar 16, 2016

Hey, thanks! I'm glad you like it!

It seems like the greatest limitation of all of the microcontroller TFT stuff is that there isn't enough memory to pre-render any graphics at 16bpp... the whole screen requires over twice the amount of memory on the Teensy!

So I'm trying to give us some tools for using lower bit depth graphics, or generating high bit depth graphics on the fly. I think the paletted "writeRect#BPP" functions will help a lot!

I wrote in the thread about this.

To maintain backwards compatibility it would be easiest to just backport any additions to Adafruit's library for Arduino. This is complicated by some differences in the structure of the current libraries between Teensy and Adafruit. Adafruit has the GFX and TFT as separate classes, although TFT inherits from GFX so the result ends up being the same.

Alternatively, we could put all the new stuff in a new set of "Expanded Graphics" classes that inherit from the TFT library (or alternately from Adafruit's library, perhaps with a #define?) Then it would be up to other people to backport anything necessary for their platform...

I'm pretty much adding functionality that I want for my own projects, but I'm trying to determine the best way to share in the "open source" stuff and still make money to eat and all that...

I'm also considering the possibility of writing a layered character graphics + sprites engine that simulates the way old game consoles like Sega Genesis and Super Nintendo drew the screen using very little memory to achieve great results for games. Do you think that would be of interest to folks?

Another possibility considered is to port the menu system I wrote for "Rhythm Core Alpha 2" on Nintendo DSi over. It has buttons, radio buttons, numeric value controls, text option controls, a text entry control with on-screen keyboard, spinning knobs, sliders, bar graphs, etc. It isn't a trivial amount of work, tho...

Anyway, thanks again for your kind words about my changes. I hope they find their way in somehow. At very least, please integrate my change that allows linefeed in font string writes!

-- Tim --
SoftEgg

@FrankBoesing
Copy link
Contributor

ping

@PaulStoffregen
Copy link
Owner

This pull request looks incomplete. I see the new functions declared in the .h file, but other than the inline ones, there's no implementation. Did I miss something?

I'm going to merge this anyway. But if anyone tries to actually use these new functions, my guess is they'll get an linker error.

@PaulStoffregen PaulStoffregen merged commit 85a72f7 into PaulStoffregen:master Nov 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants