Sign in to follow this  
Followers 0
iamtheky

Wallpaper Scrolling

1 post in this topic

#1 ·  Posted (edited)

The combining stuff is eukalyptus' offering here:

Is there a better way to scroll the result of combined fullsize wallpapers? I am posting the whole script that will combine them then run the result.

edit: party time ending!

#include <File.au3>
#include <GDIPlus.au3>
#include <WindowsConstants.au3>
#include <extprop.au3>


_GDIPlus_Startup()

$sPath = @ScriptDir
$aFiles = _FileListToArray($sPath, "*.bmp", 1)
Global $aImage[$aFiles[0] + 1][4]

$iWidth = 0
$iHeight = 0
$iCnt = 1
For $i = 1 To $aFiles[0]
    $aImage[$iCnt][0] = _GDIPlus_ImageLoadFromFile($sPath & "\" & $aFiles[$i])
    If @error Then ContinueLoop
    $aImage[$iCnt][1] = _GDIPlus_ImageGetWidth($aImage[$iCnt][0])
    $aImage[$iCnt][2] = _GDIPlus_ImageGetHeight($aImage[$iCnt][0])
    $iWidth += $aImage[$iCnt][1]
    If $aImage[$iCnt][2] > $iHeight Then $iHeight = $aImage[$iCnt][2]
    $aImage[$iCnt][3]=$sPath & "\" & $aFiles[$i]
    $iCnt += 1
Next
$aImage[0][0] = $iCnt - 1

$hBitmap = _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight)
$hGraphic = _GDIPlus_ImageGetGraphicsContext($hBitmap)

$iX = 0
For $i = 1 To $aImage[0][0]
    ConsoleWrite($aImage[$i][3] & @CRLF)
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $aImage[$i][0], $iX, 0, $aImage[$i][1], $aImage[$i][2])
    $iX += $aImage[$i][1]
    _GDIPlus_ImageDispose($aImage[$i][0])
Next

_GDIPlus_ImageSaveToFile($hBitmap, $sPath & "\_Combined.jpg")

_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_BitmapDispose($hBitmap)
_GDIPlus_Shutdown()


$Path = @ScriptDir & "\_Combined.jpg"

$Width = _GetExtProperty ( $path , 27)

$W = stringtrimright ($Width , 7)

$hGui = GUICreate ("" , @DesktopWidth , @DesktopHeight, 0 , 0 , $WS_POPUPWINDOW , $WS_EX_COMPOSITED)
$hPic = GUICtrlCreatePic ( $path , 0 , 0 , $W , @DesktopHeight)

Guisetstate ()

for $i = 0 to -$W + @DesktopWidth step -2
GUICtrlSetPos ( $hPic, $i, 0)
Next

for $k = 0 to @DesktopHeight
GuiSetBkColor (Random(0x000000 , 0xFFFFFF))
    GUICtrlSetPos ( $hPic, $i, $k)
Next

exit

; #FUNCTION# ====================================================================================================================
; Name...........: _GDIPlus_BitmapCreateFromScan0
; Description ...: Creates a Bitmap object based on an array of bytes along with size and format information
; Syntax.........: _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight[, $iStride = 0[, $iPixelFormat = 0x0026200A[, $pScan0 = 0]]])
; Parameters ....: $iWidth         - The bitmap width, in pixels
;                  $iHeight     - The bitmap height, in pixels
;                  $iStride     - Integer that specifies the byte offset between the beginning of one scan line and the next. This
;                  +is usually (but not necessarily) the number of bytes in the pixel format (for example, 2 for 16 bits per pixel)
;                  +multiplied by the width of the bitmap. The value passed to this parameter must be a multiple of four
;                  $iPixelFormat - Specifies the format of the pixel data. Can be one of the following:
;                  |$GDIP_PXF01INDEXED   - 1 bpp, indexed
;                  |$GDIP_PXF04INDEXED   - 4 bpp, indexed
;                  |$GDIP_PXF08INDEXED   - 8 bpp, indexed
;                  |$GDIP_PXF16GRAYSCALE - 16 bpp, grayscale
;                  |$GDIP_PXF16RGB555    - 16 bpp; 5 bits for each RGB
;                  |$GDIP_PXF16RGB565    - 16 bpp; 5 bits red, 6 bits green, and 5 bits blue
;                  |$GDIP_PXF16ARGB1555  - 16 bpp; 1 bit for alpha and 5 bits for each RGB component
;                  |$GDIP_PXF24RGB       - 24 bpp; 8 bits for each RGB
;                  |$GDIP_PXF32RGB       - 32 bpp; 8 bits for each RGB. No alpha.
;                  |$GDIP_PXF32ARGB      - 32 bpp; 8 bits for each RGB and alpha
;                  |$GDIP_PXF32PARGB     - 32 bpp; 8 bits for each RGB and alpha, pre-mulitiplied
;                  $pScan0        - Pointer to an array of bytes that contains the pixel data. The caller is responsible for
;                  +allocating and freeing the block of memory pointed to by this parameter.
; Return values .: Success      - Returns a handle to a new Bitmap object
;                  Failure      - 0 and either:
;                  |@error and @extended are set if DllCall failed
;                  |$GDIP_STATUS contains a non zero value specifying the error code
; Remarks .......: After you are done with the object, call _GDIPlus_ImageDispose to release the object resources
; Related .......: _GDIPlus_ImageDispose
; Link ..........; @@MsdnLink@@ GdipCreateBitmapFromScan0
; Example .......; Yes
; ===============================================================================================================================
Func _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight, $iStride = 0, $iPixelFormat = 0x0026200A, $pScan0 = 0)
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $iWidth, "int", $iHeight, "int", $iStride, "int", $iPixelFormat, "ptr", $pScan0, "int*", 0)

    If @error Then Return SetError(@error, @extended, 0)
    $GDIP_STATUS = $aResult[0]
    Return $aResult[6]
EndFunc   ;==>_GDIPlus_BitmapCreateFromScan0
Edited by iamtheky

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0