На главную Наши проекты:
Журнал   ·   Discuz!ML   ·   Wiki   ·   DRKB   ·   Помощь проекту
ПРАВИЛА FAQ Помощь Участники Календарь Избранное RSS
msm.ru
! Правила раздела Visual C++ / MFC / WTL (далее Раздела)
1) На Раздел распространяются все Правила Форума.
2) Перед тем, как создать новый топик, убедитесь, что Вы читали Правила создания тем в Разделе.
3) Вопросы, не связанные с программированием (настройки MS Visual Studio, книги, библиотеки и т.д.),
обсуждаются в разделе C/C++: Прочее
4) Вопросы разработки .NET (Windows Form, C++/CLI и т.п.) приложений на Visual C++/C# обсуждаются в разделе .NET.
5) Нарушение Правил может повлечь наказание со стороны модераторов.

Полезные ссылки:
user posted image FAQ Раздела user posted image Обновления для FAQ Раздела user posted image Поиск по Разделу user posted image MSDN Library Online
Модераторы: ElcnU
  
> Перевернуть изображение
    Мне нужно для вывода BMP перевернуть ее на 180 по вертикали градусов. Вывод  спомощью BitBlt.
      Тут уже был такой топик
      http://pascal.sources.ru/cgi-bin/forum/YaBB.cgi?board=cpp;action=display;num=1014120491
        Есть две большие разницы повернуть изображение под любым углом  и перевернуть вверх ногами :).  Есть функция это делает с контекстом. Я забыл как она пишется и поваричивает она все или только один. :(
          Хэлп по CDC::PlgBlt тебя устроит? Имхо ты ее имеешь ввиду.
            Тьфу, ядрена кочерыжка. PlgBlt имеется ввиду.
              ExpandedWrap disabled
                <br>BOOL PlgBlt( POINT lpPoint, CDC* pSrcDC, int xSrc, int ySrc, int nWidth, int nHeight, CBitmap& maskBitmap, int xMask, int yMask );<br><br>Return Value<br><br>Nonzero if the function is successful; otherwise 0.<br><br>Parameters<br><br>lpPoint<br><br>Points to an array of three points in logical space that identifies three corners of the destination parallelogram. The upper-left corner of the source rectangle is mapped to the first point in this array, the upper-right corner to the second point in this array, and the lower-left corner to the third point. The lower-right corner of the source rectangle is mapped to the implicit fourth point in the parallelogram.<br><br>pSrcDC<br><br>Identifies the source device context.<br><br>xSrc<br><br>Specifies the x-coordinate, in logical units, of the upper-left corner of the source rectangle.<br><br>ySrc<br><br>Specifies the y-coordinate, in logical units, of the upper-left corner of the source rectangle.<br><br>nWidth<br><br>Specifies the width, in logical units, of the source rectangle.<br><br>nHeight<br><br>Specifies the height, in logical units, of the source rectangle.<br><br>maskBitmap<br><br>Identifies an optional monochrome bitmap that is used to mask the colors of the source rectangle.<br><br>xMask<br><br>Specifies the x-coordinate of the upper-left corner of the monochrome bitmap.<br><br>yMask<br><br>Specifies the y-coordinate of the upper-left corner of the monochrome bitmap.<br><br>Remarks<br><br>Performs a bit-block transfer of the bits of color data from the specified rectangle in the source device context to the specified parallelogram in the given device context. If the given bitmask handle identifies a valid monochrome bitmap, the function uses this bitmap to mask the bits of color data from the source rectangle.<br><br>The fourth vertex of the parallelogram (D) is defined by treating the first three points (A, B, and C) as vectors and computing D = B + C - A.<br><br>If the bitmask exists, a value of 1 in the mask indicates that the source pixel color should be copied to the destination. A value of 0 in the mask indicates that the destination pixel color is not to be changed.<br><br>If the mask rectangle is smaller than the source and destination rectangles, the function replicates the mask pattern.<br><br>Scaling, translation, and reflection transformations are allowed in the source device context; however, rotation and shear transformations are not. If the mask bitmap is not a monochrome bitmap, an error occurs. The stretching mode for the destination device context is used to determine how to stretch or compress the pixels, if that is necessary. When an enhanced metafile is being recorded, an error occurs if the source device context identifies an enhanced-metafile device context.<br><br>The destination coordinates are transformed according to the destination device context; the source coordinates are transformed according to the source device context. If the source transformation has a rotation or shear, an error is returned. If the destination and source rectangles do not have the same color format, PlgBlt converts the source rectangle to match the destination rectangle. Not all devices support PlgBlt. For more information, see the description of the RC_BITBLT raster capability in the CDC::GetDeviceCaps member function.<br><br>If the source and destination device contexts represent incompatible devices, PlgBlt returns an error.<br>
              Сообщение отредактировано: murph -
                Это я уже советовал, но PlgBlt работает не во всех windows
                  PlgBlt, как я тут посчитал работает, только с монохромными что ли? :-/ и  на каких windows  он не работает? Но меня больше интересует та функция которая меняет орентацию контекста. (MSDN у меня нет :-[)
                    Ну вот, к примеру
                    Цитата

                    SetWorldTransform
                    The SetWorldTransform function sets a two-dimensional linear transformation between world space and page space for the specified device context. This transformation can be used to scale, rotate, shear, or translate graphics output.

                    BOOL SetWorldTransform(
                     HDC hdc,               // handle to device context
                     CONST XFORM *lpXform   // transformation data
                    );
                    Parameters
                    hdc
                    [in] Handle to the device context.
                    lpXform
                    [in] Pointer to an XFORM structure that contains the transformation data.
                    Return Values
                    If the function succeeds, the return value is nonzero.

                    If the function fails, the return value is zero.

                    Windows NT/2000/XP: To get extended error information, call GetLastError.

                    Remarks
                    For any coordinates (x, y) in world space, the transformed coordinates in page space (x', y') can be determined by the following algorithm:

                    x' = x * eM11 + y * eM21 + eDx,
                    y' = x * eM12 + y * eM22 + eDy,
                    where the transformation matrix is represented by the following:

                    | eM11 eM12 0 |
                    | eM21 eM22 0 |
                    | eDx  eDy  1 |
                    This function uses logical units.

                    The world transformation is usually used to scale or rotate logical images in a device-independent way.

                    The default world transformation is the identity matrix with zero offset.

                    The SetWorldTransform function will fail unless the graphics mode for the given device context has been set to GM_ADVANCED by previously calling the SetGraphicsMode function. Likewise, it will not be possible to reset the graphics mode for the device context to the default GM_COMPATIBLE mode, unless the world transformation has first been reset to the default identity transformation by calling SetWorldTransform or ModifyWorldTransform.

                    Example Code
                    For an example, see Using Coordinate Spaces and Transformations.

                    Requirements
                     Windows NT/2000/XP: Included in Windows NT 3.1 and later.
                     Windows 95/98/Me: Unsupported.
                     Header: Declared in Wingdi.h; include Windows.h.
                     Library: Use Gdi32.lib.


                      В моем случае задача решалась установкой отрицательной высотой. Спсибо за помощь.
                        И какую ф-ю ты применил?
                          :) Ни какой просто в заголовке при создании DIB,  я задаю ему отрицательную высоту и он получается перевернутым. :( а ту функцию (задающую направление) я не нашел.
                            Можно догадаться, что CreateDIBitmap!
                            0 пользователей читают эту тему (0 гостей и 0 скрытых пользователей)
                            0 пользователей:


                            Рейтинг@Mail.ru
                            [ Script execution time: 0,0300 ]   [ 16 queries used ]   [ Generated: 27.04.24, 21:10 GMT ]