Beispiel #1
0
 /// <summary>
 /// Load font data.
 /// </summary>
 /// <param name="fontFileName">FontFile Name</param>
 /// <param name="id">Face index to select a font faces in a single file.</param>
 public void LoadFontData(String fontFileName, int id)
 {
     using (CvString csFontFileName = new CvString(fontFileName))
     {
         FreetypeInvoke.cveFreeType2LoadFontData(_ptr, csFontFileName, id);
     }
 }
Beispiel #2
0
 /// <summary>
 /// Release all the unmanaged memory associate with this object
 /// </summary>
 protected override void DisposeObject()
 {
     if (_sharedPtr != IntPtr.Zero)
     {
         FreetypeInvoke.cveFreeType2Release(ref _sharedPtr);
         _algorithmPtr = IntPtr.Zero;
         _ptr          = IntPtr.Zero;
     }
 }
Beispiel #3
0
        public Size GetTextSize(
            String text,
            int fontHeight, int thickness,
            ref int baseLine)
        {
            Size s = new Size();

            using (CvString csText = new CvString(text))
            {
                FreetypeInvoke.cveFreeType2GetTextSize(_ptr, csText, fontHeight, thickness, ref baseLine, ref s);
            }

            return(s);
        }
Beispiel #4
0
 /// <summary>
 /// Renders the specified text string in the image. Symbols that cannot be rendered using the specified font are replaced by "Tofu" or non-drawn.
 /// </summary>
 /// <param name="img">Image.</param>
 /// <param name="text">Text string to be drawn.</param>
 /// <param name="org">Bottom-left/Top-left corner of the text string in the image.</param>
 /// <param name="fontHeight">Drawing font size by pixel unit.</param>
 /// <param name="color">Text color.</param>
 /// <param name="thickness">Thickness of the lines used to draw a text when negative, the glyph is filled. Otherwise, the glyph is drawn with this thickness.</param>
 /// <param name="lineType">Line type</param>
 /// <param name="bottomLeftOrigin">When true, the image data origin is at the bottom-left corner. Otherwise, it is at the top-left corner.</param>
 public void PutText(
     IInputOutputArray img,
     String text,
     Point org,
     int fontHeight,
     MCvScalar color,
     int thickness,
     LineType lineType,
     bool bottomLeftOrigin
     )
 {
     using (InputOutputArray ioaImg = img.GetInputOutputArray())
         using (CvString csText = new CvString(text))
         {
             FreetypeInvoke.cveFreeType2PutText(_ptr, ioaImg, csText, ref org, fontHeight, ref color, thickness, lineType, bottomLeftOrigin);
         }
 }
Beispiel #5
0
 /// <summary>
 /// Set the number of split points from bezier-curve to line. If you want to draw large glyph, large is better. If you want to draw small glyph, small is better.
 /// </summary>
 /// <param name="num">Number of split points from bezier-curve to line</param>
 public void SetSplitNumber(int num)
 {
     FreetypeInvoke.cveFreeType2SetSplitNumber(_ptr, num);
 }
Beispiel #6
0
 /// <summary>
 /// Create instance to draw UTF-8 strings.
 /// </summary>
 public Freetype2()
 {
     _ptr = FreetypeInvoke.cveFreeType2Create(ref _algorithmPtr, ref _sharedPtr);
 }