A kind of method for drafting of big pixel B MP format-pattern
Technical field
The present invention relates to drawing for software programming technical field of image processing more particularly to a kind of big pixel B MP format-pattern
Method processed.
Background technique
Pixel coordinate is converted into generally by acquisition two-dimensional vector coordinate to the processing method of image in program then to adjust
Such as with drawing tools library: EasyX, GDI, GUI draw picture, but these tool storage rooms such as EasyX, GDI, GUI can be drawn
The pixel size of picture has certain limitation, and when the pixel size of picture limits range beyond it, program can not establish the picture
The painting canvas of plain size or the painting canvas of the pixel size can establish success, but image can only draw out part, cannot draw
Complete picture out, therefore the picture of big pixel has been depicted as certain technical bottleneck.
For example, the BMP format picture that 60253*17181 pixel is drawn in the drawing tools library that C++ is provided can only draw striking out
Portion's picture.Referring in detail to the following figure, wherein Fig. 1 is that target draws picture, and Fig. 8 is the imperfect picture of practical drafting.
Summary of the invention
It is necessary to propose a kind of method for drafting of big pixel B MP format-pattern.
A kind of method for drafting of big pixel B MP format-pattern, comprising the following steps:
The first image and the second image will be divided into advance to drawing image;
The first painting canvas is established, the second painting canvas is established;
The occupied parts of images position of second image is plucked out on the first painting canvas, and is deposited to second painting canvas, and
The mark coordinate points of the parts of images position plucked out are recorded on the first painting canvas;
The first image and the second image are drawn on the first painting canvas and the second painting canvas respectively;
The second painting canvas for having the second image will be drawn to be filled in inside the first painting canvas, keep the origin coordinates point and the of the second painting canvas
Mark coordinate points on one painting canvas are overlapped, and are formed in the big image drawn on same painting canvas;
The output of first painting canvas is stored in final BMP file, the output for scratching the big pixel image of totem culture is completed.
Preferably, the maximal side of the first image and the second image is not more than 60253/2.
Preferably, recorded on first painting canvas coordinate of the mark coordinate points of parts of images position plucked out for (Xa,
Ya, W, H), wherein Xa, Ya are respectively the coordinate and Y axis coordinate of the X-axis of painting canvas, and W is the length of the part painting canvas plucked out, and H is
The height of the part painting canvas plucked out, with to the parts of images plucked out position and profile uniquely positioned.
Preferably, the first image, the second image, third image will be divided into advance along X-direction to drawing image;
The first painting canvas is established, the second painting canvas is established, establishes third painting canvas;
The occupied second part picture position of second image is plucked out on the first painting canvas, and is deposited to second painting canvas
On, and the second identifier coordinate points of the second part picture position plucked out are recorded on the first painting canvas;It is scratched on the first painting canvas
The occupied Part III picture position of the third image out, and deposit to the third painting canvas, and remember on the first painting canvas
Record the third mark coordinate points of the Part III picture position plucked out;
The first image, the second image, third image are drawn on the first painting canvas, the second painting canvas, third painting canvas respectively;
The second painting canvas for having the second image will be drawn to be filled in inside the first painting canvas, keep the origin coordinates point and the of the second painting canvas
Second identifier coordinate points on one painting canvas are overlapped;The third painting canvas for having third image will be drawn to be filled in inside the first painting canvas, protected
It holds the origin coordinates point of third painting canvas to be overlapped with the third mark coordinate points on the first painting canvas, is formed on same painting canvas and draws
The big image arrived;
The output of first painting canvas is stored in final BMP file, the output for scratching the big pixel image of totem culture is completed.
Preferably, the first image, the second image, third figure will be divided into advance along X-axis and Y direction to drawing image
Picture;
The first painting canvas is established, the second painting canvas is established, establishes third painting canvas;
The occupied second part picture position of second image is plucked out on the first painting canvas, and is deposited to second painting canvas
On, and the second identifier coordinate points of the second part picture position plucked out are recorded on the first painting canvas;It is scratched on the first painting canvas
The occupied Part III picture position of the third image out, and deposit to the third painting canvas, and remember on the first painting canvas
Record the third mark coordinate points of the Part III picture position plucked out;
The first image, the second image, third image are drawn on the first painting canvas, the second painting canvas, third painting canvas respectively;
The second painting canvas for having the second image will be drawn to be filled in inside the first painting canvas, keep the origin coordinates point and the of the second painting canvas
Second identifier coordinate points on one painting canvas are overlapped;The third painting canvas for having third image will be drawn to be filled in inside the first painting canvas, protected
It holds the origin coordinates point of third painting canvas to be overlapped with the third mark coordinate points on the first painting canvas, is formed on same painting canvas and draws
The big image arrived;
The output of first painting canvas is stored in final BMP file, the output for scratching the big pixel image of totem culture is completed.
The present invention solves to draw using common drawing practice using the method for scratching figure supplement on same size painting canvas
The problem of making larger pixel picture, this method is understanding and code is realized upper relatively simple, conveniently, there is certain use value.
Detailed description of the invention
Fig. 1 is the schematic diagram of big image to be drawn.
Fig. 2 is the schematic diagram of the parts of images position plucked out on the first painting canvas.
Fig. 3 is the schematic diagram of the first painting canvas of C++.
Fig. 4 is the schematic diagram of the second painting canvas of C++.
Fig. 5 is the schematic diagram that the first image is drawn on the first painting canvas.
Fig. 6 is the schematic diagram that the second image is drawn on the second painting canvas.
Fig. 7 is the schematic diagram that the second image is replenished to the big image on the first painting canvas.
Fig. 8 is the image that the prior art uses C++ to draw.As it can be seen that the second image can not be complete on painting canvas in figure
Whole be drawn comes out.
Fig. 9 is the schematic diagram for treating another division mode of big image progress of drafting.
Figure 10 is the schematic diagram drawn on the second painting canvas to the second image that Fig. 9 is divided.
Figure 11 is the schematic diagram drawn on third painting canvas to the third image that Fig. 9 is divided.
Figure 12 is to treat the big image of drafting to carry out the schematic diagram of the third division mode.
Figure 13 is the schematic diagram drawn on the second painting canvas to the second image that Figure 12 is divided.
Figure 14 is the schematic diagram drawn on third painting canvas to the third image that Figure 12 is divided.
In figure: the first image 10, the second image 20, the first painting canvas 30, the second painting canvas 40, parts of images position 50, second
Parts of images position 60, Part III picture position 70, second part picture position 601, Part III picture position 701.
Specific embodiment
In order to illustrate the technical solution of the embodiments of the present invention more clearly, below will be to needed in the embodiment attached
Figure is briefly described, it should be apparent that, drawings in the following description are some embodiments of the invention, common for this field
For technical staff, without creative efforts, it is also possible to obtain other drawings based on these drawings.
Referring to Fig. 1 to Fig. 7, the embodiment of the invention provides a kind of method for drafting of big pixel B MP format-pattern, including with
Lower step:
The first image 10 and the second image 20 will be divided into advance to drawing image;
Establish the first painting canvas 30;
The second painting canvas 40 is established, the occupied parts of images position 50 of second image 20 is plucked out on the first painting canvas 30, (i.e.
Second image 20 is the parts of images that drawing image is unable on the first painting canvas 30) and deposit to second painting canvas 40, and
Mark coordinate points A(Xa, Ya of the parts of images position 50 plucked out are recorded on first painting canvas 30);
The first image 10 and the second image 20 are drawn on the first painting canvas 30 and the second painting canvas 40 respectively;
The second painting canvas 40 for having the second image 20 will be drawn and be filled in 30 the inside of the first painting canvas, the starting of the second painting canvas 40 is kept to sit
Punctuate B(Xb, Yb) with mark coordinate points A(Xa, Ya on the first painting canvas 30) be overlapped, be formed on same painting canvas (i.e. first draw
Cloth 30) draw obtained big image;
The output of first painting canvas 30 is stored in final BMP file, the output for scratching the big pixel image of totem culture is completed.
Further, the maximal side of the first image and the second image is not more than 60253/2.It is used due to the present invention
The maximum array that paint program can identify in drawing tool is 232, and array length occupied in painting canvas is not more than
60253/2, in order to avoid image cannot completely be shown in painting canvas, so the maximal side that limitation divides image is not more than
60253/2。
Further, the coordinate that the mark coordinate points of the parts of images position plucked out are recorded on first painting canvas is A
(Xa, Ya, W, H), wherein Xa, Ya are respectively the coordinate and Y axis coordinate of the X-axis of painting canvas, and W is the length of the part painting canvas plucked out
Degree, H is the height of the part painting canvas plucked out, with to the part painting canvas plucked out position and profile uniquely positioned.
Further, the method for the present invention can also carry out multiple way partition to big pixel image, which includes same side
To division and different directions division.For example, following improved method one is along unidirectional division, improved method two is
Along the division of different directions, and so on, the method for the present invention is suitable for that larger image is divided in all directions and is divided into
The drafting of image of different nature.
Fig. 9-Figure 11 is participated in, the first image, the second image, third figure improved method one: will be divided into advance to drawing image
Picture;The division methods are to divide image along X-direction.
Establish the first painting canvas;
The second painting canvas is established, third painting canvas is established, the occupied second part figure of second image is plucked out on the first painting canvas
Image position 60, and depositing to second painting canvas, and the of the second part picture position plucked out is recorded on the first painting canvas
Two mark coordinate points C(Xc, Yc);The occupied Part III picture position 70 of the third image is plucked out on the first painting canvas,
And it deposits to the third painting canvas, and the third mark coordinate of the Part III picture position plucked out is recorded on the first painting canvas
Point D(Xd, Yd);
The first image, the second image, third image are drawn on the first painting canvas, the second painting canvas, third painting canvas respectively;
The second painting canvas for having the second image will be drawn to be filled in inside the first painting canvas, keep the origin coordinates point C ' of the second painting canvas with
Second identifier coordinate points C on first painting canvas is overlapped;The third painting canvas for having third image will be drawn to be filled in inside the first painting canvas,
It keeps the origin coordinates point D ' of third painting canvas to be overlapped with the third mark coordinate points D on the first painting canvas, is formed on same painting canvas
Draw obtained big image;
The output of first painting canvas is stored in final BMP file, the output for scratching the big pixel image of totem culture is completed.
Figure 12-Figure 14 is participated in, the first image, the second image, third figure improved method two: will be divided into advance to drawing image
Picture;The division methods are to divide image along X-axis and Y axis direction.
Establish the first painting canvas;
The second painting canvas is established, third painting canvas is established, the occupied second part figure of second image is plucked out on the first painting canvas
Image position 601, and depositing to second painting canvas, and the of the second part picture position plucked out is recorded on the first painting canvas
Two mark coordinate points C1(Xc, Yc);The occupied Part III picture position of the third image is plucked out on the first painting canvas
701, and deposit to the third painting canvas, and the third mark of the Part III picture position plucked out is recorded on the first painting canvas
Coordinate points D1(Xd, Yd);
The first image, the second image, third image are drawn on the first painting canvas, the second painting canvas, third painting canvas respectively;
The second painting canvas for having the second image will be drawn to be filled in inside the first painting canvas, keep the origin coordinates point C1 ' of the second painting canvas
It is overlapped with the second identifier coordinate points C1 on the first painting canvas;There is the third painting canvas of third image to be filled in the first painting canvas drafting
Face keeps the origin coordinates point D1 ' of third painting canvas to be overlapped with the third mark coordinate points D1 on the first painting canvas, is formed in same picture
The big image drawn on cloth;
The output of first painting canvas is stored in final BMP file, the output for scratching the big pixel image of totem culture is completed.
Module or unit in the device of that embodiment of the invention can be combined, divided and deleted according to actual needs.
The above disclosure is only the preferred embodiments of the present invention, cannot limit the right model of the present invention with this certainly
It encloses, those skilled in the art can understand all or part of the processes for realizing the above embodiment, and wants according to right of the present invention
Made equivalent variations is sought, is still belonged to the scope covered by the invention.