Seite 11 von 12

Re: [Windows] 2DDrawing Befehle mit AntiAliasing durch GDI+

Verfasst: 09.02.2012 21:50
von STARGÅTE
Das ist mir klar, aber wenn ich definiere, dass mein Text eine feste Breite nicht überschreiten darf,
und er durch gDrawFormattedText() nach unten "verlängert" wird, dann müsste es ja auch eine Möglichkeit geben,
dass man dann auch die Höhe bekommt.
Allerdings müsste man dann für gTextWidth() und gTextHeight() eine Art gSetTextArea() definieren, damit auch diese Funktionen das Format nutzen, oder gFormattedTextWidth() und gFormattedTextHeight() mit Definition von maxWidth und maxHeight.

Re: [Windows] 2DDrawing Befehle mit AntiAliasing durch GDI+

Verfasst: 10.04.2012 17:39
von STARGÅTE
Hallo Danilo,

ich würde gerne wieder auf dieses Angebot zurückkommen: Windows Enhanced Metafile Format (weiß nicht woraum ich da nicht geantwortet habe).

Ich würde halt gerne die Ausgabe von GDI+ auf das EMF-Format umleiten, um es halt als Vektorgrafik in Word zu haben.
Wäre echt super.

Re: [Windows] 2DDrawing Befehle mit AntiAliasing durch GDI+

Verfasst: 13.04.2012 09:55
von Danilo
STARGÅTE hat geschrieben:ich würde gerne wieder auf dieses Angebot zurückkommen: Windows Enhanced Metafile Format (weiß nicht woraum ich da nicht geantwortet habe).
Kommt gerade etwas ungelegen. Ich brauche mal etwas Ruhe da oben! und dann einen Arschtritt.
Also mal eine Pause zum auftanken. Und dann wie Minimalisten mit Weisheit auf das Wesentliche konzentrieren, mit neuer Energie.
Wenn ich oben keine Ruhe rein bekomme, dann zumindest die Gedanken ändern und alles aufschreiben.

Kann also nichts versprechen oder Zeitplan geben. Mal schauen wie ich Lust und Laune dazu habe -
im Moment hab ich grad zu nix Lust, aber das ändert sich hoffentlich bald wieder. Nach einer kleinen
Pause oder vielleicht schon am Wochenende, wenn es nicht zu viel Arbeit und Stress macht. ;)

Re: [Windows] 2DDrawing Befehle mit AntiAliasing durch GDI+

Verfasst: 13.04.2012 18:54
von Drago
@Danilo:

Ich schmeiß mich weg, wie geil is dat denn :lol: :lol: :lol: ..

Re: [Windows] 2DDrawing Befehle mit AntiAliasing durch GDI+

Verfasst: 13.04.2012 19:59
von STARGÅTE
@Danilo:

Sehe meine Beiträge nur als Einträge in eine Wunschliste.
Zeit ist hier egal, da ich selber nicht aktive an meine Programm arbeite.

Re: [Windows] 2DDrawing Befehle mit AntiAliasing durch GDI+

Verfasst: 14.04.2012 11:30
von Danilo
STARGÅTE hat geschrieben:Zeit ist hier egal, da ich selber nicht aktive an meine Programm arbeite.
Gut, dann hier nur mal etwas zum testen der Idee: gDrawing_v0.85b.zip (87,9k)

Code: Alles auswählen

gDrawing v0.85b, 14. April 2012

- added commands

    gImage = gLoadMetafile( filename.s )
    
        load .EMF and .WMF

    gMetafileOutput( @metafile, Width, Height [, filename.s [, description.s ]] )
        
        
- added examples

    example 25  -  create and display .EMF metafile
    example 26  -  load   and display .WMF or .EMF metafiles
gMetafileOutput( @image, 800, 600) ; erstellt ein Metafile nur im Speicher
gMetafileOutput( @image, 800, 600, "mein.emf" ) ; erstellt ein Metafile in die Datei "mein.emf"

Der optionale letzte Parameter "description" wird in die .EMF gespeichert, als Beschreibung des Bildes.

Der erste Parameter ist eine Adresse zu einer Variablen (Integer), in die das gImage geschrieben wird.
Dieses Bild verwendet man dann für gDrawImage(), gDrawClippedImage() und gFreeImage().

gLoadMetafile(filename.s) sollte klar sein. Lädt .EMF und .WMF, der Rückgabewert ist ein gImage.
Habe ich mit einigen .WMF von MS Office probiert.

Es fehlen für Metafiles noch die Funktionen gImageWidth() und gImageHeight() um die ursprünglichen
Dimensionen von geladenen Metafiles zu bekommen. Vielleicht auch gGetMetafileDescription( image ).

Ist das erstmal so ungefähr was Du Dir vorgestellt hast?

Re: [Windows] 2DDrawing Befehle mit AntiAliasing durch GDI+

Verfasst: 14.04.2012 13:05
von STARGÅTE
So auf anhieb, jo, perfekt, danke.

Kann erst heute abend etwas genauer testen, aber hab das Beispiel auf die Schnelle gestartet und das EMF in Word eingefügt und es funktioniert.

Muss jetzt nur noch die ClipBoard-Befehle suchen, damit ich sozusagen von meinem Programm zu Word kopieren kann.

EDIT:
Irgendwie bekomme ich das MteaFile nicht in die Zwischenablage:

Code: Alles auswählen

OpenClipboard_(#Null)
   Debug SetClipboardData_(#CF_ENHMETAFILE, metafile)
CloseClipboard_()
Es wird immer 0 zurückgegeben.
PS: Mit #CF_TEXT und einem String-Pointer funktioniert es.

Re: [Windows] 2DDrawing Befehle mit AntiAliasing durch GDI+

Verfasst: 22.04.2012 00:08
von STARGÅTE
Habe eben einen Bug entdeckt.

Wenn man mit gDrawFormattedText() den Text auf Center oder Right setzt, dann hat das auch einfluss auf den normalen gDrawText() befehl, da dort GdipSetStringFormatAlign_() nicht zurück gesetzt wird:
Hier mal die Verbesserung:

Code: Alles auswählen

        GdipStringFormatGetGenericTypographic_(@sformat)
        If width = -1.0 And height = -1.0
            sformatflags = $1000|$4000  ; NoWrap, NoClip
            r\Width = 0 : r\Height = 0
            GdipSetStringFormatAlign_    (sformat, 0) ; << sowas müsste da hin
            GdipSetStringFormatLineAlign_(sformat, 0) ; << sowas müsste da hin
            GdipSetStringFormatTrimming_ (sformat, 0) ; << sowas müsste da hin
        Else
            sformatflags = 0
            sformatflags | (((__drawTextFlags>>5)&%1)*$1000) ; NoWordWrap
            sformatflags | (((__drawTextFlags>>6)&%1)*$2000) ; LineLimit, full lines only
            r\Width = width : r\Height = height
            GdipSetStringFormatAlign_    (sformat, __drawTextFlags     &  %11)
            GdipSetStringFormatLineAlign_(sformat,(__drawTextFlags>>2) &  %11)
            GdipSetStringFormatTrimming_ (sformat,(__drawTextFlags>>7) & %111)
        EndIf
musst du noch mal selber gucken, wie das das hinschreibst.

Re: [Windows] 2DDrawing Befehle mit AntiAliasing durch GDI+

Verfasst: 23.04.2012 05:02
von Danilo
STARGÅTE hat geschrieben:Habe eben einen Bug entdeckt.

Wenn man mit gDrawFormattedText() den Text auf Center oder Right setzt, dann hat das auch einfluss auf den normalen gDrawText() befehl, da dort GdipSetStringFormatAlign_() nicht zurück gesetzt wird:
Vielen Dank, STARGÅTE.

Da speichert GDI+ anscheinend ein paar States für Alignment und so, denn ich erstelle
ein neues StringFormat (GdipStringFormatGetGenericTypographic_(@sformat)).

Ist nun behoben, Danke nochmal.

Weitere Neuigkeiten: gLoadAppFont() und gCatchAppFont() um eigene TrueTypeFonts (.ttf) zu nutzen. Wurde von 'eesau' im engl. Forum gewünscht.

Hier die Übersicht über die Version 0.85b2:

Code: Alles auswählen

gDrawing v0.85b2, 23. April 2012

- added commands

    success = gLoadAppFont( filename.s )
    
        load .ttf font
        and add it to the internal application font list
        
        returns 0 if failed

    gCatchAppFont( *memory, length )

        catch/load .ttf font from memory
        and add it to the internal application font list
        
        returns 0 if failed

    gFreeAppFonts()

        release/free the internal application font list
    
        Note: The internal application font list is automatically freed
              at program end in the function gEnd().
              You can use gFreeAppFonts() to free the list manually
              if you don't need the internal application fonts anymore.
              Maybe useful in applications that run for a long time period.

              
- changed commands

    gGetFontList() has now optional flag parameter
    
        the only valid flag is #PB_Font_App
        for getting the internal application font list

    gSetFont() has a new flag for FontStyle: #PB_Font_App
    
        #PB_Font_App has to be used to set fonts
        from the internal application font list

        
- fixed commands

    gDrawText() did not work correctly after setting some flags (like alignment)
                with gSetDrawTextFlags() and using gDrawFormattedText() thereafter.

                Thanks to STARGÅTE for finding and reporting the issue!

        
- added Flags

    #PB_Font_App
    
        for gSetFont()     -> FontStyle #PB_Font_App uses the internal application font list,
                              not the system font list.
                              You add fonts to the internal application font list by using
                              gLoadAppFont and gCatchAppFont.
        
        for gGetFontList() -> If you specify the optional flag #PB_Font_App,
                              the internal application font list is added to
                              your linked list (1st argument).
                              


- added examples

    example 27  -  gLoadAppFont  - load true type font (.ttf)
    example 28  -  gCatchAppFont - load true type font (.ttf) from memory
DOWNLOAD: gDrawing_v0.85b2.zip (89,1k)

Re: [Windows] 2DDrawing Befehle mit AntiAliasing durch GDI+

Verfasst: 09.08.2012 14:23
von Codusa
Hi,
Ich grabe den Thread mal wieder aus, wenn das OK ist...
Ich habe ein Problem: Wenn ich mit gRoundBox() zeichne oder auch nur mit gBox() dann halbiert sich die FPS, wenn ich an die "falschen" Koordinaten zeiche...
Wenn ich also bei (x|y) zeichne, 60fps und bei (x-1|y) plötzlich nur noch 30fps...
Bei folgenden Optionen:

Code: Alles auswählen

gSetAntialiasMode(#AntialiasMode_HighQuality)
  gSetCompositingQuality(#CompositingQualityHighQuality)
  gSetInterpolationMode(#InterpolationModeHighQualityBicubic)
  gSetPixelOffsetMode(#PixelOffsetModeHighQuality)
Danke im Vorraus!