本文整理汇总了C#中IBitmap类的典型用法代码示例。如果您正苦于以下问题:C# IBitmap类的具体用法?C# IBitmap怎么用?C# IBitmap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IBitmap类属于命名空间,在下文中一共展示了IBitmap类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: DrawImage
public void DrawImage(IBitmap source, double opacity, Rect sourceRect, Rect destRect)
{
var impl = (BitmapImpl) source.PlatformImpl;
var s = SkRect.FromRect(sourceRect);
var d = SkRect.FromRect(destRect);
MethodTable.Instance.DrawImage(Handle, impl.Handle, (float) opacity, ref s, ref d);
}
开发者ID:abdelkarim,项目名称:Perspex,代码行数:7,代码来源:DrawingContextImpl.cs
示例2: BitMapSkipper
public BitMapSkipper(IBitmap bitmap, List<Point2D> points)
{
FromVectors(points);
CreateScans();
FillScans(points);
FormatScans(bitmap);
}
开发者ID:bsvercl,项目名称:physics2d,代码行数:7,代码来源:BitmapHelper.cs
示例3: Fill
public static Bitmap Fill(IBitmap contraints, VectorInt2 p)
{
var result = new Bitmap(contraints.Size);
FillCell(contraints, result, p);
return result;
}
开发者ID:guylangston,项目名称:SokoSolve,代码行数:7,代码来源:FloodFill.cs
示例4: VideoTrack
/// <summary>
///
/// </summary>
/// <param name="bitmap"></param>
public VideoTrack(IBitmap bitmap)
{
Contract.Requires(bitmap != null);
this.dimensions = new Size(bitmap.Width, bitmap.Height);
this.format = bitmap.Format;
}
开发者ID:eriser,项目名称:nsynth,代码行数:11,代码来源:VideoTrack.cs
示例5: Release
public void Release(IBitmap bitmap)
{
if (!MathUtils.IsPowerOf2(bitmap.Width) ||
!MathUtils.IsPowerOf2(bitmap.Height)) return;
getPool(bitmap.Width, bitmap.Height).Release(bitmap);
}
开发者ID:tzachshabtay,项目名称:MonoAGS,代码行数:7,代码来源:BitmapPool.cs
示例6: ActionSheetOptionViewModel
public ActionSheetOptionViewModel(bool visible, string text, Action action, IBitmap image = null)
{
this.Text = text;
this.Action = new Command(action);
this.Visible = visible ? Visibility.Visible : Visibility.Collapsed;
this.ItemIcon = image;
}
开发者ID:philippd,项目名称:userdialogs,代码行数:7,代码来源:ActionSheetOptionViewModel.cs
示例7: Matrix
/// <summary>
/// Init from a bitmap, setting on true positions to <paramref name="Value"/>
/// </summary>
/// <param name="Bitmap"></param>
/// <param name="Value"></param>
public Matrix(IBitmap Bitmap, float Value)
{
Size = Bitmap.Size;
for (int ccx = 0; ccx < Width; ccx++)
for (int ccy = 0; ccy < Height; ccy++)
{
if (Bitmap[ccx, ccy]) this[ccx, ccy] = Value;
}
}
开发者ID:rfrfrf,项目名称:SokoSolve-Sokoban,代码行数:14,代码来源:Matrix.cs
示例8: Bitmap
/// <summary>
/// Copy Constructor. Deep copy.
/// </summary>
/// <param name="copy"></param>
public Bitmap(IBitmap copy)
: this(copy.Size.X, copy.Size.Y)
{
for (int cy = 0; cy < copy.Size.Y; cy++)
for (int cx = 0; cx < copy.Size.X; cx++)
{
this[cx, cy] = copy[cx, cy];
}
}
开发者ID:rfrfrf,项目名称:SokoSolve-Sokoban,代码行数:13,代码来源:Bitmap.cs
示例9: GetDrawable
public IObject GetDrawable(IArea area, IBitmap bg)
{
IWalkBehindArea walkBehind = area.GetComponent<IWalkBehindArea>();
if (walkBehind == null) return null;
AreaKey key = new AreaKey (area, bg);
IObject obj = _objects.GetOrAdd(key, () => createObject());
obj.Z = walkBehind.Baseline == null ? area.Mask.MinY : walkBehind.Baseline.Value;
obj.Image = _images.GetOrAdd(key, () => createImage(area, bg));
return obj;
}
开发者ID:tzachshabtay,项目名称:MonoAGS,代码行数:10,代码来源:AGSWalkBehindsMap.cs
示例10: GLImage
public GLImage(IBitmap bitmap, string id, ITexture texture, ISpriteSheet spriteSheet, ILoadImageConfig loadConfig)
{
OriginalBitmap = bitmap;
Width = bitmap.Width;
Height = bitmap.Height;
ID = id;
Texture = texture;
SpriteSheet = spriteSheet;
LoadConfig = loadConfig;
}
开发者ID:tzachshabtay,项目名称:MonoAGS,代码行数:10,代码来源:GLImage.cs
示例11: DrawImage
public void DrawImage(IBitmap source, double opacity, Rect sourceRect, Rect destRect)
{
var impl = (BitmapImpl)source.PlatformImpl;
var s = sourceRect.ToSKRect();
var d = destRect.ToSKRect();
using (var paint = new SKPaint()
{ Color = new SKColor(255, 255, 255, (byte)(255 * opacity)) })
{
Canvas.DrawBitmap(impl.Bitmap, s, d, paint);
}
}
开发者ID:CarlSosaDev,项目名称:Avalonia,代码行数:11,代码来源:DrawingContextImpl.cs
示例12: InvertBitmap
private void InvertBitmap(IBitmap bitmap)
{
for (int y = 0; y < bitmap.Height; y++)
for (int x = 0; x < bitmap.Width; x++)
{
var px = bitmap[x, y];
px.Red = 1.0f - px.Red;
px.Green = 1.0f - px.Green;
px.Blue = 1.0f - px.Blue;
bitmap[x, y] = px;
}
}
开发者ID:eriser,项目名称:nsynth,代码行数:12,代码来源:InvertFilter.cs
示例13: SkyBox
public SkyBox(IBitmap neg_x, IBitmap pos_x, IBitmap neg_y, IBitmap pos_y, IBitmap neg_z, IBitmap pos_z)
{
_config = Constants.Kernel.Get<RenderConfig>();
ITextureAtlasFactory atlasFactory = Constants.Kernel.Get<ITextureAtlasFactory>();
_atlas = atlasFactory.CreateTextureAtlas(new Size(_config.MaxTextureSize,_config.MaxTextureSize/2), new Size(_config.MaxTextureSize / 4, _config.MaxTextureSize / 4), 1);
_neg_x = _atlas.AddSubImage(neg_x);
_pos_x = _atlas.AddSubImage(pos_x);
_pos_y = _atlas.AddSubImage(pos_y);
_neg_y = _atlas.AddSubImage(neg_y);
_pos_z = _atlas.AddSubImage(pos_z);
_neg_z = _atlas.AddSubImage(neg_z);
}
开发者ID:AugustoAngeletti,项目名称:blockspaces,代码行数:13,代码来源:SkyBox.cs
示例14: DrawImage
public void DrawImage(IBitmap bitmap, double opacity, Rect sourceRect, Rect destRect)
{
var impl = bitmap.PlatformImpl as BitmapImpl;
var size = new Size(impl.PixelWidth, impl.PixelHeight);
var scaleX = destRect.Size.Width / sourceRect.Size.Width;
var scaleY = destRect.Size.Height / sourceRect.Size.Height;
_context.Save();
_context.Scale(scaleX, scaleY);
Gdk.CairoHelper.SetSourcePixbuf(_context, impl.Surface, (int)sourceRect.X, (int)sourceRect.Y);
_context.Rectangle(sourceRect.ToCairo());
_context.Fill();
_context.Restore();
}
开发者ID:healtech,项目名称:Perspex,代码行数:14,代码来源:DrawingContext.cs
示例15: FillCell
private static void FillCell(IBitmap contraints, IBitmap result, VectorInt2 p)
{
if (p.X < 0 || p.Y < 0) return;
if (p.X > contraints.Size.X || p.Y > contraints.Size.Y) return;
if (contraints[p]) return;
if (result[p]) return;
result[p] = true;
FillCell(contraints, result, p + VectorInt2.Up);
FillCell(contraints, result, p + VectorInt2.Down);
FillCell(contraints, result, p + VectorInt2.Left);
FillCell(contraints, result, p + VectorInt2.Right);
}
开发者ID:guylangston,项目名称:SokoSolve,代码行数:15,代码来源:FloodFill.cs
示例16: GLTexture2D
public GLTexture2D(string name, IBitmap bmp, bool genmipmaps = false, bool linearfilter = false, OpenTK.Graphics.OpenGL.PixelFormat sourceformat = OpenTK.Graphics.OpenGL.PixelFormat.Bgra, PixelInternalFormat destformat = PixelInternalFormat.Rgba, PixelType sourcetype = PixelType.UnsignedByte)
: base(name, TextureTarget.Texture2D, bmp.Width, bmp.Height)
{
tex = GL.GenTexture();
GL.BindTexture(TextureTarget.Texture2D, tex);
reattempt_load:
try {
/*BitmapData bmpdata = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
GL.TexImage2D(TextureTarget.Texture2D, 0, destformat, bmpdata.Width, bmpdata.Height, 0, sourceformat, sourcetype, bmpdata.Scan0);
bmp.UnlockBits(bmpdata);*/
bmp.TexImage2D(destformat);
}
catch(OutOfMemoryException) {
GC.WaitForPendingFinalizers();
goto reattempt_load;
}
if(genmipmaps)
{
GL.GenerateMipmap(GenerateMipmapTarget.Texture2D);
if(linearfilter)
{
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.LinearMipmapLinear);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);
}
else
{
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.NearestMipmapNearest);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Nearest);
}
}
else
{
if(linearfilter)
{
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);
}
else
{
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Nearest);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Nearest);
}
}
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)TextureWrapMode.Clamp);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)TextureWrapMode.Clamp);
}
开发者ID:RcSepp,项目名称:global_view,代码行数:48,代码来源:GLTexture2D.cs
示例17: RGBLuminanceSource
public RGBLuminanceSource(IBitmap d, int W, int H)
: base(W, H) {
int width = __width = W;
int height = __height = H;
// In order to measure pure decoding speed, we convert the entire image to a greyscale array
// up front, which is the same as the Y channel of the YUVLuminanceSource in the real app.
luminances = new sbyte[width * height];
//if (format == PixelFormat.Format8bppIndexed)
{
Color c;
for (int y = 0; y < height; y++) {
int offset = y * width;
for (int x = 0; x < width; x++) {
c = d.GetPixel(x, y);
luminances[offset + x] = (sbyte)(((int)c.R) << 16 | ((int)c.G) << 8 | ((int)c.B));
}
}
}
}
开发者ID:DozenArts,项目名称:zxing.MonoTouch,代码行数:19,代码来源:RGBLuminanceSource.cs
示例18: AverageOver
public static Map<float> AverageOver(Map<float> input, IBitmap within, IBitmap start)
{
var res = new Map<float>(input);
var done = new Bitmap(start);
var hit = false;
do
{
hit = false;
foreach (var pos in done.TruePositions())
{
foreach (var dir in VectorInt2.Directions)
{
var p = pos + dir;
if (within[p] && !done[p])
{
float cc = 0;
float total = 0;
foreach (var around in VectorInt2.Directions)
{
var x = p + around;
if (within[x]) cc++;
if (done[x])
{
total += res[x];
}
}
if (cc > 0)
{
res[p] = total / cc;
done[p] = true;
hit = true;
break;
}
}
}
}
} while (hit);
return res;
}
开发者ID:guylangston,项目名称:SokoSolve,代码行数:41,代码来源:StaticAnalysis.cs
示例19: DrawImage
/// <summary>
/// Draws a bitmap image.
/// </summary>
/// <param name="source">The bitmap image.</param>
/// <param name="opacity">The opacity to draw with.</param>
/// <param name="sourceRect">The rect in the image to draw.</param>
/// <param name="destRect">The rect in the output to draw to.</param>
public void DrawImage(IBitmap bitmap, double opacity, Rect sourceRect, Rect destRect)
{
var impl = bitmap.PlatformImpl as BitmapImpl;
var size = new Size(impl.PixelWidth, impl.PixelHeight);
var scale = new Vector(destRect.Width / sourceRect.Width, destRect.Height / sourceRect.Height);
_context.Save();
Gdk.CairoHelper.SetSourcePixbuf (
_context,
impl,
-sourceRect.X + destRect.X,
-sourceRect.Y + destRect.Y);
impl.Scale (impl, (int)destRect.X, (int)destRect.Y, (int)destRect.Width, (int)destRect.Height, 0, 0, scale.X, scale.Y, Gdk.InterpType.Bilinear);
_context.PushGroup ();
_context.Rectangle (destRect.ToCairo ());
_context.Fill ();
_context.PopGroupToSource ();
_context.PaintWithAlpha (opacityOverride);
_context.Restore();
}
开发者ID:akrisiun,项目名称:Avalonia,代码行数:29,代码来源:DrawingContext.cs
示例20: DrawImage
/// <summary>
/// Draws a bitmap image.
/// </summary>
/// <param name="source">The bitmap image.</param>
/// <param name="opacity">The opacity to draw with.</param>
/// <param name="sourceRect">The rect in the image to draw.</param>
/// <param name="destRect">The rect in the output to draw to.</param>
public void DrawImage(IBitmap bitmap, double opacity, Rect sourceRect, Rect destRect)
{
var impl = bitmap.PlatformImpl as BitmapImpl;
var size = new Size(impl.PixelWidth, impl.PixelHeight);
var scale = new Vector(destRect.Width / sourceRect.Width, destRect.Height / sourceRect.Height);
_context.Save();
_context.Scale(scale.X, scale.Y);
destRect /= scale;
if (opacityOverride < 1.0f) {
_context.PushGroup ();
Gdk.CairoHelper.SetSourcePixbuf (
_context,
impl.Surface,
-sourceRect.X + destRect.X,
-sourceRect.Y + destRect.Y);
_context.Rectangle (destRect.ToCairo ());
_context.Fill ();
_context.PopGroupToSource ();
_context.PaintWithAlpha (opacityOverride);
} else {
_context.PushGroup ();
Gdk.CairoHelper.SetSourcePixbuf (
_context,
impl.Surface,
-sourceRect.X + destRect.X,
-sourceRect.Y + destRect.Y);
_context.Rectangle (destRect.ToCairo ());
_context.Fill ();
_context.PopGroupToSource ();
_context.PaintWithAlpha (opacityOverride);
}
_context.Restore();
}
开发者ID:KvanTTT,项目名称:Perspex,代码行数:44,代码来源:DrawingContext.cs
注:本文中的IBitmap类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论