Clearing some areas from the GLCD

General discussion relating to the library modules supplied with the compiler

Moderators: David Barker, Jerry Messina

CS
Posts: 127
Joined: Thu Nov 02, 2006 9:14 am

Post by CS » Sat Dec 09, 2006 3:26 pm

TimB,

after a long time of testing and trying to understand your last reply I have to admit, that it doesn't work. I can do it like I want but the result is a compiler error.

I thing, as long as I don't know how the fontfile is structured I can't make the changes. (Why scan along x, scan along y what does the number behind the fontname means, for what are the first 97 lines of code 'TahomaBold8' and so on)

What does the last line of your reply means: 'HTH'

@David: Thanks. Until you have made some changes, I hopefully understand a little bit more of the font-thing.

Thanks

CS

TimB
Posts: 262
Joined: Wed Oct 04, 2006 7:25 am
Location: London UK

Post by TimB » Sat Dec 09, 2006 4:25 pm

I don't have to long but here goes.

Variable with fonts are as it says variable in width. an "i" is wider than a "M". The hight though is fixed for the font so if it says 2 bytes high its needs 2 bytes to hold all the data. This is even is the font is only 9 pixels high.

So every vertical line is 2 bytes high. This means for every 2 bytes makes 1 pixel wide. If the char were 8 pixels wide you would need 8 x 2 bytes.

Now as I said the fonts can be variable so this makes it very hard to work out were the data will be for a char, so you have to make a table describing an offset value to the char data. Yo start from a fixed point do a multiply on your char no x 2 then do a look up the start address of the char data using that no + the font start address

Fixed fonts are a set value wide so can be calculated.

That's a very brief explanation.

Ask more questions if you need more help.


HTH means Hope That Helps

CS
Posts: 127
Joined: Thu Nov 02, 2006 9:14 am

Post by CS » Sun Dec 10, 2006 10:17 am

Thanks for the try, but for me it's to short to undestand.
Do you have some links or something else where I can look at how it works?

Thanks

CS

TimB
Posts: 262
Joined: Wed Oct 04, 2006 7:25 am
Location: London UK

Post by TimB » Sun Dec 10, 2006 1:43 pm

Some times its better looking at the solution from another angle.

Here is a sub that will put the deg symbol on the screen for you.
Only one problem to over come first though is to make WriteImageByte public

Open the GLCD.BAS lib and put PUBLIC in front of Sub on this line

Sub WriteImageByte(pX, pY As TXY, pValue As Byte)

Device = 18F452
Clock = 20

Include "GLCD.bas"
Include "Garamond.bas"
Include "Graphics.bas"

Sub PutDeg(Ypos As Byte)
Inc(Pos.x)
WriteImageByte(Pos.x,Ypos,%00000010)
Inc(Pos.x)
WriteImageByte(Pos.x,Ypos,%00000101)
Inc(Pos.x)
WriteImageByte(Pos.x,Ypos,%0000010)
Inc(Pos.x,2)
End Sub


ADCON1 = $07 // PORTE as digital (GLCD)

GLCD.Cls
GLCD.SetFont(GaramondBold)
GLCD.WriteAt(4,2,"0.2")
PutDeg(2)
GLCD.Write("C")

CS
Posts: 127
Joined: Thu Nov 02, 2006 9:14 am

Post by CS » Sun Dec 10, 2006 2:47 pm

Him TimB,

thanks for the solution. Because of no time I'll check it later. Maybe tomorrow.

Best wishes

CS

CS
Posts: 127
Joined: Thu Nov 02, 2006 9:14 am

Post by CS » Tue Dec 12, 2006 4:11 pm

Hi TimB,

late, but now I have checked your programm and after I understood it I'm happy because now it looks like I want. Thanks for that.

At this moment I use this also for drawing special chars (icons).

Hopefully David get a solution for the left overs then the first part of my project is at the end :D

Thanks again

CS

TimB
Posts: 262
Joined: Wed Oct 04, 2006 7:25 am
Location: London UK

Post by TimB » Tue Dec 12, 2006 4:24 pm

I have tested the new GLCD code with improved masking and it works a treat.

Dave will be contacting you soon.

User avatar
David Barker
Swordfish Developer
Posts: 1214
Joined: Tue Oct 03, 2006 7:01 pm
Location: Saltburn by the Sea, UK
Contact:

Post by David Barker » Tue Dec 12, 2006 4:40 pm

CS

Can you contact me via email so that I can send a new GLCD module for you to test...

CS
Posts: 127
Joined: Thu Nov 02, 2006 9:14 am

Post by CS » Tue Dec 12, 2006 5:14 pm

Hi David,

you've a PM!

CS

CS
Posts: 127
Joined: Thu Nov 02, 2006 9:14 am

Post by CS » Tue Dec 12, 2006 7:03 pm

TimB,

BTW the Sub WriteImageByte(pX,pY as TXY,pValue as Byte) is not easy to handle. I wanted to build a little Icon (the size of the Icon was 11 X 11)

When I send one Byte to the Sub (%00011100), I thought that the end of the Icon will not be drawn (because of only 8 bit). That isn't right, the top of the Icon is not drawn. So the Image was mirrored in two ways(I don't find the right word :evil: )

If you want to see an example to understand, then I can post the way that I paint the Image.

Thanks

CS

User avatar
David Barker
Swordfish Developer
Posts: 1214
Joined: Tue Oct 03, 2006 7:01 pm
Location: Saltburn by the Sea, UK
Contact:

Post by David Barker » Tue Dec 12, 2006 7:32 pm

You shouldn't call WriteImageByte() directly - that's why it is private. Don't change private to public with modules supplied with the compiler unless you know what you are doing or have been told to do so.

Use SetImage() - try the sample file GLCDImage.bas to see how it is used - it displays a (8 x 10) and (29 x 13) pixel images correctly.

The images supplied with Swordfish were done on graph paper - if I was you, I would wait for Steves image converter software or contact him directly...

CS
Posts: 127
Joined: Thu Nov 02, 2006 9:14 am

Post by CS » Tue Dec 12, 2006 8:18 pm

Hi David,

the idea to change the private in public comes from TimB so I could use it for drawing the deg symbol. After I've tried it, I thought I can use it also to draw some images because at this time there where no image converter.

After some confusion things I solved the problem and now my program draws the images correct.

Of course I have tried the sample and I also had a look at the bitmap.bas. But like so often the code is not clear enought to build own bitmap files.

Sorry!

CS

User avatar
Steven
BETA Tester
Posts: 406
Joined: Tue Oct 03, 2006 8:32 pm
Location: Cumbria, UK

Post by Steven » Tue Dec 12, 2006 8:24 pm

CS,

If you send me a PM with your email, I'll send you a version of the image converter before I finally release it. It works at present, but I would like to convert it from VB6 to VB.Net before I release the final version on the wiki.

Regards,

Steven

CS
Posts: 127
Joined: Thu Nov 02, 2006 9:14 am

Post by CS » Tue Dec 12, 2006 8:54 pm

Thanks David for the great work!

The new GLCD.bas works great. Even so I use fonts with 2 bytes high, the font is displayed great. And I haven't got the overdrawing problems! :D :D :D

Thanks again!

CS

CS
Posts: 127
Joined: Thu Nov 02, 2006 9:14 am

Post by CS » Tue Dec 12, 2006 8:55 pm

Hi Steven,

thanks for your offer. You have a PM.

CS

Post Reply