本文整理汇总了C#中IImageByte类的典型用法代码示例。如果您正苦于以下问题:C# IImageByte类的具体用法?C# IImageByte怎么用?C# IImageByte使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IImageByte类属于命名空间,在下文中一共展示了IImageByte类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: attach
private void attach(IImageByte pixf)
{
m_SourceImage = pixf;
m_Buffer = m_SourceImage.GetBuffer();
m_Width = m_SourceImage.Width;
m_DistanceBetweenPixelsInclusive = m_SourceImage.GetBytesBetweenPixelsInclusive();
}
开发者ID:glocklueng,项目名称:agg-sharp,代码行数:7,代码来源:RasterBufferAccessors.cs
示例2: AlphaMaskAdaptor
public AlphaMaskAdaptor(IImageByte image, IAlphaMask mask)
: base(image)
{
linkedImage = image;
m_mask = mask;
m_span = new ArrayPOD<byte>(255);
}
开发者ID:glocklueng,项目名称:agg-sharp,代码行数:7,代码来源:AlphaMaskAdaptor.cs
示例3: RenderSolidSingleScanLine
protected override void RenderSolidSingleScanLine(IImageByte destImage, IScanlineCache scanLineCache, RGBA_Bytes color)
{
int y = scanLineCache.y();
int num_spans = scanLineCache.num_spans();
ScanlineSpan scanlineSpan = scanLineCache.begin();
byte[] ManagedCoversArray = scanLineCache.GetCovers();
for (; ; )
{
int x = scanlineSpan.x;
int num_pix = scanlineSpan.len;
int coverIndex = scanlineSpan.cover_index;
do
{
int a = (ManagedCoversArray[coverIndex++] * color.Alpha0To255) >> 8;
m_square.draw(destImage.NewGraphics2D().Rasterizer, m_sl, destImage,
new RGBA_Bytes(color.Red0To255, color.Green0To255, color.Blue0To255, a),
x, y);
++x;
}
while (--num_pix > 0);
if (--num_spans == 0) break;
scanlineSpan = scanLineCache.GetNextScanlineSpan();
}
}
开发者ID:glocklueng,项目名称:agg-sharp,代码行数:26,代码来源:aa_demo.cs
示例4: ButtonViewThreeImage
public ButtonViewThreeImage(IImageByte normal, IImageByte hover, IImageByte pressed)
{
hoverOpacity = 0;
normalIMage = normal;
hoverImage = hover;
pressedImage = pressed;
}
开发者ID:jeske,项目名称:agg-sharp,代码行数:7,代码来源:ButtonViewThreeImage.cs
示例5: draw
public void draw(ScanlineRasterizer ras, IScanlineCache sl, IImageByte destImage, RGBA_Bytes color,
double x, double y)
{
ras.reset();
ras.move_to_d(x * m_size, y * m_size);
ras.line_to_d(x * m_size + m_size, y * m_size);
ras.line_to_d(x * m_size + m_size, y * m_size + m_size);
ras.line_to_d(x * m_size, y * m_size + m_size);
ScanlineRenderer scanlineRenderer = new ScanlineRenderer();
scanlineRenderer.RenderSolid(destImage, ras, sl, color);
}
开发者ID:glocklueng,项目名称:agg-sharp,代码行数:11,代码来源:aa_demo.cs
示例6: RenderSolid
public void RenderSolid(IImageByte destImage, IRasterizer rasterizer, IScanlineCache scanLine, RGBA_Bytes color)
{
if (rasterizer.rewind_scanlines())
{
scanLine.reset(rasterizer.min_x(), rasterizer.max_x());
while (rasterizer.sweep_scanline(scanLine))
{
RenderSolidSingleScanLine(destImage, scanLine, color);
}
}
}
开发者ID:glocklueng,项目名称:agg-sharp,代码行数:11,代码来源:ScanlineRenderer.cs
示例7: RenderSolidAllPaths
public void RenderSolidAllPaths(IImageByte destImage,
IRasterizer ras,
IScanlineCache sl,
IVertexSource vs,
RGBA_Bytes[] color_storage,
int[] path_id,
int num_paths)
{
for (int i = 0; i < num_paths; i++)
{
ras.reset();
ras.add_path(vs, path_id[i]);
RenderSolid(destImage, ras, sl, color_storage[i]);
}
}
开发者ID:glocklueng,项目名称:agg-sharp,代码行数:17,代码来源:ScanlineRenderer.cs
示例8: DrawImageGetDestBounds
private void DrawImageGetDestBounds(IImageByte sourceImage,
double DestX, double DestY,
double HotspotOffsetX, double HotspotOffsetY,
double ScaleX, double ScaleY,
double AngleRad, out Affine destRectTransform)
{
destRectTransform = Affine.NewIdentity();
if (HotspotOffsetX != 0.0f || HotspotOffsetY != 0.0f)
{
destRectTransform *= Affine.NewTranslation(-HotspotOffsetX, -HotspotOffsetY);
}
if (ScaleX != 1 || ScaleY != 1)
{
destRectTransform *= Affine.NewScaling(ScaleX, ScaleY);
}
if (AngleRad != 0)
{
destRectTransform *= Affine.NewRotation(AngleRad);
}
if (DestX != 0 || DestY != 0)
{
destRectTransform *= Affine.NewTranslation(DestX, DestY);
}
int SourceBufferWidth = (int)sourceImage.Width;
int SourceBufferHeight = (int)sourceImage.Height;
drawImageRectPath.remove_all();
drawImageRectPath.MoveTo(0, 0);
drawImageRectPath.LineTo(SourceBufferWidth, 0);
drawImageRectPath.LineTo(SourceBufferWidth, SourceBufferHeight);
drawImageRectPath.LineTo(0, SourceBufferHeight);
drawImageRectPath.ClosePolygon();
}
开发者ID:CNCBrasil,项目名称:agg-sharp,代码行数:39,代码来源:ImageGraphics2D.cs
示例9: RenderSolidSingleScanLine
protected virtual void RenderSolidSingleScanLine(IImageByte destImage, IScanlineCache scanLine, RGBA_Bytes color)
{
int y = scanLine.y();
int num_spans = scanLine.num_spans();
ScanlineSpan scanlineSpan = scanLine.begin();
byte[] ManagedCoversArray = scanLine.GetCovers();
for (; ; )
{
int x = scanlineSpan.x;
if (scanlineSpan.len > 0)
{
destImage.blend_solid_hspan(x, y, scanlineSpan.len, color, ManagedCoversArray, scanlineSpan.cover_index);
}
else
{
int x2 = (x - (int)scanlineSpan.len - 1);
destImage.blend_hline(x, y, x2, color, ManagedCoversArray[scanlineSpan.cover_index]);
}
if (--num_spans == 0) break;
scanlineSpan = scanLine.GetNextScanlineSpan();
}
}
开发者ID:glocklueng,项目名称:agg-sharp,代码行数:23,代码来源:ScanlineRenderer.cs
示例10: AlphaMaskByteUnclipped
public AlphaMaskByteUnclipped(IImageByte rbuf, uint Step, uint Offset)
{
m_Step = Step;
m_Offset = Offset;
m_rbuf = rbuf;
}
开发者ID:glocklueng,项目名称:agg-sharp,代码行数:6,代码来源:agg_alpha_mask_u8.cs
示例11: attach
public void attach(IImageByte rbuf)
{
m_rbuf = rbuf;
}
开发者ID:glocklueng,项目名称:agg-sharp,代码行数:4,代码来源:agg_alpha_mask_u8.cs
示例12: Graphics2D
public Graphics2D(IImageByte destImage, ScanlineRasterizer rasterizer)
: this()
{
Initialize(destImage, rasterizer);
}
开发者ID:glocklueng,项目名称:agg-sharp,代码行数:5,代码来源:Graphics2D.cs
示例13: Render
public override void Render(IImageByte source,
double destX, double destY,
double angleRadians,
double inScaleX, double inScaleY)
{
{ // exit early if the dest and source bounds don't touch.
// TODO: <BUG> make this do rotation and scalling
RectangleInt sourceBounds = source.GetBounds();
RectangleInt destBounds = this.destImageByte.GetBounds();
sourceBounds.Offset((int)destX, (int)destY);
if (!RectangleInt.DoIntersect(sourceBounds, destBounds))
{
if (inScaleX != 1 || inScaleY != 1 || angleRadians != 0)
{
throw new NotImplementedException();
}
return;
}
}
double scaleX = inScaleX;
double scaleY = inScaleY;
Affine graphicsTransform = GetTransform();
if (!graphicsTransform.is_identity())
{
if (scaleX != 1 || scaleY != 1 || angleRadians != 0)
{
throw new NotImplementedException();
}
graphicsTransform.transform(ref destX, ref destY);
}
#if false // this is an optomization that eliminates the drawing of images that have their alpha set to all 0 (happens with generated images like explosions).
MaxAlphaFrameProperty maxAlphaFrameProperty = MaxAlphaFrameProperty::GetMaxAlphaFrameProperty(source);
if((maxAlphaFrameProperty.GetMaxAlpha() * color.A_Byte) / 256 <= ALPHA_CHANNEL_BITS_DIVISOR)
{
m_OutFinalBlitBounds.SetRect(0,0,0,0);
}
#endif
bool IsScaled = (scaleX != 1 || scaleY != 1);
bool IsRotated = true;
if (Math.Abs(angleRadians) < (0.1 * MathHelper.Tau / 360))
{
IsRotated = false;
angleRadians = 0;
}
//bool IsMipped = false;
double sourceOriginOffsetX = source.OriginOffset.x;
double sourceOriginOffsetY = source.OriginOffset.y;
bool CanUseMipMaps = IsScaled;
if (scaleX > 0.5 || scaleY > 0.5)
{
CanUseMipMaps = false;
}
bool renderRequriesSourceSampling = IsScaled || IsRotated || destX != (int)destX || destY != (int)destY;
// this is the fast drawing path
if (renderRequriesSourceSampling)
{
#if false // if the scalling is small enough the results can be improved by using mip maps
if(CanUseMipMaps)
{
CMipMapFrameProperty* pMipMapFrameProperty = CMipMapFrameProperty::GetMipMapFrameProperty(source);
double OldScaleX = scaleX;
double OldScaleY = scaleY;
const CFrameInterface* pMippedFrame = pMipMapFrameProperty.GetMipMapFrame(ref scaleX, ref scaleY);
if(pMippedFrame != source)
{
IsMipped = true;
source = pMippedFrame;
sourceOriginOffsetX *= (OldScaleX / scaleX);
sourceOriginOffsetY *= (OldScaleY / scaleY);
}
HotspotOffsetX *= (inScaleX / scaleX);
HotspotOffsetY *= (inScaleY / scaleY);
}
#endif
Affine destRectTransform;
DrawImageGetDestBounds(source, destX, destY, sourceOriginOffsetX, sourceOriginOffsetY, scaleX, scaleY, angleRadians, out destRectTransform);
Affine sourceRectTransform = new Affine(destRectTransform);
// We invert it because it is the transform to make the image go to the same position as the polygon. LBB [2/24/2004]
sourceRectTransform.invert();
span_image_filter spanImageFilter;
span_interpolator_linear interpolator = new span_interpolator_linear(sourceRectTransform);
ImageBufferAccessorClip sourceAccessor = new ImageBufferAccessorClip(source, RGBA_Floats.rgba_pre(0, 0, 0, 0).GetAsRGBA_Bytes());
spanImageFilter = new span_image_filter_rgba_bilinear_clip(sourceAccessor, RGBA_Floats.rgba_pre(0, 0, 0, 0), interpolator);
DrawImage(source, spanImageFilter, destRectTransform);
#if false // this is some debug you can enable to visualize the dest bounding box
LineFloat(BoundingRect.left, BoundingRect.top, BoundingRect.right, BoundingRect.top, WHITE);
//.........这里部分代码省略.........
开发者ID:CNCBrasil,项目名称:agg-sharp,代码行数:101,代码来源:ImageGraphics2D.cs
示例14: Render
public abstract void Render(IImageByte imageSource,
double x, double y,
double angleRadians,
double scaleX, double ScaleY);
开发者ID:glocklueng,项目名称:agg-sharp,代码行数:4,代码来源:Graphics2D.cs
示例15: ImageBuffer
public ImageBuffer(IImageByte sourceImage, IRecieveBlenderByte recieveBlender)
{
SetDimmensionAndFormat(sourceImage.Width, sourceImage.Height, sourceImage.StrideInBytes(), sourceImage.BitDepth, sourceImage.GetBytesBetweenPixelsInclusive(), true);
int offset = sourceImage.GetBufferOffsetXY(0, 0);
byte[] buffer = sourceImage.GetBuffer();
byte[] newBuffer = new byte[buffer.Length];
agg_basics.memcpy(newBuffer, offset, buffer, offset, buffer.Length - offset);
SetBuffer(newBuffer, offset);
SetRecieveBlender(recieveBlender);
}
开发者ID:glocklueng,项目名称:agg-sharp,代码行数:10,代码来源:ImageBuffer.cs
示例16: ImageBufferAccessorClip
public ImageBufferAccessorClip(IImageByte sourceImage, RGBA_Bytes bk)
: base(sourceImage)
{
m_OutsideBufferColor = new byte[4];
m_OutsideBufferColor[0] = bk.red;
m_OutsideBufferColor[1] = bk.green;
m_OutsideBufferColor[2] = bk.blue;
m_OutsideBufferColor[3] = bk.alpha;
}
开发者ID:glocklueng,项目名称:agg-sharp,代码行数:9,代码来源:RasterBufferAccessors.cs
示例17: ImageBufferAccessorCommon
public ImageBufferAccessorCommon(IImageByte pixf)
{
attach(pixf);
}
开发者ID:glocklueng,项目名称:agg-sharp,代码行数:4,代码来源:RasterBufferAccessors.cs
示例18: SaveImageData
public override bool SaveImageData(String filename, IImageByte sourceImage)
{
if (File.Exists(filename))
{
File.Delete(filename);
}
ImageFormat format = ImageFormat.Jpeg;
if (filename.ToLower().EndsWith(".png"))
{
format = ImageFormat.Png;
}
else if (!filename.ToLower().EndsWith(".jpg") && !filename.ToLower().EndsWith(".jpeg"))
{
filename += ".jpg";
}
if (!System.IO.File.Exists(filename))
{
if (sourceImage.BitDepth == 32)
{
Bitmap bitmapToSave = new Bitmap(sourceImage.Width, sourceImage.Height, PixelFormat.Format32bppArgb);
BitmapData bitmapData = bitmapToSave.LockBits(new Rectangle(0, 0, bitmapToSave.Width, bitmapToSave.Height), System.Drawing.Imaging.ImageLockMode.ReadWrite, bitmapToSave.PixelFormat);
int destIndex = 0;
unsafe
{
byte[] sourceBuffer = sourceImage.GetBuffer();
byte* pDestBuffer = (byte*)bitmapData.Scan0;
int scanlinePadding = bitmapData.Stride - bitmapData.Width * 4;
for (int y = 0; y < sourceImage.Height; y++)
{
int sourceIndex = sourceImage.GetBufferOffsetXY(0, sourceImage.Height - 1 - y);
for (int x = 0; x < sourceImage.Width; x++)
{
pDestBuffer[destIndex++] = sourceBuffer[sourceIndex++];
pDestBuffer[destIndex++] = sourceBuffer[sourceIndex++];
pDestBuffer[destIndex++] = sourceBuffer[sourceIndex++];
pDestBuffer[destIndex++] = sourceBuffer[sourceIndex++];
}
destIndex += scanlinePadding;
}
}
bitmapToSave.Save(filename, format);
bitmapToSave.UnlockBits(bitmapData);
return true;
}
else if (sourceImage.BitDepth == 8 && format == ImageFormat.Png)
{
Bitmap bitmapToSave = new Bitmap(sourceImage.Width, sourceImage.Height, PixelFormat.Format8bppIndexed);
ColorPalette palette = bitmapToSave.Palette;
for (int i = 0; i < palette.Entries.Length; i++)
{
palette.Entries[i] = Color.FromArgb(i, i, i);
}
bitmapToSave.Palette = palette;
BitmapData bitmapData = bitmapToSave.LockBits(new Rectangle(0, 0, bitmapToSave.Width, bitmapToSave.Height), System.Drawing.Imaging.ImageLockMode.ReadWrite, bitmapToSave.PixelFormat);
int destIndex = 0;
unsafe
{
byte[] sourceBuffer = sourceImage.GetBuffer();
byte* pDestBuffer = (byte*)bitmapData.Scan0;
for (int y = 0; y < sourceImage.Height; y++)
{
int sourceIndex = sourceImage.GetBufferOffsetXY(0, sourceImage.Height - 1 - y);
for (int x = 0; x < sourceImage.Width; x++)
{
pDestBuffer[destIndex++] = sourceBuffer[sourceIndex++];
}
}
}
bitmapToSave.Save(filename, format);
bitmapToSave.UnlockBits(bitmapData);
return true;
}
else
{
throw new System.NotImplementedException();
}
}
return false;
}
开发者ID:jeske,项目名称:agg-sharp,代码行数:82,代码来源:ImageIOWindowsPlugin.cs
示例19: render_gouraud
internal void render_gouraud(IImageByte backBuffer, IScanlineCache sl, IRasterizer ras, RenderPoint[] points)
{
ImageBuffer image = new ImageBuffer();
image.Attach(backBuffer, new BlenderZBuffer());
ImageClippingProxy ren_base = new ImageClippingProxy(image);
MatterHackers.Agg.span_allocator span_alloc = new span_allocator();
span_gouraud_rgba span_gen = new span_gouraud_rgba();
span_gen.colors(points[0].color, points[1].color, points[2].color);
span_gen.triangle(points[0].position.x, points[0].position.y, points[1].position.x, points[1].position.y, points[2].position.x, points[2].position.y);
ras.add_path(span_gen);
ScanlineRenderer scanlineRenderer = new ScanlineRenderer();
scanlineRenderer.GenerateAndRender(ras, sl, ren_base, span_alloc, span_gen);
}
开发者ID:CodeMangler,项目名称:MatterControl,代码行数:16,代码来源:ThumbnailTracer.cs
示例20: ImageGraphics2D
public ImageGraphics2D(IImageByte destImage, ScanlineRasterizer rasterizer, IScanlineCache scanlineCache)
: base(destImage, rasterizer)
{
m_ScanlineCache = scanlineCache;
}
开发者ID:CNCBrasil,项目名称:agg-sharp,代码行数:5,代码来源:ImageGraphics2D.cs
注:本文中的IImageByte类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论