Image Filter Design and Implementation Based On API
Image Filter Design and Implementation Based On API
Abstract—In this paper, Visual Basic development platform to Windows systems combined experience of more directly to
implement the general professional image software can only be the power of API functions.
used to complete the image filter processing, the main In practice, in order to obtain a more accurate color
application the power of Windows API functions, on the one image filter processing used, simply, that is to see the image
hand improve the ability of VB's advanced application through a color change in the color image processing to
programming, the other hand, image processing also a new achieve some special effects, often used in cell analysis ,
understanding of the field. In fact, the Visual Basic program blood tests and other medical fields, with photography and
development environment through the use of API Viewer is other aspects of digital photography and the everyday life of
simple and convenient way to call the API function, not only
sunglasses and other simple products. Therefore, the use of
provides a completely different programming approach in the
Windows environment, but also the user into the core of
filter handle situations is very extensive analysis of the
operating system for advanced programming a way, it shows process it is very necessary, and most people are accustomed
the VB language specific features and attributes of other to using image processing professional image processing
programming language can not be completed. The design is software such as PhotoShop, few people can think of VB to
based on API functions GetPixel and SetPixel features and accomplish this same work, which can be seen not only the
functions, first introduced the general principles of VB design of the VB language advanced applications, but also
interface design, and the image filter interface design in detail broaden people's ideas to solve the problem, and the image
of the VB form; then combined GetPixel and SetPixel API filter processing a more thorough understanding.
functions are introduced in detail statement and call the
method; then introduces the VB method in the basic color II. FORMS INTERFACE DESIGN
settings, and preparation of the corresponding event procedure Visual Basic by dragging the mouse controls on the form
code to implement a variety of monochrome images and mixed the way for the creation of user interface provides a very
color filter processing; the system user-friendly, readable, easy way, form design and planning not only affect the
concise efficient, the last run result is correct, to achieve design appearance of its own can watch, but also the operability of
goals, VB platform allows users to experience the powerful
the application there is also a important role[2]. Therefore,
function of Windows API programming skills and capability.
the interface design can begin, first form to be designed to
Keywords-API Function;vb Advanced Applications; Image draw a draft on paper, and then consider what control is
filter; DLL library needed, the link between the control and end up in handy.
A. Drag the position of the control arrangements
I. INTRODUCTION Controls the positioning of the more important position
Application Programming Interface (API) is a major in the clear, important and requires frequent access controls
group of pre-written with C language functions and should be in a prominent position, the secondary should be in
procedures.in the Dynamic-Link Libraries(DLL). Usually control is a secondary position. Appropriate controls and
when you install Windows operating system, these functions elements of the group is also very important, and generally in
and processes to be installed, therefore, use the API accordance with the control in the functional link them
functions on various platforms, not only can fully tap the together, than in the visual effects are also scattered them
potential of its Windows operating system, and be able to around the screen much better.
develop powerful applications to the various Show each
B. Control the size and consistency of layout
platform-specific features and attributes. This article for
Visual Basic, the most simple way is to use a predefined API Reasonable to set the size of the control to achieve
provided a statement to declare the DLL as long as the consistency in interface design is one of the important issues,
external procedure or function, you can call the same as its consistency, appearance will reflect the application of
internal processes and implemented[1]. Of course, the main coordination. If the lack of consistency will make the
use in the design and SetPixel GetPixel two colors on the interface confusing and chaotic, so the interface will make
API function of the image pixels, and then be able to achieve the application look confusing and not strict, not only on the
the relevant set of monochrome image or a combination of user's inconvenience, or even the user that the application is
color filters, allowing users to VB perfect platform and not reliable.
D. Rational use of color and display to achieve the unity of B. API Function Call
content and form As long as the API function is declared, then the function
According to the experience of many programmers, call approach is very simple and convenient. Function call
applications should try to limit the types of color and tone with the Visual Basic function call within the function is
should be consistent. In addition, the use of images and icons similar, you can call directly in the expression. The format is:
can also increase the visual impact of the application, a Process name <parameter list>
reasonable choice of a variety of user interface display, but x Function procedure returns a value.
also to express a specific design intent. x If you sometimes do not need to process the return
The emergence of Visual Basic simplifies the design of value, Function can also be written as the Sub
Windows programming interface,it is very easy to design procedure call as a separate statement, the call
and implement standards and consistent with the general format: Call procedure name [(parameter list)] or
characteristics of the interface. According to the design procedure name [parameter list].
requirements, first start VB6.0 application and automatically First of all here in course of the incident by Rgbp =
create a name in the project form as Form1; and then, in its GetPixel (PicHdc, i, j) statement GetPixel function call to
form to add a PictureBox control, one control groups that complete to obtain a point in the image pixel RGB value;
contains three TextBox, one control group contains three then the red, green, blue three primary colors of a point pixel
HScrollBar and two CommandButton controls, the interface color filter processing of various colors, have a point the new
design shown in Figure 1, of course, also need to modify the RGB pixel values; Finally SetPixel PicHdc, i, j, Rgbp
form and the control of the property value in the Properties statement SetPixel function of procedure call, set the value
window; Finally, add a public module named Module1 to with the new RGB pixel color of a point complete the
project. corresponding color image filter.
IV. SYSTEM IMPLEMENTATION AND RUN
240
corresponding to the color code. Format: QBColor
(color), which, color parameter is a sector in an
integer from 0 to 15, representing 16 kinds of colors.
x Long integer to directly specify the color, and often
expressed in hexadecimal. Format: & HBBGGRR,
of which, BB specify the value of the blue color, GG
specified the value of the green color, RR specified
the value of the red color. Each color value is a
hexadecimal number by two, the range of 00 ~ FF. Figure 3. Yellow Filter
x In the Visual Basic system has been pre-defined
color constants commonly used colors, a common
color constants (ColorConstants) and the colors used V. CONCLUSION
in Windows Control Panel (SystemColorConstants). API is used to control the Windows operating system
Through the "View" menu in the "Object Browser" appearance and behavior of the various components of a pre-
check list of common color constants. defined functions. If the associated application can directly
B. Implementation and Performance call the API function is to provide the service using the
First, write code in Form_Load event procedure, set the system, which will make it run more streamlined and
form's ScaleMode property value, set the PictureBox's efficient, especially in Visual Basic language in this area
ScaleMode, AutoRedraw and AutoRedraw property value, very well, by using the API Viewer that is simpler The
set the TextBox's Text property value[4]. And then in the method provides programming in the Windows environment,
process of writing code HS1_Change event, able to represent a completely different approach. The design of this by
the three colors of the scroll bar value of the rolling block is calling GetPixel and SetPixel 2 API functions to achieve a
displayed in the appropriate TextBox. Then write in the variety of monochrome images and mixed color filter,
Cmd2_Click event procedure code to call the API function allowing users to further experience the VB platform
can be achieved in the picture on the PictureBox filter out. powerful programming capabilities.
The last event in the process of writing code Cmd1_Click REFERENCES
PictureBox in the picture on the color recovery.
[1] Weijiang Jiang and Shaojing Lin, Visual Basic API programming
This design can be respectively red, green, blue and other hundred cases pass, Science Press, October 2001, pp.10-13
color filters to achieve complete, such as running a red drag [2] “VB in the user interface design principles” June 2008, Source: enet,
the horizontal scroll bar to the maximum, the corresponding http://www.searchdatabase.com.cn/ShowContent_8823.htm
TextBox shows a red 100%, then click the Filter command [3] API Function Descriptions, http://www.programfan.com/vbapi.asp
button the picture box image to the red filter, run the results [4] Dingxue Wu, Visual Basic Programming, Science Press, February
shown in Figure 2. 2008, pp.56-59
[5] “An image filter processing”, http://www.chinavb.net
241