How can I redraw a partial TFT image

General discussion on mikroPascal PRO for PIC32.
Post Reply
Author
Message
mike64
Posts: 36
Joined: 01 May 2014 10:46

How can I redraw a partial TFT image

#1 Post by mike64 » 09 Nov 2017 10:45

How can I repair parts of an image?

The TFT library has a partial draw function, but it's always starting at top/left of the image

If an object changes (e.g. a displayed time) the background has to be redrawn before the
new information can be displayed. To draw the full image and redraw all the objects on it
takes to much time.

I need a function to redraw an image from (rx1,ry1) to (rx2,ry2).

If I need to write it myself , I need information about the bitmap format in TFT library

Any help is appreciated

User avatar
lana.arsic
mikroElektronika team
Posts: 1715
Joined: 15 Jan 2016 12:50

Re: How can I redraw a partial TFT image

#2 Post by lana.arsic » 10 Nov 2017 19:08

Hi Mike,

If you need to update some label there are several ways of doing it,
for example you can write previous value in background color,
and write new value with another color.

You can take a look here:

https://shop.mikroe.com/stretch-click

Or for example, you can draw rectangle of background color
across old value, and then write new value.

Or you can write functions for updating labels.

Kind regards,
Lana

mike64
Posts: 36
Joined: 01 May 2014 10:46

Re: How can I redraw a partial TFT image

#3 Post by mike64 » 12 Nov 2017 11:03

Hello Lana

thank you, but I know these methods. I think you misunderstood my question.

The background isn't a monocolored rectangle, it's an image in the background,
so I have to redraw the image bmp inside an invalidated rect.

I'm showing technical processes in this application, and a full redraw is to slow and looks unprofessional.

All I need is
procedure TFT_Partial_Image (left, top, STARTLEFT,STARTTOP, width, height : word; image : ^const byte; stretch : word) ;


My opinion:
The TFT library is so individual, depending on hardware and application, it should be open source.

Mike

User avatar
lana.arsic
mikroElektronika team
Posts: 1715
Joined: 15 Jan 2016 12:50

Re: How can I redraw a partial TFT image

#4 Post by lana.arsic » 14 Nov 2017 18:53

Hi Mike,

I'm sorry, I obviously misunderstood you.

If you need to redraw image from (rx1,ry1) to (rx2,ry2),
did you try to set parameters in TFT_Partial_Image as:

Code: Select all

TFT_Partial_Image(rx1, ry1, rx2-rx1, ry2-ry1, @image, 1);
Kind regards,
Lana

mike64
Posts: 36
Joined: 01 May 2014 10:46

Re: How can I redraw a partial TFT image

#5 Post by mike64 » 15 Nov 2017 15:56

Hi Lana

you are calculating the image width and height and write the image at another loation
This has no effect on the starting coordinates inside the image
The function is always starting with the upper left corner of the image and that's
my problem.

An Example
If this is a bmp image:

###########
###########
########*##
###########

How do I draw the star only?

The tft partial function is only mooving the whole pic on the screen



Regards Mike

User avatar
lana.arsic
mikroElektronika team
Posts: 1715
Joined: 15 Jan 2016 12:50

Re: How can I redraw a partial TFT image

#6 Post by lana.arsic » 16 Nov 2017 13:07

Hi Mike,

I'm sorry for misunderstanding.

I forwarded your suggestion to our developers for consideration.

Kind regards,
Lana

mike64
Posts: 36
Joined: 01 May 2014 10:46

Re: How can I redraw a partial TFT image

#7 Post by mike64 » 22 Nov 2017 20:08

Hello Lana.

My problem is that I've to finish the project and time is running...

Please send me the structure of the bitmap headers used
in the TFT library ressources. They are different to bitmap files.
So I can write my own function.

regards Mike

User avatar
lana.arsic
mikroElektronika team
Posts: 1715
Joined: 15 Jan 2016 12:50

Re: How can I redraw a partial TFT image

#8 Post by lana.arsic » 24 Nov 2017 19:13

Hi Mike,

You may find this converter useful:

https://libstock.mikroe.com/projects/vi ... -converter

Kind regards,
Lana

mike64
Posts: 36
Joined: 01 May 2014 10:46

Re: How can I redraw a partial TFT image

#9 Post by mike64 » 28 Nov 2017 09:45

Hi Lana

nice Program, but this is no answer to my question!

I already have the bitmap ressources in my program in use with TFT Library.

What I need to proceed is the data structure of the bitmaps in Micropascal
(especially the headers) to write my draw function

Please ask a develloper, he knows what I need.

regard Mike

User avatar
lana.arsic
mikroElektronika team
Posts: 1715
Joined: 15 Jan 2016 12:50

Re: How can I redraw a partial TFT image

#10 Post by lana.arsic » 29 Nov 2017 18:19

Hi Mike,

It has bitmap file header (0x00), then how much bits per pixels, then width and height, then
if image is less than 16bpp it has palette or if image is 16bpp it has data as 2 bytes for each pixel.

Kind regards,
Lana

mike64
Posts: 36
Joined: 01 May 2014 10:46

Re: How can I redraw a partial TFT image

#11 Post by mike64 » 03 Dec 2017 09:54

Hi Lana,

thank you, this was helpful to solve the problem.
With this information I could write a function an can
finish the project.

By the way, I'm generally disapointed about the superficial documentation.
Such informations should be found. For beginners who don't care about
details it's ok. But for professional developers ist not enough.
Regarding the TFT library for example, there are a lot of functions
to set pen, brush, font etc. I was looking for a fontheight. There is
an existing variable in the debugger, but not accessable. So I read byte 6
in the font table to obtain the value, an unnecessary work around .

Why do you hide all these variables and informations? A good documentation
could save a lot of time in developement

Regards Mike

User avatar
lana.arsic
mikroElektronika team
Posts: 1715
Joined: 15 Jan 2016 12:50

Re: How can I redraw a partial TFT image

#12 Post by lana.arsic » 08 Dec 2017 17:53

Hi Mike,

Thank you for your suggestions,
and I'm sorry for the lack of information.

Help file is written on that way to be concise,
but to provide enough information for using the functions.

But I will forward to our developers to consider to
add information which you have suggested.

Kind regards,
Lana

Post Reply

Return to “mikroPascal PRO for PIC32 General”