本文整理汇总了C#中IImageByte类的典型用法代码示例。如果您正苦于以下问题:C# IImageByte类的具体用法?C# IImageByte怎么用?C# IImageByte使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IImageByte类属于命名空间,在下文中一共展示了IImageByte类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
示例2: AlphaMaskAdaptor
public AlphaMaskAdaptor(IImageByte image, IAlphaMask mask)
: base(image)
{
linkedImage = image;
m_mask = mask;
m_span = new ArrayPOD<byte>(255);
}
示例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();
}
}
示例4: ButtonViewThreeImage
public ButtonViewThreeImage(IImageByte normal, IImageByte hover, IImageByte pressed)
{
hoverOpacity = 0;
normalIMage = normal;
hoverImage = hover;
pressedImage = pressed;
}
示例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);
}
示例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);
}
}
}
示例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]);
}
}
示例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();
}
示例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();
}
}
示例10: AlphaMaskByteUnclipped
public AlphaMaskByteUnclipped(IImageByte rbuf, uint Step, uint Offset)
{
m_Step = Step;
m_Offset = Offset;
m_rbuf = rbuf;
}
示例11: attach
public void attach(IImageByte rbuf)
{
m_rbuf = rbuf;
}
示例12: Graphics2D
public Graphics2D(IImageByte destImage, ScanlineRasterizer rasterizer)
: this()
{
Initialize(destImage, rasterizer);
}
示例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);
//.........这里部分代码省略.........
示例14: Render
public abstract void Render(IImageByte imageSource,
double x, double y,
double angleRadians,
double scaleX, double ScaleY);
示例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);
}