AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

GDI+ standard library 1.30 by tic
Goto page Previous  1, 2, 3 ... 14, 15, 16 ... 22, 23, 24  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
TheGood



Joined: 30 Jul 2007
Posts: 399

PostPosted: Wed Mar 25, 2009 7:09 pm    Post subject: Reply with quote

Smurth wrote:
I've done this like that

Thank you! Exactly what I needed! Very Happy
Back to top
View user's profile Send private message Visit poster's website
Guest






PostPosted: Fri Mar 27, 2009 2:04 pm    Post subject: Reply with quote

Lexikos wrote:
tic, I have a few suggestions:
  • When the source co-ordinates are omitted from DrawImage, default to the entire image. Currently if I say "draw an image at 0,0 and make it 100x100" and the image is only 16x16, the result will be 16x16. GDI+ offers overloads of DrawImage() which accept only a pair of co-ordinates, and will draw the entire image at those co-ordinates. These are available in the flat API; alternatively, you could simulate them by retrieving the size of the image.
  • Similarly, allow the destination size to be omitted.
  • Implement a wrapper for GdipGraphicsClear (I've suggested this before).


I definitely agree with those suggestions.
How would I go about using GdipGraphicsClear manually for now? I tried looking for it on MSDN but only found the .NET equivalent. Would it just be DllCall("GdipGraphicsClear", "UInt", graph, "UInt", BackGroundColor) ?
Back to top
Lexikos



Joined: 17 Oct 2006
Posts: 4469
Location: Qld, Australia

PostPosted: Fri Mar 27, 2009 2:23 pm    Post subject: Reply with quote

Close, but the function must be qualified with the DLL name.
Code:
DllCall("gdiplus\GdipGraphicsClear", "UInt", graph, "UInt", BackGroundColor)
Btw, you may refer to MSDN: GDI+ Flat API. It lists and defines flat functions by category, linking to the corresponding C++ wrapper methods. (These are almost the same as their .NET counterparts.) I find the Windows SDK headers to be more useful (accurate and complete), though.
Back to top
View user's profile Send private message Visit poster's website
tic



Joined: 22 Apr 2007
Posts: 1458

PostPosted: Fri Mar 27, 2009 2:44 pm    Post subject: Reply with quote

Ok, things I will bring out shortly (and posting this here just to have a written to do list) are:

  • An example showing how to use matrices when drawing to change colours
  • Edit Gdip_DrawImage to be able to leave out the source coordinates, but also resize. Also allow destination size to be omitted
  • Create better functions for GdipCreateBitmapFromScan0, similar to the BRA functions
  • Add GdipGraphicsClear
  • Improve support for BRAs and give examples
  • Give example of updating an area of a graphics context, without updating the whole thing
Back to top
View user's profile Send private message
bitcloud



Joined: 30 Oct 2008
Posts: 27

PostPosted: Wed Apr 01, 2009 12:25 am    Post subject: Reply with quote

Hi,
What I'm trying to do is paint an pixel matrix onto the screen at specific locations...

I have 3x3 (for example) pixel matrices loaded into a variable in the following format:
0xFFFFFF0xFFFFFF0xFFFFFF0xFFFFFF0xFFFFFF0xFFFFFF0xFFFFFF0xFFFFFF0xFFFFFF

I wanted to try and paint them out onto the screen (and later specifically remove them)

At the very least, I wanted to work out how to paint an individual pixel of a specific color, onto a specific point on the screen.

Does anyone have any clues on this? Cheers Smile
Back to top
View user's profile Send private message
Nicklea
Guest





PostPosted: Fri Apr 03, 2009 4:46 pm    Post subject: Reply with quote

tic wrote:
Ok, things I will bring out shortly (and posting this here just to have a written to do list) are:

[*]An example showing how to use matrices when drawing to change colours


Very Happy Thank you Tic, I am so grateful for your knowledge & assistance on that one. Looking forward. Have best day!
Back to top
tkoi



Joined: 26 Jun 2008
Posts: 56

PostPosted: Wed Apr 22, 2009 12:59 am    Post subject: Reply with quote

tic, I think SetImage() should return ErrorLevel. Currently it returns nothing. This came to my attention because I just spent 20 minutes trying to figure out why my script was leaking 256kb and a GDI object every time a certain routine was called. Turns out, STM_SETIMAGE returns a handle to a copy of the bitmap that was previously set to the static control (or NULL if none).

See MSDN: http://msdn.microsoft.com/en-us/library/bb760782%28VS.85%29.aspx
Quote:
Important

In version 6 of the Microsoft Win32 controls, a bitmap passed to a static control using the STM_SETIMAGE message was the same bitmap returned by a subsequent STM_SETIMAGE message. The client is responsible to delete any bitmap sent to a static control.

With Microsoft Windows XP, if the bitmap passed in the STM_SETIMAGE message contains pixels with non-zero alpha, the static control takes a copy of the bitmap. This copied bitmap is returned by the next STM_SETIMAGE message. The client code may independently track the bitmaps passed to the static control, but if it does not check and release the bitmaps returned from STM_SETIMAGE messages, the bitmaps are leaked.
Back to top
View user's profile Send private message
tic



Joined: 22 Apr 2007
Posts: 1458

PostPosted: Thu Apr 30, 2009 12:16 am    Post subject: Reply with quote

Thanks for pointing this out tkoi. Any suggestions for how you would like the function to look? You're right it should have a return value

Also, some minor updates just released. Still need to work on the big stuff...
Back to top
View user's profile Send private message
sorockinalex
Guest





PostPosted: Mon May 04, 2009 10:48 am    Post subject: Reply with quote

Please Help!

I'm printing... The code at the bottom is not working when xPos or yPos<>0. Where is my mistake? Or CreateRectF didn't working with xPos and yPos<>0???
Code:

CreateRectF(RectF,xPos,yPos, 1000,1000)
DllCall("User32.dll\DrawTextEx", "UInt", hDC, "Str", "some ksj sdfkjshd fjksdhkfj shkdjf hskjdf hsdftext", "UInt", 3000, "UInt", &RectF, "UInt", DT_WORDBREAK, "UInt", 0)
Back to top
Lexikos



Joined: 17 Oct 2006
Posts: 4469
Location: Qld, Australia

PostPosted: Mon May 04, 2009 11:01 am    Post subject: Reply with quote

CreateRectF creates a RectF structure, which contains four Floating-point numbers. DrawTextEx accepts LPRECT, a pointer to a RECT structure, which contains four integers. Zero is probably the only number which has the same binary representation in the two formats (floating-point and integer).

Use either of the following instead:
Code:
VarSetCapacity(RECT, 16)
NumPut(left, RECT, 0)
NumPut(top, RECT, 4)
NumPut(right, RECT, 8)
NumPut(bottom, RECT, 12)
Code:
VarSetCapacity(RECT, 16), NumPut(bottom, NumPut(right, NumPut(top, NumPut(left, RECT))))
Btw, DrawTextEx is a GDI function, not GDI+. RectF and Rect are defined in the GDI+ headers and used by GDI+ functions. They define a position, width and height. RECT is used by GDI, and its fields have different meanings: it defines two points - the top-left and bottom-right.
Back to top
View user's profile Send private message Visit poster's website
sorockinalex
Guest





PostPosted: Mon May 04, 2009 8:41 pm    Post subject: Reply with quote

Thanks!
hm... i'm finding a way to do text narrowing to width... How can i do this?
I supposed, that i can do it with DrawTextEx and print it in the rectangle area...
Am i wright?
Back to top
Guest






PostPosted: Tue May 26, 2009 4:12 am    Post subject: Reply with quote

Hi Tic, after I draw graphics objects, do you have any best practices recommended in terms of making sure all memory resources are cleared out? Very Happy
Back to top
garkin



Joined: 27 May 2009
Posts: 17

PostPosted: Wed May 27, 2009 10:46 pm    Post subject: Reply with quote

Found a little error at v1.28.
Code:
;MatrixNegative := "-1|0|0|0|0|" "0|-1|0|0|0|" "0|0|-1|0|0|" "0|0|0|1|0|" "0|0|0|0|1"

Must be:
Code:
;MatrixNegative := "-1|0|0|0|0|" "0|-1|0|0|0|" "0|0|-1|0|0|" "0|0|0|1|0|" "1|1|1|0|1


Would be functions for work with DrawImageFx and Effects classes added in future releases?
Back to top
View user's profile Send private message
Nicklea
Guest





PostPosted: Wed Jun 03, 2009 8:37 am    Post subject: Reply with quote

HI Tic Very Happy Very Happy May I pplease ask, the demonstrations you spoke of, about transforming bitmaps to some different solid color. May I please ask if there is anything yet you can show us? Cool Have a wonderful day!
Back to top
garkin



Joined: 27 May 2009
Posts: 17

PostPosted: Sun Jun 07, 2009 10:18 pm    Post subject: Reply with quote

Small usefull function, that was not found in 1.28.
Code:
Gdip_GraphicsFromHWND(hwnd)
{
    DllCall("gdiplus\GdipCreateFromHWND", "UInt", hwnd, "UInt*", pGraphics)
    Return, pGraphics
}
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3 ... 14, 15, 16 ... 22, 23, 24  Next
Page 15 of 24

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group