Development of Windows 8 Direct2D-Metro application example based on Visual Studio 11 (2) international text display

Source: Internet
Author: User

Direct2d is used by Microsoft to replace DirectDraw and new technologies such as GDI and GDI + [1]. It mainly provides 2D animation hardware acceleration. Currently, it only supports Windows Vista SP2 and Windows 7 and later [2].
 
The direct2d technical architecture is built on the direct3d 10.1 API. It can build 2D images through hardware acceleration and fully supports transparent and Alpha mixing. Direct2d also supports software Rasterizer (software Rasterizer), that is, when the video card does not support hardware acceleration, direct2d can still be depicted using software, and the effect is still better than that of GDI.
 
Direct2d can use dxgi (DirectX graphics infrastructure) and interactive operations. direct2d also supports directwrite.
 
Direct2d Supports high-quality rendering and has the following features:
Supports cleartype text rendering (provided by directwrite)
Remove the original image (per primitive antialiasing)
Draw and fill in geometric shapes (straight lines, curves) and bitmap.
Solid color and linearity.
Depicts the middle layer.
Multiple geometric operations (such as unions, intersections, widening, and outlining)

The direct template is provided in Microsoft vs11.

 

After creating an application,

Insert the following code

See Code Analysis

 

 

 

 

Using namespace Microsoft: WRL; using namespace windows: ApplicationModel: core; using namespace windows: ApplicationModel: activation; using namespace windows :: ui: core; using namespace windows: system; using namespace windows: Foundation; using namespace windows: graphics: display; dwriteverticaltext: dwriteverticaltext () {} void dwriteverticaltext:: createdevicein Dependentresources () {directxbase: createdeviceindependentresources (); m_readingdirection = readingdirectionlefttorighttoptobottom; m_text = l "" "\ r \ n" L "(1948.12.10 3rd) <previous article> \ r \ n "L" \ r \ n "L" social networking organization members shall respect and respect the inherent principles of equality. zookeeper was admitted to the legal authority, the world's legal authority, justice and justice, and the legal authority. \ n "L" \ r \ n "L" people cannot attack or attack others, and the conscience of human beings cannot be avoided. he believes in freedom and freedom, terrorism, and lack of freedom, and the arrival of the world. statement of thumb-ups and \ r \ n "L" \ r \ n "L" Inter-Person Authentication System Later, some measures have been taken to prevent them from being reversed, and some other measures have been taken to control them. please refer to the following information: \ r \ n "L" \ r \ n "L" please refer to the following information: \ r \ n "L" \ r \ n "L", primary school, primary school, primary school large numbers of people are free to participate in social development, social development, water development, upward promotion, and promotion" L "\ r \ n" L "joined the country, the United States, and the United States, and the United States, the United States he has made a letter, and he has vowed to accept the letter, \ r \ n "L" \ r \ n "L" こらの and free trial. zookeeper is a commonly used tool. It can be used to understand and agree with the letter of commitment. zookeeper is an important component of zookeeper. \ r \ n "L" \ r \ n "L" zookeeper, Zookeeper, and zookeeper will renew, \ r \ n "L" social networking Personal and mobile phone numbers, and world-wide declaration of human rights are often used to read, set up, operate, and join people's websites in other countries. in the lower-level regions of the State Administration of Taxation, the number of people in the region is reduced, and the number of people in the region is reduced, and the number of people in the region is improved. he was taken into consideration and was taken into consideration by general measures. He was sure to ensure that he was still making great efforts to keep his website updated, and he was very familiar with the situation. the Communist Party of China has become a member of the Communist Party of China. \ R \ n "L" \ r \ n "L" 1st \ r \ n "L" cannot be used between people, and cannot be used directly. free trial, renewal, and renewal. In terms of human experience and rational conscience, we strongly recommend that you implement dynamic communication, and mutual communication between the two parties. \ R \ n "L" \ r \ n "L" Article 2nd "L" contains manipulation, human species, skin colors, nature, words, religion, politically, he expressed his opinion, \ r \ n "L" \ r \ n "L" national identity, social identity, and geographic identity. he is in another position, and he is still in charge of other products, such as zookeeper \ r \ n "L" \ r \ n "L" he is free of charge. He is not in charge of other products. legal disclaimer legal disclaimer too many other users. \ R \ n "L" \ r \ n "L" さに, individuals belong to mainland China and other regions, and the independent country is in mainland China. alibaba \ r \ n "L" \ r \ n "L" zookeeper, non-autonomous region zookeeper, and other zookeeper then, the following questions are raised: the country's top ranking is based on the country's leading position. \ R \ n "L" \ r \ n "L" 3rd \ r \ n "L" cannot be found in humans, life, freedom, and physical fitness. zookeeper has zookeeper. \ R \ n "L" \ r \ n "L" 4th articles \ r \ n "L" He/O, and his/her slaves too many other users. The system of slaves and the system of slaves \ r \ n "L" \ r \ n "L" zookeeper, Zookeeper, and zookeeper are prohibited. \ R \ n "L" \ r \ n "L" 5th \ r \ n "L" he/she was the victim, copied and abused, and was not humane. he was humiliated by the attackers, and he was sentenced to death. \ r \ n "L" \ r \ n "L" was denied by the attackers. \ R \ n "; m_fontname = l" "; m_localename = l" "; m_textlength = 0; m_fontsize = 14; m_fontname = l" meiryo UI "; m_localename = l "Ja-JP"; m_readingdirection = direction; DX: throwiffailed (m_dwritefactory-> createtextformat (m_fontname, nullptr, delimiter, delimiter, struct, m_fontsize, m_localename, & m_textformat);} void metadata: createdeviceresources () {directxbase: createdeviceresources (); m_sampleoverlay = ref new sampleoverlay (); m_sampleoverlay-> initialize (callback (), m_d2dcontext.get (), aggregate (), aggregate (), "directwrite vertical text sample"); DX: throwiffailed (m_d2dcontext-> createsolidcolorbrush (d2d1:: Black), & m_blackbrush);} void dwriteverticaltext: createwindowsizedependentresources () {directxbase: callback (); required size = m_d2dcontext-> getsize (); m_flowlayoutsource = new flowlayoutsource; m_flowlayoutsink = new flowlayoutsink (inflow (); m_flowlayout = new flowlayout (inflow (); m_flowlayout-> settextformat (m_textformat.get (); m_flowlayout-> setreadingdirection (m_readingdirection ); m_flowlayout-> setreadingdirection (m_readingdirection); If (rows = 0) {m_textlength = static_cast <uint32> (wcsnlen (m_text, plain);} m_flowlayout-> settext (m_text, m_textlength); m_flowlayout-> analyzetext (); m_flowlayoutsource-> setsize (size. width, size. height); m_flowlayoutsource-> Reset (); m_flowlayoutsink-> Reset (); m_flowlayout-> flowtext (m_flowlayoutsource.get (), transform ();} void dwriteverticaltext: render () {m_d2dcontext-> begindraw (); m_d2dcontext-> clear (d2d1: colgrading (d2d1: collf: cornflowerblue); m_d2dcontext-> settransform (d2d1: matrix3x2f :: identity (); m_flowlayoutsink-> drawglyphruns (values (), values (), m_blackbrush.get (); hresult hR = m_d2dcontext-> enddraw (); If (hR = d2derr_recreate_target) {m_d2dcontext-> settarget (nullptr); m_d2dtargetbitmap = nullptr; equals () ;}else {DX: equals (HR) ;}m_sampleoverlay-> render ();} void dwriteverticaltext:: Initialize (_ in _ coreapplicationview ^ applicationview) {applicationview-> activated + = ref new typedeventhandler <coreapplicationview ^, iactivatedeventargs ^> (this, & dwriteverticaltext: onactivated );} void dwriteverticaltext: setwindow (_ in _ corewindow ^ window) {window-> pointercursor = ref new corecursor (corecursortype: Arrow, 0 ); window-> sizechanged + = ref new typedeventhandler <corewindow ^, blank ^> (this, & dwriteverticaltext: onwindowsizechanged); displayproperties: logicaldpichanged + = ref new handler (this, & dwriteverticaltext: Drawing); directxbase: Initialize (window, displayproperties: logicaldpi);} void dwriteverticaltext: load (platform: String ^ entrypoint) {} void dwriteverticaltext :: run () {m_window-> activate (); render (); present (); m_window-> Dispatcher-> processevents (coreprocesseventsoption: processuntilquit);} void dwriteverticaltext :: uninitialize () {} void dwriteverticaltext: onwindowsizechanged (_ in _ corewindow ^ sender, _ in _ blank ^ ARGs) {updateforwindowsizechange (); render (); present ();} void dwriteverticaltext: onlogicaldpichanged (_ in _ platform: Object ^ sender) {setdpi (displayproperties: logicaldpi); render (); present ();} void dwriteverticaltext :: onactivated (_ in _ coreapplicationview ^ applicationview, _ in _ iactivatedeventargs ^ ARGs) {m_window-> activate ();} iframeworkview ^ directxappsource: createview () {return ref new dwriteverticaltext ();} [Platform: mtathread] int main (platform: array <platform: String ^> ^) {auto directxappsource = ref new directxappsource (); coreapplication: Run (directxappsource); Return 0 ;}

 

 

Press F5 and run the command to check the effect.

 

Download vs11 now

Http://www.microsoft.com/click/services/Redirect2.ashx? Cr_cc = 200098144

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.