예제 #1
0
        private void PartialDrawer()
        {
            //  Get the OpenGL object.
            OpenGL gl = openGLControl.OpenGL;

            //  Clear the color and depth buffer.
            gl.Clear(OpenGL.GL_COLOR_BUFFER_BIT | OpenGL.GL_DEPTH_BUFFER_BIT);
            //  Load the identity matrix.
            gl.LoadIdentity();

            int OS_x_begin = 0, OS_x_end = 0, OS_y_begin = 0, OS_y_end = 0;

            AreaCalculator(ref OS_x_end, ref OS_x_begin, ref OS_y_end, ref OS_y_begin);

            if (Grid.NetWorkOS_X.Count != 0 && true)
            {
                for (int x = OS_x_begin; (x < OS_x_end) && (x < Grid.NetWorkOS_X.Count()); x++)
                {
                    foreach (var func in Grid.NetWorkOS_X[x].List_of_func)
                    {
                        if (func.func_type == Net.FunctionType.DrawLine)
                        {
                            if (BoolLinesAreEnabled)
                            {
                                draw_line(cursor_X(func.value1), cursor_Y(func.value2), cursor_X(func.value3), cursor_Y(func.value4));
                            }
                        }
                        else if (func.func_type == Net.FunctionType.DrawText)
                        {
                            Draw_Text(cursor_X(func.value1), cursor_Y(func.value2), func.str);
                        }
                    }
                }
            }

            for (int y = OS_y_begin; y < OS_y_end; y++)
            {
                foreach (var func in Grid.NetWorkOS_Y[y].List_of_func)
                {
                    if (func.func_type == Net.FunctionType.DrawLine)
                    {
                        if (BoolLinesAreEnabled)
                        {
                            draw_line(cursor_X(func.value1), cursor_Y(func.value2), cursor_X(func.value3), cursor_Y(func.value4));
                        }
                    }
                    else if (func.func_type == Net.FunctionType.DrawText)
                    {
                        Draw_Text(cursor_X(func.value1), cursor_Y(func.value2), func.str);
                    }
                }

                //if (y >= 0 && y < Grid.NetWorkValue.Count())
                //Draw_Text(Grid.NetWorkValue[y][0].CellCursorP.X+20, Grid.NetWorkValue[y][0].CellCursorP.Y, y.ToString());
                for (int x = OS_x_begin; x < OS_x_end; x++)
                {
                    if (y < Grid.NetWorkValue.Count())
                    {
                        if (x < Grid.NetWorkValue[y].Count())
                        {
                            if (!double.IsNaN(Grid.NetWorkValue[y][x]))
                            {
                                if (BoolTextIsEnabledOtherwiseQuads)
                                {
                                    Draw_Text(cursor_X(x), cursor_Y(y), Grid.NetWorkValue[y][x].ToString(font_format.ToString() + FontQuanitityAfterPoint.ToString()));
                                }
                                else
                                {
                                    draw_white_square(cursor_X(x), cursor_Y(y), Grid.NetWorkValue[y][x]);
                                }
                            }
                        }
                    }
                }
            }

            //It's real draw now
            //Grid.DeadPoint.y = Grid.NetWorkValue.Count()* Grid.yCellSize;
            LaserCrossroad();
            NumberCrossroad();
        }
예제 #2
0
        private string GenerateFontFaceCss(bool isForPreview = true)
        {
            if (genericFontRadioButton.IsChecked.HasValue && genericFontRadioButton.IsChecked.Value)
            {
                return("");
            }

            string fontFilePath = fontFilePathTextBox.Text;

            if (string.IsNullOrEmpty(fontFilePath) || !File.Exists(fontFilePath))
            {
                return("");
            }

            // font name is already quoted
            string fontName = customFontFamilyName;
            Uri    fontUri  = new Uri(fontFilePathTextBox.Text);

            FontFormat fontFormat        = FontFormat.Unknown;
            string     fontFileExtension = System.IO.Path.GetExtension(fontFilePathTextBox.Text);

            if (!string.IsNullOrEmpty(fontFileExtension))
            {
                fontFormat = GetFontFormat(fontFileExtension);
            }

            string fontFormatStr = fontFormat == FontFormat.Unknown ? "" : "format(\"" + fontFormat.ToString().ToLower() + "\");";

            string path    = "";
            string srcType = "url";

            if (isForPreview)
            {
                path = fontUri.AbsoluteUri;
            }
            else
            {
                path = System.IO.Path.GetFileName(fontFilePathTextBox.Text);
            }

            return(string.Format("@font-face {{ font-family: {0}; src: {1}(\"{2}\") {3} }}", fontName, srcType, path, fontFormatStr));
        }