BarcodeMaxiCodeGetSize Method (GdPictureImaging)
In This Topic
Returns the size, in pixels, required to render a MaxiCode on a Bitmap.
Syntax
'Declaration
Public Function BarcodeMaxiCodeGetSize( _
ByVal As Integer, _
ByVal As Integer, _
ByRef As Integer, _
ByRef As Integer _
) As GdPictureStatus
public GdPictureStatus BarcodeMaxiCodeGetSize(
int ,
int ,
out int ,
out int
)
public function BarcodeMaxiCodeGetSize(
: Integer;
: Integer;
Out : Integer;
Out : Integer
): GdPictureStatus;
public function BarcodeMaxiCodeGetSize(
: int,
: int,
: int,
: int
) : GdPictureStatus;
public: GdPictureStatus BarcodeMaxiCodeGetSize(
int ,
int ,
[PARAMFLAG::Out] int ,
[PARAMFLAG::Out] int
)
public:
GdPictureStatus BarcodeMaxiCodeGetSize(
int ,
int ,
[Out] int ,
[Out] int
)
Parameters
- QuietZone
- The number of modules considered as quiet zone around the barcode.
- ModuleSize
- The distance, in pixels, between two modules on the same horizontal line.
- Width
- Output parameter. The width, in pixels, required to render the whole MaxiCode.
- Height
- Output parameter. The height, in pixels, required to render the whole MaxiCode.
Return Value
A member of the GdPictureStatus enumeration.
Example
Rendering a MaxiCode into a new image and saving the result into a png file.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
// String with numbers, which have to be encoded into a barcode.
string data = "123456";
Color fillColor = gdpictureImaging.ARGB(255, 0, 0, 0);
Color backColor = gdpictureImaging.ARGB(0, 255, 255, 255);
int dstLeft = 10;
int dstTop = 10;
// Compute size (in pixels), required to render a MaxiCode.
gdpictureImaging.BarcodeMaxiCodeGetSize(1, moduleSize, out int width, out int height);
int imageID = gdpictureImaging.CreateNewGdPictureImage(width, height, 32, Color.White);
gdpictureImaging.BarcodeMaxiCodeWrite(imageID, data, ref version, 23, 0, moduleSize, dstLeft, dstTop, 0, fillColor, backColor);
gdpictureImaging.SaveAsPNG(imageID, "output.png");
// Release used resources.
gdpictureImaging.ReleaseGdPictureImage(imageID);
}
Example
Rendering a MaxiCode into a new image and saving the result into a png file.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
// String with numbers, which have to be encoded into a barcode.
string data = "123456";
Color fillColor = gdpictureImaging.ARGB(255, 0, 0, 0);
Color backColor = gdpictureImaging.ARGB(0, 255, 255, 255);
int dstLeft = 10;
int dstTop = 10;
// Compute size (in pixels), required to render a MaxiCode.
gdpictureImaging.BarcodeMaxiCodeGetSize(1, moduleSize, out int width, out int height);
int imageID = gdpictureImaging.CreateNewGdPictureImage(width, height, 32, Color.White);
gdpictureImaging.BarcodeMaxiCodeWrite(imageID, data, ref version, 23, 0, moduleSize, dstLeft, dstTop, 0, fillColor, backColor);
gdpictureImaging.SaveAsPNG(imageID, "output.png");
// Release used resources.
gdpictureImaging.ReleaseGdPictureImage(imageID);
}
See Also