Clearing some areas from the GLCD
Moderators: David Barker, Jerry Messina
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
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
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
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
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")
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")
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
Thanks again
CS
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
Thanks again
CS
- David Barker
- Swordfish Developer
- Posts: 1214
- Joined: Tue Oct 03, 2006 7:01 pm
- Location: Saltburn by the Sea, UK
- Contact:
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 )
If you want to see an example to understand, then I can post the way that I paint the Image.
Thanks
CS
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 )
If you want to see an example to understand, then I can post the way that I paint the Image.
Thanks
CS
- David Barker
- Swordfish Developer
- Posts: 1214
- Joined: Tue Oct 03, 2006 7:01 pm
- Location: Saltburn by the Sea, UK
- Contact:
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...
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...
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
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