Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: How can i take the shape in image and save?  (Read 2101 times)

0 Members and 1 Guest are viewing this topic.

dkaip

  • Newbie
  • *
  • Posts: 32
    • View Profile
How can i take the shape in image and save?
« on: February 24, 2010, 08:05:30 pm »
Hello. I have a face object. How can i take the shape in image and give to disk?
Thank's
Jim

Code: [Select]

    FT_Library library; /* handle to library */
    FT_Face face; /* handle to face object */
    FT_Error  error;
    error = FT_Init_FreeType(&library);
    error = FT_New_Face( library,"arial.ttf", 0, &face );
    error = FT_Set_Char_Size( face, /* handle to face object */  0, /* char_width in 1/64th of points */  16*64, /* char_height in 1/64th of points */  300, /* horizontal device resolution */  300 ); /* vertical device resolution */
    error = FT_Set_Pixel_Sizes( face, /* handle to face object */  0, /* pixel_width */  16 ); /* pixel_height */
    int glyph_index = FT_Get_Char_Index( face, 0x0039);
    error = FT_Load_Glyph( face,glyph_index,FT_LOAD_NO_BITMAP);
    error = FT_Render_Glyph(face->glyph,FT_RENDER_MODE_MONO);
    FT_GlyphSlot slot = face->glyph; /* a small shortcut */

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
How can i take the shape in image and save?
« Reply #1 on: February 24, 2010, 08:27:37 pm »
Why do you use FreeType directly?

To save the image to disk, you have to convert it first to 32 bits RGBA, then give it to sf::Image::LoadFromPixels and finally use sf::Image::SaveToFile.
Laurent Gomila - SFML developer

dkaip

  • Newbie
  • *
  • Posts: 32
    • View Profile
How can i take the shape in image and save?
« Reply #2 on: February 24, 2010, 08:35:20 pm »
I will try freetype2.
Ok Thank's.

 

anything