Pocket Weather

digitaldon37

Active Member
Licensed User
Longtime User
Hi Filippo,

As I could not test it, thanks for doing it.

Added at the beginning of the DrawText routine:
B4X:
[FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]If [/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]cPPC [/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]Then[/COLOR][/SIZE][/FONT]
[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]Font1.Size=fs[/SIZE][/FONT]
[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]Else[/COLOR][/SIZE][/FONT]
[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]Font1.Size=fs*scale[/SIZE][/FONT]
[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]End [/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][/FONT]
[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT]

I hope that this will remove the problem.

I tried to add version0.361 but there is a problem with the server.
Will try it later.

Best regards.

Hallo Filippo.
Danke für den VGA Test. Habe das Program wie oben stehend am Anfang der DrawText Routine geändert.
Hoffe dass das das Problem löst.
Wollte die neue Version posten, geht leider momentan nicht.
Versuche es später.

Grüsse.

I have made the changes and uploaded to the main post
 

digitaldon37

Active Member
Licensed User
Longtime User
D

Deleted member 103

Guest
Hallo Klaus,

If cPPC Then
Font1.Size=fs
Else
Font1.Size=fs*scale
End If
habe dein Änderung hinzugefügt und jetzt die die VGA-Auflösung OK! ;)
 

digitaldon37

Active Member
Licensed User
Longtime User
Hallo Klaus,


habe dein Änderung hinzugefügt und jetzt die die VGA-Auflösung OK! ;)

Filippo, does this mean VGA is working?

I think I found a solution to the 'fuzzy' fonts. The complaints have been because the letters have a white blur around them. I made a change to load the theme settings at the program start and to set the form forelayer to what is in the INI (it was being set to white)

I'm attaching the pda exe if anyone wants to test, I've asked for feedback over at xda as well.
 
Last edited:

klaus

Expert
Licensed User
Longtime User
I have read the posts in the xdaa forum. I don't know where these white pixels around the texts do come from.
The Font in the program is Tahoma.
Even on Filippo's screenshot the texts have white pixels.
White color for fonts won't work because it is the transparent color. That means if we try to draw white texts they won't appear because they are transparent. If we need white texts then we must change this color.
That's also the reason why the xda testers got white texts with RGB(254,254,254), it's almost white but not exactly the true white.
I don't know if it is because I draw the texts on the forelayer. I ask Filippo to draw the texts onto the background image to see if there is a difference.

Best regards.

@Filippo
In Deinem Screenshot sehen die Texte wie verschwommen aus, mit weissen Pixeln drum herum und die Buchstaben sehen nicht sauber aus.
Weisst Du vieleicht wovon diese weissen Pixels herkommen ?
Hast Du das mit anderen Programmen auch ?
Oder kommt es daher weil der Text auf den Forelayer gezeichnet wird.
Könntest Du mal versuchen in der Zeile 122
B4X:
[FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]drw.New1([/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000]"Form1"[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2],[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]True[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2])[/SIZE][/FONT][/SIZE][/FONT]
durch
B4X:
[FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]drw.New1([/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000]"Form1"[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2],[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]False[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2])[/SIZE][/FONT][/SIZE][/FONT]
ersetzen um zu sehen ob es besser wird wenn man direkt auf das Hintergrundbild zeichnet und nicht auf den Forelayer.

Grüsse, und schon mal Danke im voraus.
 

digitaldon37

Active Member
Licensed User
Longtime User
Version .37 (developer's release)

Version .37 (developer's release) has been uploaded to the main post.

.37 (12/1/08)
=====================================================================
- Changed how form color is set to reduce font 'fuzziness'
- Added optional themePCFont, themePDAFont variables
- Fix background image file to select fileP, fileL (portrait, landscape)
- Fixed minor bugs


OPEN ISSUES
- S2U loads current weather, request for day forecast
- Must restart program when selecting theme for best results
 

agraham

Expert
Licensed User
Longtime User
I don't know where these white pixels around the texts do come from.
I think digitaldon37 got it right by correcting the forelayer background. I noticed something like this when developing the ImageLibEx library. I think that text drawn on the forelayer is being smoothed or anti-aliased (which mixes the background colour with the text color) while text drawn on the background is not smoothed. I can't explain why because, as this is not within my control being buried in the code for Form, I did not investigate further.
 

klaus

Expert
Licensed User
Longtime User
Thank you Andrew for the explanation.

Is this only the case on VGA devices, or newer WM operating systems ?
Can the smoothing be switched off ?
I tried on my Qtek9090 (WM2003) with Clear Type on or off there is no smoothing.

Best regards.
 

agraham

Expert
Licensed User
Longtime User
Is this only the case on VGA devices, or newer WM operating systems ?
Can the smoothing be switched off ?
As I said in the post I don't really know. If I remember correctly (more of a challenge each year :() ) it occurred using Form.Drawstring and Form.FDrawString. I can't remember if I checked it with ImageLib.DrawString or ImageLibEx.DrawString. I did get the impression it might have been because the Forelayer supports transparency but the Backlayer doesn't. The two layers are not directly supported by the .NET Form class but are implemented by code within Basic4ppc. They exist to provide persistent bitmaps otherwise apps would have to keep repainting their graphics on request from the OS when other things covered or uncovered the form. Because they are within the code for a form they are not accessible for tweaking by the Door library and I don't know how font smoothing works on a device anyway!
 

digitaldon37

Active Member
Licensed User
Longtime User
Thank's again.

I will wait on Filippo's tests and also on digitaldon37's answers about what Form color he has choosen.

Thank's again and Best Regards.

The latest version - developers release .37.2 - is attached
- added S2U option for forecast vs current
- fix bug on retrieving RSS on startup even if set to 0 (don't update)
- added filippo (vga support), agraham (all his libraries) in credits

I am setting the foreground color to the themeFormColor.
 
Last edited:

agraham

Expert
Licensed User
Longtime User
The fuzziness I remarked on earlier of text drawn on the forelayer occurs however the text is drawn on the forelayer and affects both desktop and device and is ClearType related. However the problem wasn't where I was looking (at DrawString) as I was overlooking the obvious :( it is in the Form Paint event.

When a forelayer bitmap is enabled on a Form it is filled with a violet colour (you never see this) and that colour is set as transparent for that bitmap. When the form is told to paint itself it first draws the backlayer bitmap onto its background image and then draws the forelayer bitmap on top. Due to the transparency only non-violet pixels are actually drawn. What you see in the case of ClearTyped text, see the attached demo, is the anti-aliased pixels that are blended from the font colour and the nominally transparent violet colour. As they are now no longer transparent they get drawn on the background. Incidentally if you choose exactly that violet colour to draw on the forelayer you won't see anything as it will be treated as transparent.

Note this is NOT the same transparent colour that is specified when drawing an image on the forelayer, this one is used only internally when drawing the forelayer onto the background.

I don't know if this is the reason for the white pixel problem in Pocket Weather as I don't know exactly how it uses the forelayer but it is certainly the reason for the problem I noticed while I was developing ImageLibEx and couldn't explain at the time.
 
D

Deleted member 103

Guest
Hallo Klaus,

I'm sorry that I only now with the test'm ready.

tut mir leid das ich erst jetzt mit dem Test fertig bin.

drw.New1("Form1",False)

Hier mein Test
  • PortraitMode:
  • 1.Bild=Hauptfenster
  • 2.Bild=Settings
  • 3.Bild=Hauptfenster

  • LandscapeMode:
  • 4.Bild=Hauptfenster
  • 5.Bild=Settings
  • 6.Bild=Hauptfenster

The font looks a lot better but there are problems Update.
Only in LandscapeMode it seems to be better.

Die Schrift sieht viel besser aus aber es gibt Aktuallisierungsprobleme.
Nur in LandscapeMode schein es besser zu sein.

Ciao,
Filippo
 

klaus

Expert
Licensed User
Longtime User
Hallo Filippo,

Danke für die Versuche. Es ist eigentlich komisch dass die Schrift im Landscape Modus etws besser aussieht als im Portrait Modus.

Das Updateproblem war mir bewusst, denn die Schrift wird ja direkt auf das Hintergrundbild gezeichnet. Ich wollte in einem ersten Schritt schon mal sehen ob das etwas helfen würde. Falls diese Möglichkeit die Endlösung wäre müssten wir dann bei jedem Update das Hintergrundbild neu laden, und das wollte Ich ja vermeiden.

Könntest Du noch einen Versuch machen, nach digitaldon37 scheint die Schrift, auf dem Forelayer aber mit Form1.Color=RGB(1,0,0), auch besser auszusehen.
Die Zeile 122 wieder so schreiben:
B4X:
drw.New1([FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000]"Form1"[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2],[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]True[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2])[/SIZE][/FONT][/SIZE][/FONT]

und in Zeile 147
B4X:
Form1.Color=RGB(1,0,0)
eingeben.

Vielleicht muss die 508 auskommentiert werden.
B4X:
Form1.Color=Theme.formColor

Grüsse und schönen Dank schon im voraus.


Hi Filippo,

Thank's for the testing, it's strange that the texts look somewhat better in landscape mode than in portrait mode.
I knew about the update problem, because the texts are drawn directly onto the background image. I just wanted, in a first step, see if it makes any difference. If this would be the final solution we should reload the background image before each screen update, and this is what I wanted to avoid.

Could you please make another test, according to digitaldon37 it seems that with Form1.Color=RGB(1,0,0) the texts look also better on the Forelayer.

So line 122 becomes again
B4X:
drw.New1([FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000]"Form1"[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2],[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]True[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2])[/SIZE][/FONT][/SIZE][/FONT]

and add in line 147
B4X:
Form1.Color=RGB(1,0,0)

perhaps line 508 should be commented out
B4X:
[SIZE=2][FONT=Courier New][SIZE=2][FONT=Courier New]' Form1.Color=Theme.formColor[/FONT][/SIZE][/FONT][/SIZE]

Best regards and thank you in advance.

@agraham,
This confirms you analysis.
 

digitaldon37

Active Member
Licensed User
Longtime User
Release 1.0 / D.38

Public Release 1.0 has been posted as a cab installer over at xda-developers, which includes all changes up to developer's release .38 (uploaded to the main post)

History

1.0 (12/3/08)
=====================================================================
- cab installer for PPC (includes up to developers release .38)


.38 (12/2/08)
=====================================================================
- added S2U option to show either current or forecast
- fixed retrieving from web, even if refresh value set to zero
- trap retrieveweatherdate error
- lines now have same color properties as borders
- added check to see if form visible before doing screen timer refresh



.37 (12/1/08)
=====================================================================
- Changed how form color is set to reduce font 'fuzziness'
- Added optional themePCFont, themePDAFont variables
- Fix background image file to select fileP, fileL (portrait, landscape)
- Fixed minor bugs


OPEN ISSUES

- Must restart program when selecting theme for best results
 

agraham

Expert
Licensed User
Longtime User
This is a follow-up to the fuzzy text on the forelayer "problem". The problem can be minimised if the transparent colour of the forelayer is the same as or near to that of the backlayer. In this case the anti-aliasing pixels on the forelayer better match the backlayer background and so are less visible.

In email exchanges with Erel he pointed out the SetTransparentColor statement which I had entirely overlooked (Iwas trying to do things the hard way as usual!). So in case you have overlooked it see Help->Main Help->Keywords->General. Unfortunately this setting is application wide and so is shared by all Forms causing problems with FErase if different Forms have different transparency colours. Fortunately you CAN have Forms with different transparency colours if you avoid using Form.FErase and use Form.FLine(x, y, w, h, ThisFormTransparencyColor, BF) instead when you want to erase part or all of a forelayer.
 

klaus

Expert
Licensed User
Longtime User
Thank's for the explanations agraham,

The transparent color is set to white with SetTransparentColor=cWhite in the program, and I know that it is the same for all forms. It's the first keyword in the AppStart routine.

In the WeatherForecast program there is only one Form where we use an background image and transparency.

Using a transparent color almost the same as the background image color would not be convenient because the background color can be different according to the choosen theme, but there are images with a white surrounding that we would have transparent and this is white.

There is something I am missing now, how can I set different transparent colors in different forms ? The only way I know, at the moment, is with a drawer object, or do I need the Door library or what else ?

Best regards.
 

agraham

Expert
Licensed User
Longtime User
There is something I am missing now, how can I set different transparent colors in different forms ?
Like this, the forelayer colour for a Form is that which is in effect when Forelayer is set to True.
B4X:
SetTransparentColor(cGreen)
Form1.ForeLayer = True ' Green is the forelayer transparent colour for Form1
SetTransparentColor(cRed)
Form2.ForeLayer = True ' Red is the forelayer transparent colour for Form2
FErase uses the last colour specified so will work on Form2 but will fill Form1 with Red as Form1s transparent colour is Green. Use FLine with the correct colour for the Form instead of FErase if you need to clear areas. See the small demo attached.


The only way I know, at the moment, is with a drawer object, or do I need the Door library or what else ?
The Drawer.SetTransparencyColor1 is different to that set by the SetTransparencyColor statement. The first defines the transparent colour of the source Bitmap being drawn onto its destination. The second defines the transparent colour of the forelayer being drawn on the form background image.

EDIT: - I just clarified the last paragraph a bit.
 
Last edited:

klaus

Expert
Licensed User
Longtime User
Thank you agraham.

In my mind, I thought that when setting a new transparent color it was for all forms and would have 'overwritten' the previous settings. So in your example I thought that the tranparent color for Form1 would also have been set to Red.

Fortunately it's never too late to learn something.

Best regards.
 
D

Deleted member 103

Guest
Hallo digitaldon37,

there is still a small problem with the graphic (see picture) and the switch from portrait mode to LandscapeMode.
If Form3 is visible and one of PortraitMode on LandscapeMode changes will be visible Form1, is it normal?

es gibt noch ein klein Problem bei der Grafik(siehe Bild) und beim umschalten von PortraitMode auf LandscapeMode.
Wenn Form3 sichtbar ist und man von PortraitMode auf LandscapeMode wechselt dann wird Form1 sichtbar, ist es normal?

Ciao,
Filippo
 
Top