Patterns, Text Paths and Text Borders
Patterns, Text Paths and Text Borders
I have a client who is building a simple graphical editing program for non-technically savvy sales staff to use. I am strongly considering this library because it has the best overlap of functionality. They have these requirements that I currently don't know how to implement with the library.
1) Polygon Texture Fill - This is the ability to do a polygon fill using another image as a template. Currently DrawFilledPolygon only allows me to do a fill with a specific color, and DrawTexturedLine allows me to draw with a texture, but how do I merge the two and draw the textured line within a oddly shaped polygon? Cropping only seems to work in square regions. Another way might be to draw a polygon then use it as a template, then use Get/SetPixel to eliminate pixels from the source image where it's transparent on the polygon fill image. Is there a better solution?
2) Text Path - This is the ability for the text to be drawn along a path rather than in a straight line. The best solution I can come with right now is to calculate the angles of each character in the text and draw them rotated and perpendicular according to the path. Is there a better solution?
3) Text Border - This is the ability to put a border around the individual characters. One alternative is to have them produce the fonts with the border already embedded, and eliminating this as requirement. Is there away to quickly put fixed width borders around text similar to Photoshop's Stroke Layer Style?
1) Polygon Texture Fill - This is the ability to do a polygon fill using another image as a template. Currently DrawFilledPolygon only allows me to do a fill with a specific color, and DrawTexturedLine allows me to draw with a texture, but how do I merge the two and draw the textured line within a oddly shaped polygon? Cropping only seems to work in square regions. Another way might be to draw a polygon then use it as a template, then use Get/SetPixel to eliminate pixels from the source image where it's transparent on the polygon fill image. Is there a better solution?
2) Text Path - This is the ability for the text to be drawn along a path rather than in a straight line. The best solution I can come with right now is to calculate the angles of each character in the text and draw them rotated and perpendicular according to the path. Is there a better solution?
3) Text Border - This is the ability to put a border around the individual characters. One alternative is to have them produce the fonts with the border already embedded, and eliminating this as requirement. Is there away to quickly put fixed width borders around text similar to Photoshop's Stroke Layer Style?
Re: Patterns, Text Paths and Text Borders
I implemented #3 with some very quick code. I don't check return codes or clean up after myself.
Code: Select all
private void WriteColorText() {
int ID = _Imaging.CreateNewGdPictureImage(400, 150, PixelFormat.Format24bppRgb, _Imaging.ARGB(255,255,255,255));
_Imaging.SetTransparencyColor(ID, _Imaging.ARGB(255, 255, 255, 255));
bool[,] Border = new bool[400,150];
_Imaging.DrawText(ID, "Hi There", 0, 0, 49, FontStyle.FontStyleItalic, _Imaging.ARGB(0,0,0), "Times New Roman", false);
int Copy = _Imaging.CreateClonedGdPictureImage(ID);
for ( int X=0; X < _Imaging.GetWidth(ID); X++ ) {
for ( int Y=0; Y < _Imaging.GetHeight(ID); Y++ ) {
if ( _Imaging.PixelGetColor(ID,X,Y) == _Imaging.ARGB(0,0,0) )
SetBorder(ref Border, X, Y, 400, 150, 2);
}
}
for ( int X=0; X < _Imaging.GetWidth(ID); X++ ) {
for ( int Y=0; Y < _Imaging.GetHeight(ID); Y++ ) {
if ( _Imaging.PixelGetColor(ID,X,Y) == _Imaging.ARGB(0,0,0) ) {
_Imaging.PixelSetColor(Copy, X, Y, Color.Blue);
} else if ( Border[X,Y] ) {
_Imaging.PixelSetColor(Copy, X, Y, Color.LightPink );
}
}
}
GdPictureStatus myResult = _Imaging.DrawGdPictureImageTransparency(Copy, _ImageID1, 1, 100, 400, 400, 200, InterpolationMode.InterpolationModeHighQualityBicubic);
}
private void SetBorder(ref bool[,] aBorder, int X, int Y, int aWidth , int aHeight , int aRadius) {
for ( int XX = -aRadius; XX <= aRadius; XX++ ) {
for ( int YY = -aRadius; YY <= aRadius; YY++ ) {
if (((X + XX) >= 0) && ((X + XX) < aWidth) && ((Y + YY) >= 0) && ((Y + YY) < aHeight)) {
aBorder[X + XX, Y + YY] = true;
}
}
}
}
Re: Patterns, Text Paths and Text Borders
Hi,
For 1, I think this feature will be included into the next release.
For 2, We are always considering the feasibility of this feature for the next release.
For 3: It seems that you have a good solution
Kind regards,
Loïc
For 1, I think this feature will be included into the next release.
For 2, We are always considering the feasibility of this feature for the next release.
For 3: It seems that you have a good solution
Kind regards,
Loïc
Re: Patterns, Text Paths and Text Borders
How long before a new version is released?
Re: Patterns, Text Paths and Text Borders
Hi,
The next release (a major one) will be released between 17th August and 1st September 2009.
With best regards,
Loïc
The next release (a major one) will be released between 17th August and 1st September 2009.
With best regards,
Loïc
Who is online
Users browsing this forum: No registered users and 2 guests