ImageExtensionsDrawInto(Image, Bitmap, Rectangle, Point, IDitherer) Method
Draws the
source Image into the
target Bitmap
without scaling. This method is similar to
Graphics.DrawImage
methods, except that this one always preserves the source size in pixels, works between any pair of source and target
PixelFormats and supports quantizing and dithering.
For scaling use the overloads with
targetRectangle and
ScalingMode parameters.
Namespace: KGySoft.DrawingAssembly: KGySoft.Drawing (in KGySoft.Drawing.dll) Version: 8.1.0
public static void DrawInto(
this Image source,
Bitmap target,
Rectangle sourceRectangle,
Point targetLocation,
IDitherer? ditherer
)
<ExtensionAttribute>
Public Shared Sub DrawInto (
source As Image,
target As Bitmap,
sourceRectangle As Rectangle,
targetLocation As Point,
ditherer As IDitherer
)
public:
[ExtensionAttribute]
static void DrawInto(
Image^ source,
Bitmap^ target,
Rectangle sourceRectangle,
Point targetLocation,
IDitherer^ ditherer
)
[<ExtensionAttribute>]
static member DrawInto :
source : Image *
target : Bitmap *
sourceRectangle : Rectangle *
targetLocation : Point *
ditherer : IDitherer -> unit
- source Image
- The source Image to be drawn into the target.
- target Bitmap
- The target Bitmap into which source should be drawn.
- sourceRectangle Rectangle
- A Rectangle that specifies the portion of the source to be drawn into the target.
- targetLocation Point
- The target location. Target size will be always the same as the source size.
- ditherer IDitherer
- The ditherer to be used for the drawing. Might be ignored if target PixelFormat format has at least 24 bits-per-pixel size.
In Visual Basic and C#, you can call this method as an instance method on any object of type
Image. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
The image to be drawn is automatically clipped if its size or targetLocation makes it impossible to completely fit in the target.
If target can represent a narrower set of colors, then the result will be automatically quantized to the colors of the target.
To use dithering a ditherer must be explicitly specified.
This overload does not resize the image even if source and target have different DPI resolution.