2005-11-17, 10:59 PM
below is my render method for a caller id plugin. I see that the mode is set correctly.
The section in bold is invoked. The image is correct I can save it to a file. I return it, but I never see it on top of the video. I do implement the IVideoPlugin interface and have it in the config.xml I see all of the other methods get invoked.
Ideas?
public Image render(out bool requiresMoreRendering)
{
requiresMoreRendering = false;
renderAgain = false;
// reset clickable regions
clickableNames = new Hashtable();
// alpha blend with background
float[][] matrixItems ={ // Note the value 0.8 in row 4, column 4.
new float[] {1, 0, 0, 0, 0},
new float[] {0, 1, 0, 0, 0},
new float[] {0, 0, 1, 0, 0},
new float[] {0, 0, 0, 0.8f, 0},
new float[] {0, 0, 0, 0, 1}};
ColorMatrix colorMatrix = new ColorMatrix(matrixItems);
ImageAttributes imageAttr = new ImageAttributes();
imageAttr.SetColorMatrix(
colorMatrix,
ColorMatrixFlag.Default,
ColorAdjustType.Bitmap);
// prepare background
// foregroundImage = new Bitmap(720,480);
Graphics g = Graphics.FromImage(foregroundImage);
// g.Clear(Color.Transparent);
g.SmoothingMode = SmoothingMode.AntiAlias;
Font generalFont = skinHelper.getNamedFont("GeneralText");
Brush generalFontBrush = skinHelper.getNamedFontBrush("GeneralText");
Font selectedGeneralFont = skinHelper.getNamedFont("SelectedGeneralText");
Brush selectedGeneralFontBrush = skinHelper.getNamedFontBrush("SelectedGeneralText");
Brush selectionBrush = skinHelper.getNamedBrush("Selection");
if ( this.bVideoMode )
{
string displayString = szLabel + "... (" + DateTime.Now.ToShortTimeString() + ")\n" + szName + _name + "\n" + szNumber + _number;
g = Graphics.FromImage(compositeScreenImage);
g.FillRectangle(new SolidBrush(GBPVR.Public.PluginHelperFactory.getPluginHelper().GetOSDTransparentColor()),0,0,720,480);
//g.FillRectangle( new SolidBrush(Color.Black), new Rectangle(5, 105, 305, 25) );
g.DrawString( displayString, generalFont, generalFontBrush, new Rectangle(10, 100, 300, 20) );
Logger.Info("Drawing string " + displayString );
//return ( foregroundImage );
return ( compositeScreenImage );
} else
{
Graphics.FromImage(backgroundImage).DrawImage(backgroundPicture, 0,0,backgroundPicture.Width,backgroundPicture.Height);
g.Clear(Color.Transparent);
// g.DrawString( "Call Data " + szCallData, generalFont, generalFontBrush, new Rectangle(10, 10, 300, 20) );
// g.DrawString( "Adj Call Data " + szAdjustedCallData, generalFont, generalFontBrush, new Rectangle(10, 40, 300, 20 ) );
// g.DrawString( "Label " + szLabel, generalFont, generalFontBrush, new Rectangle(10, 70, 300, 20) );
g.DrawString( "Number " + szNumber, generalFont, generalFontBrush, new Rectangle(10, 100, 300, 20) );
Graphics.FromImage(backgroundImage).DrawImage(foregroundImage, new System.Drawing.Rectangle(0,0,720,480),0,0,720,480,GraphicsUnit.Pixel,imageAttr);
return ( backgroundImage );
}
// return blended result
return backgroundImage;
}
The section in bold is invoked. The image is correct I can save it to a file. I return it, but I never see it on top of the video. I do implement the IVideoPlugin interface and have it in the config.xml I see all of the other methods get invoked.
Ideas?
public Image render(out bool requiresMoreRendering)
{
requiresMoreRendering = false;
renderAgain = false;
// reset clickable regions
clickableNames = new Hashtable();
// alpha blend with background
float[][] matrixItems ={ // Note the value 0.8 in row 4, column 4.
new float[] {1, 0, 0, 0, 0},
new float[] {0, 1, 0, 0, 0},
new float[] {0, 0, 1, 0, 0},
new float[] {0, 0, 0, 0.8f, 0},
new float[] {0, 0, 0, 0, 1}};
ColorMatrix colorMatrix = new ColorMatrix(matrixItems);
ImageAttributes imageAttr = new ImageAttributes();
imageAttr.SetColorMatrix(
colorMatrix,
ColorMatrixFlag.Default,
ColorAdjustType.Bitmap);
// prepare background
// foregroundImage = new Bitmap(720,480);
Graphics g = Graphics.FromImage(foregroundImage);
// g.Clear(Color.Transparent);
g.SmoothingMode = SmoothingMode.AntiAlias;
Font generalFont = skinHelper.getNamedFont("GeneralText");
Brush generalFontBrush = skinHelper.getNamedFontBrush("GeneralText");
Font selectedGeneralFont = skinHelper.getNamedFont("SelectedGeneralText");
Brush selectedGeneralFontBrush = skinHelper.getNamedFontBrush("SelectedGeneralText");
Brush selectionBrush = skinHelper.getNamedBrush("Selection");
if ( this.bVideoMode )
{
string displayString = szLabel + "... (" + DateTime.Now.ToShortTimeString() + ")\n" + szName + _name + "\n" + szNumber + _number;
g = Graphics.FromImage(compositeScreenImage);
g.FillRectangle(new SolidBrush(GBPVR.Public.PluginHelperFactory.getPluginHelper().GetOSDTransparentColor()),0,0,720,480);
//g.FillRectangle( new SolidBrush(Color.Black), new Rectangle(5, 105, 305, 25) );
g.DrawString( displayString, generalFont, generalFontBrush, new Rectangle(10, 100, 300, 20) );
Logger.Info("Drawing string " + displayString );
//return ( foregroundImage );
return ( compositeScreenImage );
} else
{
Graphics.FromImage(backgroundImage).DrawImage(backgroundPicture, 0,0,backgroundPicture.Width,backgroundPicture.Height);
g.Clear(Color.Transparent);
// g.DrawString( "Call Data " + szCallData, generalFont, generalFontBrush, new Rectangle(10, 10, 300, 20) );
// g.DrawString( "Adj Call Data " + szAdjustedCallData, generalFont, generalFontBrush, new Rectangle(10, 40, 300, 20 ) );
// g.DrawString( "Label " + szLabel, generalFont, generalFontBrush, new Rectangle(10, 70, 300, 20) );
g.DrawString( "Number " + szNumber, generalFont, generalFontBrush, new Rectangle(10, 100, 300, 20) );
Graphics.FromImage(backgroundImage).DrawImage(foregroundImage, new System.Drawing.Rectangle(0,0,720,480),0,0,720,480,GraphicsUnit.Pixel,imageAttr);
return ( backgroundImage );
}
// return blended result
return backgroundImage;
}
WinXP Home
3 X MVPs
Hauppauge 250 MCE
Hauppauge 150
P-4 2.4 GHz / 768 megs Ram
610 Gigs Of Media Storage
3 X MVPs
Hauppauge 250 MCE
Hauppauge 150
P-4 2.4 GHz / 768 megs Ram
610 Gigs Of Media Storage