Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/02/2024 in Posts

  1. I ported half of the Cairo functions to Autoit. You can read more about the functions here: https://www.cairographics.org/documentation/ The probability is high that errors have crept in and I have only tested a fraction of the functions. Anyone who wants to can contribute examples. All needed files (DLLs, UDF and examples) can be download from my OneDrive: Cairo for Autoit If you find a mistake, I am sure you will, then please report it.
    8 points
  2. This seems to work but you need libcairo-2.dll which can be found also on my OneDrive (x86 / x64 folders). ;Coded by UEZ build 2024-04-02 beta #AutoIt3Wrapper_UseX64=n #include "..\Cairo.au3" Cairo_Example() Func Cairo_Example() If Not Cairo_Init("libcairo-2.dll") Then ConsoleWrite(@error & @CRLF) Exit EndIf If FileExists("Example.pdf") Then FileDelete("Example.pdf") Local $MM_TO_PT = 72.0 / 25.4, $PAGE_WIDTH_A5 = 148, $PAGE_HEIGHT_A5 = 210, $PAGE_WIDTH_A4 = 210, $PAGE_HEIGHT_A4 = 297 Local Const $pSurface = Cairo_PDF_Create("Example.pdf", $PAGE_WIDTH_A5 * $MM_TO_PT, $PAGE_HEIGHT_A5 * $MM_TO_PT) Cairo_PDF_RestrictToVersion($pSurface, $CAIRO_PDF_VERSION_1_4) Local Const $pContext = Cairo_Context_Create($pSurface) Cairo_Context_SetLineWidth($pContext, 6) Cairo_Context_PathAddRectangle($pContext, 12, 12, 232,70) Cairo_Context_PathBeginNewSub($pContext) Cairo_Context_PathAddArc($pContext, 64, 64, 40, 0, ACos(-1) * 2) Cairo_Context_PathBeginNewSub($pContext) Cairo_Context_PathAddArcNegative($pContext, 192, 64, 40, 0, -ACos(-1) * 2) Cairo_Context_SetFillRule($pContext, $CAIRO_FILL_RULE_EVEN_ODD) Cairo_Context_SetSourceRGB($pContext, 0, 0.7, 0) Cairo_Context_FillPreserve($pContext) Cairo_Context_SetSourceRGB($pContext, 0, 0, 0) Cairo_Context_Stroke($pContext) Cairo_Context_Translate($pContext, 0, 128) Cairo_Context_PathAddRectangle($pContext, 12, 12, 232,70) Cairo_Context_PathBeginNewSub($pContext) Cairo_Context_PathAddArc($pContext, 64, 64, 40, 0, ACos(-1) * 2) Cairo_Context_PathBeginNewSub($pContext) Cairo_Context_PathAddArcNegative($pContext, 192, 64, 40, 0, -ACos(-1) * 2) Cairo_Context_SetFillRule($pContext, $CAIRO_FILL_RULE_WINDING) Cairo_SetColor($pContext, 0, 0, 0.9) Cairo_Context_FillPreserve($pContext) Cairo_SetColor($pContext, 0, 0, 0) Cairo_Context_Stroke($pContext) Cairo_Context_PathClear($pContext) Cairo_Context_PathAddMoveTo($pContext, 40, 150) Cairo_Font_SelectFace($pContext) Cairo_Font_SetSize($pContext, 30) Cairo_Context_PathAddText($pContext, "PDF Example") Cairo_SetColor($pContext, 0.9, 0, 0, 1) Cairo_Context_FillPreserve($pContext) Cairo_SetColor($pContext, 0, 0, 0.1, 0.5) Cairo_Context_SetLineWidth($pContext, 1.5) Cairo_Context_Stroke($pContext) Cairo_Surface_Finish($pSurface) Cairo_Surface_Flush($pSurface) ConsoleWrite(Cairo_Surface_GetStatus($pSurface) & @CRLF) Cairo_Context_Destroy($pContext) Cairo_Surface_Destroy($pSurface) Cairo_Close() ConsoleWrite(FileGetSize("Example.pdf") & @CRLF) EndFunc I seems that the Cairo.dll / Cairo64.dll doesn't work properly with PDF creation...
    1 point
  3. 1 point
  4. The functions are added but the created PDF is currently empty. When I found a way to create working PDFs I will post it.
    1 point
  5. Can you write an example using a PDF surface?
    1 point
  6. Andreik

    ePUB Reader

    New version available. Fixed a small bug in UpdateSlider().
    1 point
  7. Thanks so much for the tip. I found this bit of code that I added just before defining the GUI and it works perfectly! ;Make gui DPI AWARE... If @OSVersion = 'WIN_10' Then DllCall("User32.dll", "bool", "SetProcessDpiAwarenessContext" , "HWND", "DPI_AWARENESS_CONTEXT" -2) If @OSVersion = 'WIN_81' Then DllCall("User32.dll", "bool", "SetProcessDPIAware")
    1 point
  8. CalebG

    WinClose

    I had the same issue, just trying to follow the 'Simple Notepad Automation' tutorial in AutoIt Help. I think Jos' answer is the solution. After typing something in notepad the title changes from "Untitled - Notepad" to "*Untitled - Notepad" (the '*' indicates you have unsaved changes). So you need to change the WinClose command to: WinClose("*Untitled - Notepad") And then it works. The AutoIt Help should probably be updated to reflect this?
    1 point
×
×
  • Create New...