c++ - Want to place several images with transparent colour on the same background -
I have a transparent background on the same background with many graphics GDI to search for space. I did not have any programming experience before Windows or graphic programming (like games), so finding solutions is more difficult. GDI + is a transparent color GDI + only uses transparent information to make this color properly bitmap on another image once after the bitmap, however, the first image is no more transparent. If you put the same picture several times in the same background, you will see that only the first appointment was transparent.
My problem is keeping many transparent items on the background at one time. You can work the code given below for a ship (nNrOfShips = 1;) If you type a big value for this variable, then no ship will be placed.
How should I modify the code? I also tried to use the ship array, but no ship is visible on the screen. You can make your own example using a background with a slightly changing color and just keep the image transparently. I hope this example will help me.
Examples of code here ...
HDC HDC screen = Gayle lockscreen (); M_hdcShip = CreateCompatibleDC (HDScreen); ReleaseLockedScreen (); // Draw the image of the ship on the restored background Draft graphics grBkg (m_hdcNewBackground); GrBkg.SetSmoothingMode (SmoothingModeHighQuality); // Restore new background BitBlt (m_hdcNewBackground, 0, 0, GetWtsMetrics (wtsm_ScreenSizeX), GetWtsMetrics (wtsm_ScreenSizeY), m_hdcSavedBackground, 0, 0, SRCCOPY); // 20100125 SAE BYTE nNrOfShips = 1; // data-> GetNrOfShips (); (BYTE nShipId = 0; nShipId & lt; nNrOfShips; nShipId ++) for (ship = data-& gt; GetShipList () [nShipId]; Ship model Ship Moodel = data-& gt; Khojःship model (ship. Anshipodelaidi ); // 20100202 SAE WORD nCurResId = data-& gt; FindCurShipResourceId (ship); // 20100131 SAE WORD nIndex = nCurResId - Jhajmodel.anfstrsaidi; // 20100131 SAE (Anaiandiiaks; = 0) emphasizes: ship Reshors Shipres = (* Shipmodel. PvectResource) [NIDX]; // 20100202 SAE // 20100126 SAE // Always take coordinates (top left) before the ship rectangle: QuadrantVector and wpQuadrants = * Data-> GetWallpapers () [Data-& gt; Cynwalpr ()]. PvectQuadrant; Do {// 20100115 SAE: Determine the coordinates of the ship. VectRectangle = DATA-> RandomRectangleCoordinates (shipModel.nHeight, shipModel.nWidth);} while (! Data- & Gt; Arcrirdinets Valid (Ship.VectorContein, WP Quadors) & amp; Data- & gt; AriashipTutclos (Ship, Data-> Gatesistlist), Data- gt; GetDistance ())); GrBkg.TranslateTransform (ship.vectRectangle [0] .fx, ship.vectRectangle [0] .fY); Grbkgkrottetronsform (0); // 20100201 SAE GRBKG.Drimez (ShipRPS.Pimegas, Pichmodel.Navignith / 2, -Phshmodel.NHite / 2); // Limit ship rectangle after drawing on changed page / 20100125 SAE Rect rcSrc (-shipmodel.nwidth / 2, -shipmodel.nHeight / 2, shipModel.nWidth, shipModel.nHeight); Transformform (& amp; grbkg, & amp; m_rcrichip; & amp; rcsrc, coordinate spaces page, coordinate spreadsworld); } // DeleteDC (m_hdcShip); M_hdcShip = 0;
Bitmap on images when you load them. Use the matrixprint () method. You have to select the picture, which is the color of the background for those pictures, with the transparency selected in the graphics editor, there will be another way to store images in PNG format.
Comments
Post a Comment