corgano Posted March 3, 2013 Posted March 3, 2013 (edited) Derp, accidently itOk, so when I make some text with GDIplus, it attempts to make it look better by adding hue to the right / left sides of letters. example:The top "this" is the rendered text, the bottom one is the same with the pixels magnified 600%I do not want it to do this! Please help#include <GUIConstantsEx.au3> #include <GDIPlus.au3> _Main() Func _Main() Local $hGUI, $hGraphic, $hBrush, $hFormat, $hFamily, $hFont, $tLayout Local $sString = "This is a string", $aInfo ; Create GUI $hGUI = GUICreate("GDI+", 150, 60) ; Draw a string _GDIPlus_Startup() $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) $hBitmap = _GDIPlus_BitmapCreateFromGraphics(150,60,$hGraphic) $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap) $hBrush = _GDIPlus_BrushCreateSolid(0xFF000000) $hBrush2 = _GDIPlus_BrushCreateSolid(0xFFFFFFFF) $hFormat = _GDIPlus_StringFormatCreate() $hFamily = _GDIPlus_FontFamilyCreate("Arial") $hFont = _GDIPlus_FontCreate($hFamily, 12, 1) $tLayout = _GDIPlus_RectFCreate(15, 15, 150, 30) _GDIPlus_GraphicsFillRect($hContext,0,0,150,60,$hBrush2) _GDIPlus_GraphicsDrawStringEx($hContext, $sString, $hFont, $tLayout, $hFormat, $hBrush) _GDIPlus_ImageSaveToFile($hBitmap,"This is an image.png") ShellExecute("This is an image.png") ; Clean up resources _GDIPlus_FontDispose($hFont) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_BrushDispose($hBrush) _GDIPlus_BrushDispose($hBrush2) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() EndFunc ;==>_Main Edited March 4, 2013 by corgano 0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e
Nessie Posted March 3, 2013 Posted March 3, 2013 Please post your code so we can help you Hi! My UDF: NetInfo UDF Play with your network, check your download/upload speed and much more! YTAPI Easy to use YouTube API, now you can easy retrive all needed info from a video. NavInfo Check if a specific browser is installed and retrive other usefull information. YWeather Easy to use Yahoo Weather API, now you can easily retrive details about the weather in a specific region. No-IP UDF Easily update your no-ip hostname(s). My Script: Wallpaper Changer Change you wallpaper dinamically, you can also download your wallpaper from your website and share it with all! My Snippet: _ImageSaveToBMPConvert an image to bmp format. _SciteGOTO Open a file in SciTE at specific fileline. _FileToHex Show the hex code of a specified file
corgano Posted March 3, 2013 Author Posted March 3, 2013 The main script is very long and has a good many issues, but I put code relivant to this issue in the first post. Just want to take them on one at a time 0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e
Nessie Posted March 3, 2013 Posted March 3, 2013 The main script is very long and has a good many issues, but I put code relivant to this issue in the first post. Just want to take them on one at a time Yes you have put the code in the first post but you have deleted what your issue is . Because your posted code seems to work good here Hi! My UDF: NetInfo UDF Play with your network, check your download/upload speed and much more! YTAPI Easy to use YouTube API, now you can easy retrive all needed info from a video. NavInfo Check if a specific browser is installed and retrive other usefull information. YWeather Easy to use Yahoo Weather API, now you can easily retrive details about the weather in a specific region. No-IP UDF Easily update your no-ip hostname(s). My Script: Wallpaper Changer Change you wallpaper dinamically, you can also download your wallpaper from your website and share it with all! My Snippet: _ImageSaveToBMPConvert an image to bmp format. _SciteGOTO Open a file in SciTE at specific fileline. _FileToHex Show the hex code of a specified file
corgano Posted March 3, 2013 Author Posted March 3, 2013 (edited) do me a favor, open the generated image in paint, zoom in. does it look like the above image? Do the letters have the red / blue fading to the sides? Or is it black and white? Edited March 3, 2013 by corgano 0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e
Nessie Posted March 3, 2013 Posted March 3, 2013 All seems to be fine here:Hi! My UDF: NetInfo UDF Play with your network, check your download/upload speed and much more! YTAPI Easy to use YouTube API, now you can easy retrive all needed info from a video. NavInfo Check if a specific browser is installed and retrive other usefull information. YWeather Easy to use Yahoo Weather API, now you can easily retrive details about the weather in a specific region. No-IP UDF Easily update your no-ip hostname(s). My Script: Wallpaper Changer Change you wallpaper dinamically, you can also download your wallpaper from your website and share it with all! My Snippet: _ImageSaveToBMPConvert an image to bmp format. _SciteGOTO Open a file in SciTE at specific fileline. _FileToHex Show the hex code of a specified file
corgano Posted March 3, 2013 Author Posted March 3, 2013 (edited) Is that in paint? I know windows picture viewer blurrs the pixels when you zoom in, but paint doesn't My issue is that in an attempt to make the text look better on screens is that it gives pixels by letters red or blue hues that look bad when printed Edited March 3, 2013 by corgano 0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e
Nessie Posted March 3, 2013 Posted March 3, 2013 Tested with paint and the gimp and all seems fine here. Hi! My UDF: NetInfo UDF Play with your network, check your download/upload speed and much more! YTAPI Easy to use YouTube API, now you can easy retrive all needed info from a video. NavInfo Check if a specific browser is installed and retrive other usefull information. YWeather Easy to use Yahoo Weather API, now you can easily retrive details about the weather in a specific region. No-IP UDF Easily update your no-ip hostname(s). My Script: Wallpaper Changer Change you wallpaper dinamically, you can also download your wallpaper from your website and share it with all! My Snippet: _ImageSaveToBMPConvert an image to bmp format. _SciteGOTO Open a file in SciTE at specific fileline. _FileToHex Show the hex code of a specified file
corgano Posted March 4, 2013 Author Posted March 4, 2013 (edited) Ok, then it's probably something wrong in the system scope... Checking clear type blarky, can anyone confirm this? Edit, all text on my computer has a similar effect to it, but cleartype is turned off? Is there any way to overwrite it when GDI makes the text? Edited March 4, 2013 by corgano 0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e
UEZ Posted March 4, 2013 Posted March 4, 2013 You have to disable smoothing aka antialiasing. Try this: expandcollapse popup#include <GUIConstantsEx.au3> #include <GDIPlus.au3> Global Enum $TextRenderingHintSystemDefault = 0, _ $TextRenderingHintSingleBitPerPixelGridFit, _ $TextRenderingHintSingleBitPerPixel, _ $TextRenderingHintAntiAliasGridFit, _ $TextRenderingHintAntiAlias, _ $TextRenderingHintClearTypeGridFit _Main() Func _Main() Local $hGUI, $hGraphic, $hBrush, $hFormat, $hFamily, $hFont, $tLayout Local $sString = "This is a string", $aInfo ; Create GUI $hGUI = GUICreate("GDI+", 150, 60) ; Draw a string _GDIPlus_Startup() $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) $hBitmap = _GDIPlus_BitmapCreateFromGraphics(150, 60, $hGraphic) $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap) DllCall($ghGDIPDll, "uint", "GdipSetTextRenderingHint", "handle", $hContext, "int", $TextRenderingHintSingleBitPerPixelGridFit) _GDIPlus_GraphicsSetSmoothingMode($hContext, 0) $hBrush = _GDIPlus_BrushCreateSolid(0xFF000000) $hBrush2 = _GDIPlus_BrushCreateSolid(0xFFFFFFFF) $hFormat = _GDIPlus_StringFormatCreate() $hFamily = _GDIPlus_FontFamilyCreate("Arial") $hFont = _GDIPlus_FontCreate($hFamily, 12, 1) $tLayout = _GDIPlus_RectFCreate(15, 15, 150, 30) _GDIPlus_GraphicsFillRect($hContext, 0, 0, 150, 60, $hBrush2) _GDIPlus_GraphicsDrawStringEx($hContext, $sString, $hFont, $tLayout, $hFormat, $hBrush) _GDIPlus_ImageSaveToFile($hBitmap, "This is an image.png") ShellExecute("This is an image.png") ; Clean up resources _GDIPlus_FontDispose($hFont) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_BrushDispose($hBrush) _GDIPlus_BrushDispose($hBrush2) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() EndFunc ;==>_Main Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
corgano Posted December 31, 2014 Author Posted December 31, 2014 (edited) I stumbled upon this thread again, and wondered if it was fixed in that example.... Since posting this I am on a completely different laptop. Still same issue. At this point I have no idea what is causing it or if it's fixable. Edited December 31, 2014 by corgano 0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now