Revision history for Graphics-Framebuffer
1.00 2004
First version, released privately only, as part of a Perl
media player project called "SuperSparky".
4.02 Dec 29, 2013
Public CPAN release. This is considerably more advanced
than the one distributed as part of the media player.
4.03 March 20, 2014
Minor changes to the CPAN package
4.05 April 14, 2014
Documentation updates. POD section revamped.
4.06 July 19, 2014
Added better testing
Added framebuffer emulation mode for test running on systems
without a hardware framebuffer. It draws to a 640x480x32
virtual screen in memory. You can dump this screen to a file.
4.07 July 23, 2014
Fixed calculation error in string size allocation for emulation
mode.
Fixed fill 'flood' typo.
Fixed pixel class documentation. It was incorrect.
Added more tests for most used methods.
4.08 July 25, 2014
Added additional information to the documentation for the new
emulation mode. No actual code changes made.
4.09 November 26, 2014
Added more FBIOCTL flags to make ready for future hardware
accellerated updates. No promises here, but heck, this
entire module was an exercise in "can it be done in Perl?"
Also fixed a code comment that was mislabeled.
4.10 May 10, 2015
Added the ability to customize the framebuffer file path.
Thanks Markus Maier.
Added aliases to "set_mode"
Some minor documentation fixes.
4.11 July 03, 2015
Numerous changes.
Changed ttf_print box_mode to return everything needed to call itself
again.
Added a 'COLOR_ORDER' setting to the "new" parameters. 1=RGB and 0=BGR.
The default is BGR.
Added more comments to the code
Added 'reset' as an alias to 'attributes_reset'. Just for people with
different tastes.
Hardened the code further against undefined values.
Added more documentation
Tested on Raspberry PI2, and works great! Odroid XU3, not so much...
Circle/ellipse clipping weirdness remains. I should have that addressed
in the next release.
4.12 July 05, 2015
Minor POD fix
There was a POD error that caused it to fail testing, although it would
have worked fine if installed.
No new functionality in this release, just that one issue fixed.
4.13 July 06, 2015
Changed the tests to only test against a memory buffer.
The tests get screwed up by the Test::Harness' output (which can't be
squelched apparently). So instead of testing on the real framebuffer,
I force the tests on a pseudo memory buffer.
I believe I have fixed the clipping issues, especially the ones with
filled ellipses and circles. It was related to blit_write.
There are some minor optimizations, although likely not obvious.
4.14 July 07, 2015
Fixed borked plot test. Functionality of the module is fine. The test
was broken.
4.15 July 07, 2015
Optimizations!
I have optimized the draw_arc routine, and in the process made it
properly work with XOR mode as well. It only draws what it hasn't
drawn before. Which makes it quite faster (although still not a speed
demon).
4.16 July 14, 2015
Bug fixes
Fill is now fixed. This sucker still uses stack memory like it's going
out of style. You have been warned.
Filled polygons now, as long as they aren't overly complicated, and the
borders do not cross. It uses a history buffer when drawing and then
uses it to draw a series of horizontal lines to "fill" the polygon. This
fill is very fast as a result.
'line' added for an alternate way of drawing a line. It's essentially
a combination of plot > drawto under the hood.
Warnings have been completely turned off. We don't want warnings to
mess up your pretty graphics. Crashable code is in an eval, so who
cares? Generally warnings begin happening when Perl has done a
variable garbage collection, and the memory mapping to the framebuffer
is borked. Fortunately, the module now recovers from this and remaps
it.
Clipping is quicker and more robust.
Documentation has been updated / fixed where appropriate.
4.17 July 14, 2015
Fixed bugs as a result of some typos. Sorry about that.
This affected the draw_arc and ellipse routines.
Made poly arcs draw with lines instead of single pixels. That fills in
the errors left by high granularity.
Added the constants 'ARC', 'PIE', and 'POLY_ARC' to make drawing arcs
easier to code.
4.18 July 14, 2015
Added new arc drawing methods. See the POD docs (man) for details.
4.19 July 16, 2015
Fixed the POD errors on test. I could swear I tested that. Oh well.
4.20 July 16, 2015
Removed the harmless leftover SCREEN2 code. Since that variable no
longer existed, the code skips by it.
4.21 July 16, 2015
Ugh, I left "Data::Dumper::Simple" in the previous version. Build
was borking on machines without it. Sorry folks.
I try to leave out all debugging code to keep the module as fast as
possible, but I missed this one.
4.22 July 21, 2015
I added a new mode to the framebuffer engine. Typically the module
uses a memory mapped method to draw to the framebuffer. It's fast,
but on some systems, this may be unstable. In such cases, you have
the option of telling the drawing engine to use a file handle mode
instead. File handle mode is a little slower, so use this mode
only if necessary. See the manual for specifics.
4.23 July 21, 2015
Modified the testing to stop failing too easy. It's really not
catestrophic if a test fails. Testing kind of interferes with
the output anyway.
Consolided the tests into one single "primitives" test.
ARM Mali GPUs now work. I found the problem was the framebuffer
driver was returning some bogus data, and was throwing off the
calculations for drawing. Which caused crazy numbers to be
sent to the mmap call, and thus fail. Now an override can be
sent when initializing the module to fix this. Yes, this means
that this module now works on the Odroid XU3!
The scripts in the "examples" directory can be put into MALI mode
by simply passing "mali" on the command line.
I added a boxfill for hardware accelerated cards. It's automatic
when called by box/rbox in the API. It only works with filled
boxes in normal and XOR mode.
If hardware accelerated filled boxes aren't working, then you
can disable them by setting (assume $fb is your object variable)
$fb->{'accel_flags'} = 0
Oh, and blitcopy is hardware accelerated in normal mode only as
well, if your video card supports it.
4.24 July 23, 2015
Vertical Gradents for boxes, ellipses, circles, and polygons
added. See the documentation for details. See the "examples"
directory for... well... examples.
Polygon fills fixed. No more gaps. Go easy on the complex
filled polygons though. Sometimes you get better results by
making a complex filled polygon out of smaller simple ones.
Updated the examples with up-to-date tests.
Added "UNMASK_MODE" to the documentation. Sorry about not having it
in there in the first place. I also added the shortcut method
"unmask_mode".
Added "angle_line" method for drawing lines at specific angles.
5.00 July 31, 2015
Major version update.
So many things have been added and optimized, that it warrants a full
version number upgrade.
'replace_color' is VERY fast if clipping is reset (off)
'pie_arc' has been changed. It uses the same fill routine that the
polygon fill uses. Thus it draws a lot faster with no more gaps.
Granularity is not as important. The value of 0.01 for granularity
should work for most uses (unless you have a 4K screen).
'fill' Is a lot faster, and uses considerably less memory now. I
knew I'd get it down.
New 'monochrome' method that takes any image data and makes it
greyscale. Using it with the blit methods should be handy.
TrueType font rendering is improved. It has a default font setting,
which you can change when you instantiate the framebuffer. It also
takes a new parameter 'wscale' to scale the width of the text. It
takes decimal values between 1 (inclusive) to 0 (exclusive). 1
is normal, and smaller values squeeze the text.
Color conversions are a bit better for 16 bit framebuffers.
Added 'cubic_bezier' curves! Yes, you can be a spline master now.
More friendlier named methods that are aliases to others.
Due to the extra features, two more prerequisite modules are
required.
On that note, I removed the need for Switch.pm. It turns out it's
flakey and starts to give bizarre errors, not to mention I realized
it has a performance penalty. So yes, this module is a little bit
faster now as a result.
Boxes can have rounded corners in frame, filled, and gradient
filled modes, if you desire. Just add the parameter 'radius'
to the method call.
Polygons with rounded corners are not ready. I am still having
trouble with them, but they will be added eventually.
This new version comes with a splash screen, which can be turned off.
The scripts in the 'examples' directory have been updated to reflect
the new additions. They should be very helpful in getting you
started.
Please read the manual for info on the new additions.
5.01 August 03, 2015
Fixed colorspace handling. Whether your video card is RGB or BGR (or
anything else), the module handles it fine. Also, 32, 24, and 16 bit
color modes are fully supported now. Note, 16 bit is a bit slower due
to the need for bit shifting. So I recommend 32 bit.
Color replace (replace_color) is now fixed, and quite a bit faster.
Super-fast if you do it without clipping (clip_reset).
More code optimizations have been added for speed.
cls/screen_clear have been changed a bit to be more effective when
clipping is off. You can also enable/disable the console cursor if
you pass 'ON' or 'OFF' to them.
Splash screen contains info on the video card, and if hardware
acceleration is used. It also indicates which color order RGB are
(look at the 'GFB' in the upper left circle, they are colored
according your video card's order).
5.02 August 03, 2015
Discontinued "cubic_bezier' and replaced it with 'bezier'. It was so
young, but this needed to be done. It will still work, but I don't
suggest continuing to use it. It's now just an alias to 'bezier'.
New 'bezier' method can create complex multi-point curves and shapes.
If a closed shape, it can be filled too.
Module prerequisites changed.
Optimized rounded corner box drawing.
5.03 August 05, 2015
Improved the IOCTL handling. A lot of work there. Still can't figure
out why Mali and Nouveau are not giving the needed information to
properly draw. The size of the framebuffer is improperly reported by
the Mali driver, and the size of a line is improperly reported by the
Nouveau driver. It seems Nouveau requires an additional 192 bytes per
line.,, weird.
So, to compensate for weirdness, I added another option to the 'new'
method, LINE_PADDING. With this one and MALI, I hope I have the quirks
covered.
Optimized the rounded box algorithm for solid fills a bit more.
Changed the splash screen a bit.
Changed the examoples scripts to fall in line with the changes.
5.04 August 06, 2015
Optimized circles and boxes with rounded corners... by a lot.
5.05 August 08, 2015
Fixed load_image, and added color remapping as well.
5.06 August 08, 2015
Documentation for 'load_image' was incorrect. 'load_image' returns
a structure containing the image for display with 'blit_write'.
5.07 August 08, 2015
Fixed the 32/24/16 bit conversions for image loading.
5.08 August 08, 2015
Ugh, I left some debug code in one of the examples scripts.
5.09 August 09, 2015
Updated the documentation.
Updates to set_color and related methods
5.10 August 09, 2015
Fixed a bug in xoffset calculations.
5.11 August 10, 2015
Fixed a POD error
5.12 August 11, 2015
Improved color replace. It's a lot faster for clipped mode.
Modified the test scripts to dynamically adjust to the resolution of
the device. This way the tests look fine on all devices, even tiny
96x64 OLED devices.
I was handling hardware acceleration incorrectly, which is why it
didn't work (duh). Right now it's just turned off. It requires
Inline C code, and I am not prepared for that yet.
5.13 August 11, 2015
More fixes to line drawing and blitting routines.
Made test scripts completely resolution independent. They should
display sane graphics for even the smallest disoplays.
5.14 August 12, 2015
Hardened memory mapping.
If mmap fails more than twice, it now just switches to file handle mode.
Apparently when mmap fails, in some environments, the file handle
disappears as well. Attempts are also made to recover the file handle
too.
Tests now check to see if run in X-Windows. Naughty naughty those of
you not reading the instructions! I don't like receiving CPAN reporter
errors when the error is not reading the instructions (wink wink).
5.15 August 12, 2015
Added a real test pattern to image tests
5.16 August 13, 2015
Fixed color mapping for ttf_print
5.17 August 13, 2015
Removed MALI and LINE_PADDING parameters.
Byte aligning helped figure out the driver paramenter structures.
5.18 August 13, 2015
Moved the images into their own directory
Modified the scripts to work with the images.
5.19 August 13, 2015
Replaced some for[each] loops with map for just that slight boost
of speed. Every optimization helps.
5.20 August 14, 2015
Fixed the color mapping for the TrueType font rendering. This was
most obvious in 16 bit modes. However, because of the complexities
in this process, text rendering for 16 bit modes is slower, as it
has to convert the 24 bit output of Imager into a 16 bit image to
then blit to the screen. I will see if there are optimizations I can
do for this in the future. Meanwhile it works.
Rounded box rendering has been fixed. It was showing an error in the
right side of the boxes mostly. This is no longer an issue.
Fixed the splash screen to show something coherrant on very low
resolution displays, like adafruit displays for example (96x64x16).
I have also forced buffer flushes on the screen filehandle. It was
buffering the drawing, which was leaving artifacts and driving me
crazy. Fortunately, this doesn't affect speed, as I don't tell it to
flush the buffer until after the entire primitive is drawn.
5.21 August 14, 2015
Modified clear_screen a bit.
Made changes to the test and examples scripts.
5.22 August 14, 2015
I somehow reintroduced some clipping errors I had previously fixed.
Well, those are fixed once again.
5.23 August 16, 2015
I fixed one last clipping bug in horizontal line drawing and the top
of the screen.
5.24 August 17, 2015
Mostly documentation updates.
'threadtest.pl' was no longer showing what each thread was doing. It
must have been related to the buffering fixes for the graphics. Doing
a flush on STDOUT seems to hae fixed it.
5.25 August 18, 2015
Added assign colorspace ability to emulation mode. No longer is it
just RGB. You can define it yourself.
5.26 August 19, 2015
Fixed image load routine.
5.27 August 19, 2015
Fixed POD errors
5.28 August 20, 2015
The polygon fill has been cpompletely rewritten. It has one minor
requirement though, that all polygons need to be drawn with their
points in a clockwise direction. Keep that in mind and filled
polygons will look great.
5.29 August 20, 2015
Documentation changes
Improved a couple of the example scripts
5.30 August 21, 2015
'image_load' now allows you to define the type of scaling to use, if
the image is to be scaled.
A few minor changes to the example scripts.
5.31 August 25, 2015
Re-wrote the algorithm that retrieves the framebuffer ioctl structures
Different CPU types really throw this off, and attempting to use c2ph
shows that c2ph is broken. Hopefully this algorithm works.
Included further install documentation, as it seems installing Imager
from CPAN can result in a useless Imager if the necessary libraries aren't
present ahead of time.
5.32 August 25, 2015
Fixed some typos
5.33 August 26, 2015
Improved the IOCTL detection code further. It just goes to fbset if it
gets confused. (#@$%@# C structures)
Added further documentation on installation and troubleshooting.
Added a disagnostics script call "dump.pl" in the "examples" directory.
I may ask you to send me the output of this, if you contact me for help.
5.34 August 26, 2015
Horizontal gradients are now allowed (in addition to the vertical). See
the documentation for details. Surprisingly, this draws faster on some
primitives. It's not perfect yet though. Polygon fills seem to have
some issues.
5.35 August 28, 2015
Improved cursor show/hide in clear_screen/cls.
Added more tests to primitives.pl. Made slideshow.pl show on all
framebuffer devices on the system automatically.
5.36 August 29, 2015
Changed the Build.PL and Makefile.PL scripts to be more informative
and check for 'fbset' as well.
Removed the test 01-environment.t script. It was causing far too much
trouble with automated CPAN tester bots (I hate getting CPAN Tester
failure emails).
The example script "mmapvsfile.pl" now actually makes a recommendation
on which mode to use for your framebuffer device, as some SPI
connected TFT devices actually work much faster in file handle mode
instead of memory mapped mode (go figure).
5.37 August 31, 2015
Fixed the 'angle_line' bug. It just plain wasn't working right. Now
it is.
Added the 'last_plot' method to return the current X,Y cursor position.
Added an 'angle_line' call to the "primitives.pl" script.
5.38 September 03, 2015
Fixed load_image to actually work with center parameter.
load_image now loads images with multiple frames (animated gifs).
Added new method "blit_transform", which rotates, scales, flips, and
merges blit images.
Update the "examples" scripts to show off new methods.
5.39 September 03, 2015
Fixed a time bug on primitives.pl that showed up on slow machines.
5.40 September 03, 2015
Fixed the Perl 5.22+ hard error in load_image while checking for
Imager based errors. Instead of "defined(@Img)" I changed it to
"defined($Img[0])". Which is functionally equivalent to what I
need to check, as the first element needs to be defined anyway.
This should make new Perls happy.
5.41 September 05, 2015
Fixed the animated GIF rendering issue with transparency. No more
ugly black splotches.
Changed example scripts. Added more images with different
characteristics.
5.42 September 14, 2015
Fixed incorrect color mapping for horizontal gradient fills in 16 bit
mode.
Added a color mapping test for "primitives.pl".
Changed how images are loaded for very low resolution screens in
"primitives.pl".