B4J Question B4J canvas for external display?

techknight

Well-Known Member
Licensed User
Longtime User
I am attempting to use an external parallel display for the Raspberry Pi. it is a dot-graphic 256x64 pixel 1bpp display. It is not a standard TFT LCD that uses the GPU. its more like a TC6963 based thing.

I know how to read/write and drive the display, that's not my issue. My issue is figuring out how to render text and graphics into a memory buffer that I can parse and send to the display. If you look at my avatar on the left, that is basically the types of displays I am talking about.

I was looking at the Canvas property in B4A and B4J, but its not clear how I can dither/define it as a 1bpp object, and then being able to read it out as x/y binary to my driver subroutine. (written for BASIC on AVR, I can port it over to GPIO).

I basically want to be able to load/draw graphics, rects, lines, Text, just like you would in a Bitmap/Canvas, but on the display instead. My thought was using a canvas and somehow reading it as a stream in 1bpp binary but I dont know how.

Any thoughts?
 

techknight

Well-Known Member
Licensed User
Longtime User
No, as its going to be a console-based app. So if that doesn't work, what will? I need something to render into and at the same time, be able to read back out pixel by pixel. Something to make my life easy as I am no C developer or otherwise.

Its almost as if I need a Frambuffer "object" that works like a canvas of sorts, that I can draw bitmaps in, use all the G functions, text, etc.. but at the same time be able to read the pixel values at a given X,Y coordinate. So I could read out the entire framebuffer to draw on an external display using my driver.

any ideas?
 
Last edited:
Upvote 0

techknight

Well-Known Member
Licensed User
Longtime User
Yes there is a C library and its designed for the Arduino, but I need more horsepower on the rendering side which is why I wanted to use the Pi
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
Yes there is a C library and its designed for the Arduino, but I need more horsepower on the rendering side which is why I wanted to use the Pi
You can use both on a master/slave partnership... Having the pi do the heavy parsing and serialise it to the arduino
 
Upvote 0

MaFu

Well-Known Member
Licensed User
Longtime User
Yes there is a C library and its designed for the Arduino, but I need more horsepower on the rendering side which is why I wanted to use the Pi
Then maybe the Teensy 3.6 is for you. It has 180 MHz and is Arduino compatible.
 
Upvote 0

techknight

Well-Known Member
Licensed User
Longtime User
You can use both on a master/slave partnership... Having the pi do the heavy parsing and serialise it to the arduino

Thats a great idea! except in my case for what I need to do drawing bars/graphics etc, I need a canvas that I can draw into. or a framebuffer, that I can actually serialize. Thats the problem.

the C driver I have which is written by the manufacturer is designed to take graphics data that has already been converted to bitmapped format to be written. I know the exact format at which the data has to be serialized into binary to be sent to the display, that is a non-issue here. Thats just an algorithm on how that data gets serialized. But it has to already be in an x,y pixelmap for that to happen.

The problem is a bit more high-level on how do I "get there". I need a way to draw graphics and text, and be able to serialize it as a bitmapped binary data block.
 
Last edited:
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
Although time consuming (but given the display size maybe negligible) you could, after creating the canvas, go through each pixel to get it's state and compose your data to send out?
 
Upvote 0

Daestrum

Expert
Licensed User
Longtime User
If you use Canvas you will have the problem that it applies antialiasing to the drawn image, so your image wont be just black and white, even if you use a black background and white paint.

You could use ms paint as that will allow a true black and white image with no antialiasing, save the image, then load into B4J as an image and use the pixelreader (via javaobject) to read each pixel in a x,y layout. Then serialize that to your device.
 
Upvote 0

techknight

Well-Known Member
Licensed User
Longtime User
That was my worry when I was thinking about all of this, maybe have to have some sort of dithering. Ugh this is getting complicated fairly quickly. Maybe I will start my project off as a simple Text only display for now. like an HD44780 style thing. Anyways, if you look at my avatar, that is the type of display I am trying to drive as well as render the graphics easily.

Currently I am doing it in an Atmel AVR using bitmaps and overlaying those in a "sprite-like" manner which takes a TON of flash memory and is slow.
 
Upvote 0
Top