Home > brede > brede_vrml_strimage.m

brede_vrml_strimage

PURPOSE ^

brede_vrml_strimage - Convert string to VRML texture

SYNOPSIS ^

function [Image, comp] = brede_vrml_strimage(string, varargin);

DESCRIPTION ^

 brede_vrml_strimage  - Convert string to VRML texture

       function [Image, comp] = brede_vrml_strimage(string, ...
                       'PropertyName', 'PropertyValue')

       Input:    string        String to be encoded as texture

       Property: Color         [ {1} ] Color of characters 
                 BackColor     [ {0} ] Background color
                 Transparency  [ {1} | 0 ] Transparency component
                               in the texture

       Output:   Image         Matrix to be used as texture
                 comp          Number of component

       This function convert a string to a matrix that represents
       part of the 'image' field in the VRML2 node 'PixelTexture'.

       The font is a simple sans serif and there are are only defined
       a bit pattern for a limited set of characters. Furthermore,  
       the characters are all uppercase.

       Example:
         [I, comp] = brede_vrml_strimage('Hi'); 
         [rI, cI] = size(I);
         fid = brede_vrml_open('test.wrl');         
         fprintf(fid, 'Shape {\n  appearance Appearance {\n');
      fprintf(fid, '    texture PixelTexture {\n');
         fprintf(fid, '      image %d %d %d\n', rI, cI, comp);
         fprintf(fid, '%d ', I);
         fprintf(fid, '\n    }  \n  }\n');
         fprintf(fid, '  geometry Box {}\n}\n');
         fclose(fid);

         % Another example 
         [I, comp] = brede_vrml_strimage('A somewhat longer text', ...
            'Color', [1 0 0], 'transparency', 0);
         [rI, cI] = size(I);
         fid = brede_vrml_open('test.wrl');         
         fprintf(fid, 'Shape {\n  appearance Appearance {\n');
      fprintf(fid, '    texture PixelTexture {\n');
         fprintf(fid, '      image %d %d %d\n', rI, cI, comp);
         fprintf(fid, '%i ', I);
         % fprintf(fid, '0x%02X ', I);
         fprintf(fid, '    }\n}\n');
         fprintf(fid, '  geometry Box { size 5 1 1 }\n }\n');
         fclose(fid);

       See also BREDE, BREDE_VRML, BREDE_VTA, BREDE_VRML_OPEN,
                BREDE_VTA_AXLABEL, BREDE_VTA_POINT, BREDE_VRML_TEXT.

 $Id: brede_vrml_strimage.m,v 1.11 2007/03/12 08:57:57 fn Exp $

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:
Generated on Fri 27-Nov-2009 18:11:22 by m2html © 2005