/[zanavi_public1]/navit/navit/android/src/com/zoffcc/applications/zanavi/NavitGraphics.java
ZANavi

Diff of /navit/navit/android/src/com/zoffcc/applications/zanavi/NavitGraphics.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 50 Revision 51
171 static ZANaviOSDDebug01 debug_text_view = null; 171 static ZANaviOSDDebug01 debug_text_view = null;
172 172
173 public static final int map_bg_color = Color.parseColor("#FEF9EE"); 173 public static final int map_bg_color = Color.parseColor("#FEF9EE");
174 final Paint paint_bg_color = new Paint(Color.parseColor("#FEF9EE")); 174 final Paint paint_bg_color = new Paint(Color.parseColor("#FEF9EE"));
175 175
176 public static final int map_bg_color_nightmode = Color.parseColor("#666666");
177 final Paint paint_bg_color_nightmode = new Paint(Color.parseColor("#666666"));
178
176 public final static DashPathEffect dashed_map_lines__high = new DashPathEffect(new float[] { 4, 2 }, 1); 179 public final static DashPathEffect dashed_map_lines__high = new DashPathEffect(new float[] { 4, 2 }, 1);
177 public final static DashPathEffect dashed_map_lines__low = new DashPathEffect(new float[] { 15, 11 }, 1); 180 public final static DashPathEffect dashed_map_lines__low = new DashPathEffect(new float[] { 15, 11 }, 1);
178 public final static DashPathEffect dashed_map_lines__no_dash = null; 181 public final static DashPathEffect dashed_map_lines__no_dash = null;
179 182
180 public final static DashPathEffect h001 = new DashPathEffect(new float[] { 6, 3 }, 1); 183 public final static DashPathEffect h001 = new DashPathEffect(new float[] { 6, 3 }, 1);
213 public final float BIGMAP_FACTOR = (10465f / 2f) * 0.8f; 216 public final float BIGMAP_FACTOR = (10465f / 2f) * 0.8f;
214 Paint paint_maptile = new Paint(); 217 Paint paint_maptile = new Paint();
215 Matrix matrix_maptile = new Matrix(); 218 Matrix matrix_maptile = new Matrix();
216 219
217 static Paint strokeTextPaint = new Paint(); 220 static Paint strokeTextPaint = new Paint();
221 static Paint strokeTextPaint_nightmode = new Paint();
218 static double s_factor = 1; 222 static double s_factor = 1;
219 static int s_strokTextSize = 8; 223 static int s_strokTextSize = 8;
220 static int s_strokTextSize_min = 3; 224 static int s_strokTextSize_min = 3;
221 225
222 public static long last_paint_OSD = 0; 226 public static long last_paint_OSD = 0;
707 711
708 paint_bg_color.setColor(Color.parseColor("#FEF9EE")); 712 paint_bg_color.setColor(Color.parseColor("#FEF9EE"));
709 paint_bg_color.setAntiAlias(false); 713 paint_bg_color.setAntiAlias(false);
710 paint_bg_color.setDither(false); 714 paint_bg_color.setDither(false);
711 715
716 paint_bg_color_nightmode.setColor(Color.parseColor("#666666"));
717 paint_bg_color_nightmode.setAntiAlias(false);
718 paint_bg_color_nightmode.setDither(false);
719
712 STT_B_list[0] = null; 720 STT_B_list[0] = null;
713 STT_B_list[1] = null; 721 STT_B_list[1] = null;
714 STT_B_list[2] = null; 722 STT_B_list[2] = null;
715 STT_B_list[3] = null; 723 STT_B_list[3] = null;
716 STT_B_list[4] = null; 724 STT_B_list[4] = null;
737 // width of the text shadow for strings on map ----------- 745 // width of the text shadow for strings on map -----------
738 s_strokTextSize = dp_to_px(2); 746 s_strokTextSize = dp_to_px(2);
739 s_strokTextSize_min = dp_to_px(2); 747 s_strokTextSize_min = dp_to_px(2);
740 // width of the text shadow for strings on map ----------- 748 // width of the text shadow for strings on map -----------
741 749
742 strokeTextPaint.setARGB(255, 255, 255, 255); 750 strokeTextPaint.setARGB(255, 255, 255, 255); // white
743 strokeTextPaint.setTextAlign(android.graphics.Paint.Align.LEFT); 751 strokeTextPaint.setTextAlign(android.graphics.Paint.Align.LEFT);
744 strokeTextPaint.setStyle(Paint.Style.STROKE); 752 strokeTextPaint.setStyle(Paint.Style.STROKE);
745 strokeTextPaint.setStrokeWidth(s_strokTextSize); 753 strokeTextPaint.setStrokeWidth(s_strokTextSize);
746 strokeTextPaint.setFilterBitmap(false); 754 strokeTextPaint.setFilterBitmap(false);
747 strokeTextPaint.setAntiAlias(true); 755 strokeTextPaint.setAntiAlias(true);
748 strokeTextPaint.setDither(false); 756 strokeTextPaint.setDither(false);
757
758 strokeTextPaint_nightmode.setARGB(255, 164, 164, 164); // grey
759 strokeTextPaint_nightmode.setTextAlign(android.graphics.Paint.Align.LEFT);
760 strokeTextPaint_nightmode.setStyle(Paint.Style.STROKE);
761 strokeTextPaint_nightmode.setStrokeWidth(s_strokTextSize);
762 strokeTextPaint_nightmode.setFilterBitmap(false);
763 strokeTextPaint_nightmode.setAntiAlias(true);
764 strokeTextPaint_nightmode.setDither(false);
765
749 // shadow for text on map -------------- 766 // shadow for text on map --------------
750 767
751 if (parent == 0) 768 if (parent == 0)
752 { 769 {
753 this.gr_type = 1; 770 this.gr_type = 1;
887 { 904 {
888 draw_canvas_screen2.translate((Global_Map_TransX + pos_x) / Global_Map_Zoomfactor, (Global_Map_TransY + pos_y) / Global_Map_Zoomfactor); 905 draw_canvas_screen2.translate((Global_Map_TransX + pos_x) / Global_Map_Zoomfactor, (Global_Map_TransY + pos_y) / Global_Map_Zoomfactor);
889 } 906 }
890 907
891 //System.out.println("DO__DRAW:onDraw():drawBitmap start"); 908 //System.out.println("DO__DRAW:onDraw():drawBitmap start");
909
910 if (Navit.night_mode)
911 {
912 draw_canvas_screen2.drawColor(map_bg_color_nightmode); // fill with grey-ish bg color (NIGHT MODE)
913 }
914 else
915 {
892 draw_canvas_screen2.drawColor(map_bg_color); // fill with yellow-ish bg color 916 draw_canvas_screen2.drawColor(map_bg_color); // fill with yellow-ish bg color
917 }
893 918
894 // --------------- CLEAR MAP --------------- 919 // --------------- CLEAR MAP ---------------
895 // --------------- CLEAR MAP --------------- 920 // --------------- CLEAR MAP ---------------
896 //System.out.println("CLEAR MAP:001"); 921 //System.out.println("CLEAR MAP:001");
897 // draw_canvas_screen2.drawColor(Color.RED); 922 // draw_canvas_screen2.drawColor(Color.RED);
902 // draw the bitmap in the offscreen buffer (offset 30 pixels to center!!) 927 // draw the bitmap in the offscreen buffer (offset 30 pixels to center!!)
903 draw_canvas_screen2.drawBitmap(draw_bitmap_screen, 0, 0, paint_for_map_display); 928 draw_canvas_screen2.drawBitmap(draw_bitmap_screen, 0, 0, paint_for_map_display);
904 //System.out.println("DO__DRAW:onDraw():drawBitmap end"); 929 //System.out.println("DO__DRAW:onDraw():drawBitmap end");
905 930
906 canvas.save(); 931 canvas.save();
932
933 if (Navit.night_mode)
934 {
935 canvas.drawColor(map_bg_color_nightmode); // fill with grey-ish bg color (NIGHT MODE)
936 }
937 else
938 {
907 canvas.drawColor(map_bg_color); // fill with yellow-ish bg color 939 canvas.drawColor(map_bg_color); // fill with yellow-ish bg color
940 }
908 941
909 // --------------- CLEAR MAP --------------- 942 // --------------- CLEAR MAP ---------------
910 // --------------- CLEAR MAP --------------- 943 // --------------- CLEAR MAP ---------------
911 //System.out.println("CLEAR MAP:002"); 944 //System.out.println("CLEAR MAP:002");
912 // canvas.drawColor(Color.GREEN); 945 // canvas.drawColor(Color.GREEN);
979 canvas.drawRect(0, 0, this.getWidth(), h_scaled, paint_sky_day); 1012 canvas.drawRect(0, 0, this.getWidth(), h_scaled, paint_sky_day);
980 } 1013 }
981 } 1014 }
982 else 1015 else
983 { 1016 {
1017 if (Navit.night_mode)
1018 {
1019 canvas.drawPaint(paint_bg_color_nightmode);
1020 }
1021 else
1022 {
984 canvas.drawPaint(paint_bg_color); 1023 canvas.drawPaint(paint_bg_color);
1024 }
1025
985 // --------------- CLEAR MAP --------------- 1026 // --------------- CLEAR MAP ---------------
986 // --------------- CLEAR MAP --------------- 1027 // --------------- CLEAR MAP ---------------
987 //System.out.println("CLEAR MAP:003"); 1028 //System.out.println("CLEAR MAP:003");
988 // canvas.drawColor(Color.BLUE); 1029 // canvas.drawColor(Color.BLUE);
989 // --------------- CLEAR MAP --------------- 1030 // --------------- CLEAR MAP ---------------
1143 } 1184 }
1144 catch (Exception e) 1185 catch (Exception e)
1145 { 1186 {
1146 } 1187 }
1147 // allow all map drawing ----------- 1188 // allow all map drawing -----------
1189
1190 // -- show streetname of current map center ---
1191 if (!Navit.p.PREF_follow_gps)
1192 {
1193 if (Navit.GFX_OVERSPILL)
1194 {
1195 Navit.cwthr.CallbackGeoCalc2(1, 0, NavitGraphics.Global_dpi_factor * (mCanvasWidth / 2 + NavitGraphics.mCanvasWidth_overspill), NavitGraphics.Global_dpi_factor * (mCanvasHeight / 2 + NavitGraphics.mCanvasHeight_overspill));
1196 }
1197 else
1198 {
1199 Navit.cwthr.CallbackGeoCalc2(1, 0, NavitGraphics.Global_dpi_factor * mCanvasWidth / 2, NavitGraphics.Global_dpi_factor * mCanvasHeight / 2);
1200 }
1201 }
1202 // -- show streetname of current map center ---
1148 1203
1149 pos_x = 0; 1204 pos_x = 0;
1150 pos_y = 0; 1205 pos_y = 0;
1151 this.postInvalidate(); 1206 this.postInvalidate();
1152 1207
4646 paint_preview.setColor(Color.parseColor("#FFD2D2D2")); 4701 paint_preview.setColor(Color.parseColor("#FFD2D2D2"));
4647 paint_preview.setStyle(Paint.Style.STROKE); 4702 paint_preview.setStyle(Paint.Style.STROKE);
4648 paint_preview.setStrokeWidth(dp_to_px(5)); 4703 paint_preview.setStrokeWidth(dp_to_px(5));
4649 preview_canvas.drawPath(path_preview, paint_preview); 4704 preview_canvas.drawPath(path_preview, paint_preview);
4650 4705
4706 if (Navit.night_mode)
4707 {
4708 paint_preview.setColor(Color.parseColor("#FFBDBDBD"));
4709 }
4710 else
4711 {
4651 paint_preview.setColor(Color.parseColor("#FFFFFFFF")); 4712 paint_preview.setColor(Color.parseColor("#FFFFFFFF"));
4713 }
4652 paint_preview.setStrokeWidth(dp_to_px(3)); 4714 paint_preview.setStrokeWidth(dp_to_px(3));
4653 preview_canvas.drawPath(path_preview, paint_preview); 4715 preview_canvas.drawPath(path_preview, paint_preview);
4654 } 4716 }
4655 else if ((type2.equals("street_pedestrian")) || (type2.equals("living_street"))) 4717 else if ((type2.equals("street_pedestrian")) || (type2.equals("living_street")))
4656 { 4718 {
4690 paint_preview.setColor(Color.parseColor("#FFC0C0C0")); 4752 paint_preview.setColor(Color.parseColor("#FFC0C0C0"));
4691 paint_preview.setStyle(Paint.Style.STROKE); 4753 paint_preview.setStyle(Paint.Style.STROKE);
4692 paint_preview.setStrokeWidth(dp_to_px(5)); 4754 paint_preview.setStrokeWidth(dp_to_px(5));
4693 preview_canvas.drawPath(path_preview, paint_preview); 4755 preview_canvas.drawPath(path_preview, paint_preview);
4694 4756
4757 if (Navit.night_mode)
4758 {
4759 paint_preview.setColor(Color.parseColor("#FFBDBDBD"));
4760 }
4761 else
4762 {
4695 paint_preview.setColor(Color.parseColor("#FFFEFC8C")); 4763 paint_preview.setColor(Color.parseColor("#FFFEFC8C"));
4764 }
4696 paint_preview.setStrokeWidth(dp_to_px(3)); 4765 paint_preview.setStrokeWidth(dp_to_px(3));
4697 preview_canvas.drawPath(path_preview, paint_preview); 4766 preview_canvas.drawPath(path_preview, paint_preview);
4698 } 4767 }
4699 else if ((type2.equals("street_3_city")) || (type2.equals("ramp_street_3_city")) || (type2.equals("street_3_land")) || (type2.equals("roundabout"))) 4768 else if ((type2.equals("street_3_city")) || (type2.equals("ramp_street_3_city")) || (type2.equals("street_3_land")) || (type2.equals("roundabout")))
4700 { 4769 {
5086 if (paint_draw_text.getTypeface() == null) 5155 if (paint_draw_text.getTypeface() == null)
5087 { 5156 {
5088 try 5157 try
5089 { 5158 {
5090 strokeTextPaint.setTypeface(Navit.NavitStreetnameFont); 5159 strokeTextPaint.setTypeface(Navit.NavitStreetnameFont);
5160 strokeTextPaint_nightmode.setTypeface(Navit.NavitStreetnameFont);
5091 paint_draw_text.setTypeface(Navit.NavitStreetnameFont); 5161 paint_draw_text.setTypeface(Navit.NavitStreetnameFont);
5092 // System.out.println("Calling setTypeface"); 5162 // System.out.println("Calling setTypeface");
5093 } 5163 }
5094 catch (Exception e) 5164 catch (Exception e)
5095 { 5165 {
5100 else 5170 else
5101 { 5171 {
5102 if (paint_draw_text.getTypeface() != null) 5172 if (paint_draw_text.getTypeface() != null)
5103 { 5173 {
5104 strokeTextPaint.setTypeface(null); 5174 strokeTextPaint.setTypeface(null);
5175 strokeTextPaint_nightmode.setTypeface(Navit.NavitStreetnameFont);
5105 paint_draw_text.setTypeface(null); 5176 paint_draw_text.setTypeface(null);
5106 } 5177 }
5107 } 5178 }
5108 // FONT ------------------ 5179 // FONT ------------------
5109 // FONT ------------------ 5180 // FONT ------------------
5111 paint_draw_text.setAntiAlias(Navit.p.PREF_use_anti_aliasing); 5182 paint_draw_text.setAntiAlias(Navit.p.PREF_use_anti_aliasing);
5112 5183
5113 if (paint_draw_text.getTextSize() < 30) 5184 if (paint_draw_text.getTextSize() < 30)
5114 { 5185 {
5115 strokeTextPaint.setStrokeWidth(s_strokTextSize_min); 5186 strokeTextPaint.setStrokeWidth(s_strokTextSize_min);
5187 strokeTextPaint_nightmode.setStrokeWidth(s_strokTextSize_min);
5116 } 5188 }
5117 else 5189 else
5118 { 5190 {
5119 strokeTextPaint.setStrokeWidth(s_strokTextSize); 5191 strokeTextPaint.setStrokeWidth(s_strokTextSize);
5192 strokeTextPaint_nightmode.setStrokeWidth(s_strokTextSize);
5120 } 5193 }
5121 5194
5122 paint_draw_text.setTextAlign(android.graphics.Paint.Align.LEFT); 5195 paint_draw_text.setTextAlign(android.graphics.Paint.Align.LEFT);
5123 5196
5124 if (dx == 0x10000 && dy == 0) 5197 if (dx == 0x10000 && dy == 0)
5125 { 5198 {
5126 strokeTextPaint.setTextSize(paint_draw_text.getTextSize()); 5199 strokeTextPaint.setTextSize(paint_draw_text.getTextSize());
5200 strokeTextPaint_nightmode.setTextSize(paint_draw_text.getTextSize());
5201 if (Navit.night_mode)
5202 {
5203 draw_canvas.drawText(text, x, y, strokeTextPaint_nightmode);
5204 }
5205 else
5206 {
5127 draw_canvas.drawText(text, x, y, strokeTextPaint); 5207 draw_canvas.drawText(text, x, y, strokeTextPaint);
5208 }
5128 draw_canvas.drawText(text, x, y, paint_draw_text); 5209 draw_canvas.drawText(text, x, y, paint_draw_text);
5129 } 5210 }
5130 else 5211 else
5131 { 5212 {
5132 b_paint_path.reset(); 5213 b_paint_path.reset();
5133 b_paint_path.moveTo(x, y); 5214 b_paint_path.moveTo(x, y);
5134 b_paint_path.rLineTo(dx, dy); 5215 b_paint_path.rLineTo(dx, dy);
5135 5216
5136 strokeTextPaint.setTextSize(paint_draw_text.getTextSize()); 5217 strokeTextPaint.setTextSize(paint_draw_text.getTextSize());
5218 strokeTextPaint_nightmode.setTextSize(paint_draw_text.getTextSize());
5137 // draw shadow --- 5219 // draw shadow ---
5220 if (Navit.night_mode)
5221 {
5222 draw_canvas.drawTextOnPath(text, b_paint_path, 0, 0, strokeTextPaint_nightmode);
5223 }
5224 else
5225 {
5138 draw_canvas.drawTextOnPath(text, b_paint_path, 0, 0, strokeTextPaint); 5226 draw_canvas.drawTextOnPath(text, b_paint_path, 0, 0, strokeTextPaint);
5227 }
5139 // draw shadow --- 5228 // draw shadow ---
5140 5229
5141 // draw normal text --- 5230 // draw normal text ---
5142 draw_canvas.drawTextOnPath(text, b_paint_path, 0, 0, paint_draw_text); 5231 draw_canvas.drawTextOnPath(text, b_paint_path, 0, 0, paint_draw_text);
5143 // draw normal text --- 5232 // draw normal text ---
7030 } 7119 }
7031 catch (Exception e) 7120 catch (Exception e)
7032 { 7121 {
7033 } 7122 }
7034 } 7123 }
7124 else if (id == 32) // return debug text for tests
7125 {
7126 Navit.CI_TEST_CASE_TEXT = Navit.CI_TEST_CASE_TEXT + text + "\n";
7127 }
7035 7128
7036 // if (Navit.METHOD_DEBUG) Navit.my_func_name(1); 7129 // if (Navit.METHOD_DEBUG) Navit.my_func_name(1);
7037 } 7130 }
7038 7131
7039 public static void return_generic_int(int id, int i) 7132 public static void return_generic_int(int id, int i)

Legend:
Removed from v.50  
changed lines
  Added in v.51

   
Visit the ZANavi Wiki