Skip to content

Commit

Permalink
ability to draw outside screen (at least for BW images)
Browse files Browse the repository at this point in the history
  • Loading branch information
Erich Styger committed Dec 19, 2022
1 parent 5c75acf commit be40295
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
8 changes: 4 additions & 4 deletions Beans/GDisplay/GDisplay.bean
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Name>GDisplay</Name>
<Description>Graphic Display Driver</Description>
<Author>Erich Styger</Author>
<Version>01.209</Version>
<Version>01.210</Version>
<Icon>GDisplay</Icon>
<TypesFiles>PE,GDisplay\GDisplay</TypesFiles>
<FileVersion>6</FileVersion>
Expand Down Expand Up @@ -949,13 +949,13 @@
<ParamCount>5</ParamCount>
<Parameter>
<ParName>x</ParName>
<ParType>PixelDim</ParType>
<ParType>16bit signed</ParType>
<ParPassing>Value</ParPassing>
<ParHint>x position of left upper corner</ParHint>
</Parameter>
<Parameter>
<ParName>y</ParName>
<ParType>PixelDim</ParType>
<ParType>16bit signed</ParType>
<ParPassing>Value</ParPassing>
<ParHint>y position of left upper corner</ParHint>
</Parameter>
Expand All @@ -980,7 +980,7 @@
</Parameter>
<Scope>PRIVATE</Scope>
<Declarations>
<ANSIC>void #M#_#C#(%'ModuleName'_PixelDim x, %'ModuleName'_PixelDim y, PIMAGE image, %'ModuleName'_PixelColor pixelColor, %'ModuleName'_PixelColor backgroundColor)</ANSIC>
<ANSIC>void #M#_#C#(int16_t x, int16_t y, PIMAGE image, %'ModuleName'_PixelColor pixelColor, %'ModuleName'_PixelColor backgroundColor)</ANSIC>
</Declarations>
</TMthdItem>
</Method>
Expand Down
2 changes: 1 addition & 1 deletion Beans/GDisplay/GDisplay.uis
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

[USED_FACES]
BeanVersion=01.209
BeanVersion=01.210

InterfacesCount=4

Expand Down
6 changes: 3 additions & 3 deletions Beans/GDisplay/GDisplayMethods.html
Original file line number Diff line number Diff line change
Expand Up @@ -392,10 +392,10 @@
- Draws a B/W bitmap.
<ul>
<!---VER_SPEC #ANSIC# DON'T CHANGE THIS LINE-->
<br /><i>ANSIC prototype:</i> void DrawMonoBitmap(<i>ComponentName_</i>PixelDim x, <i>ComponentName_</i>PixelDim y, PIMAGE image, <i>ComponentName_</i>PixelColor pixelColor, <i>ComponentName_</i>PixelColor backgroundColor)<br />
<br /><i>ANSIC prototype:</i> void DrawMonoBitmap(int16_t x, int16_t y, PIMAGE image, <i>ComponentName_</i>PixelColor pixelColor, <i>ComponentName_</i>PixelColor backgroundColor)<br />
<!---VER_SPEC_END DON'T CHANGE THIS LINE-->
<li><i>x:<i>ComponentName_</i>PixelDim</i> - x position of left upper corner</li>
<li><i>y:<i>ComponentName_</i>PixelDim</i> - y position of left upper corner</li>
<li><i>x:int16_t</i> - x position of left upper corner</li>
<li><i>y:int16_t</i> - y position of left upper corner</li>
<li><i>image:uint8_t</i> - Pointer to image structure and information.</li>
<li><i>pixelColor:<i>ComponentName_</i>PixelColor</i> - Color to be used for pixels (pixel set)</li>
<li><i>backgroundColor:<i>ComponentName_</i>PixelColor</i> - Color to be used for background (pixel not set)</li>
Expand Down
15 changes: 9 additions & 6 deletions Drivers/sw/GDisplay.drv
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ extern "C" {
%-BW_METHOD_MACROS_END

%-STARTUSERTYPES - Do not make changes between lines (included this lines) marked with %-STARTUSERTYPES and %-ENDUSRTYPES

%-ENDUSRTYPES
%-BW_BEAN_CONSTANTS_START - Do not make changes between lines (included this lines) marked with %-BW_BEAN_CONSTANTS_START and %-BW_BEAN_CONSTANTS_END
%- No constants defined in the BeanWizard for this bean
Expand Down Expand Up @@ -408,7 +409,7 @@ void %'ModuleName'%.%DrawBox(%'ModuleName'_PixelDim x, %'ModuleName'_PixelDim y,
%-************************************************************************************************************
%-BW_METHOD_BEGIN DrawMonoBitmap
%ifdef DrawMonoBitmap
void %'ModuleName'%.%DrawMonoBitmap(%'ModuleName'_PixelDim x, %'ModuleName'_PixelDim y, PIMAGE image, %'ModuleName'_PixelColor pixelColor, %'ModuleName'_PixelColor backgroundColor);
void %'ModuleName'%.%DrawMonoBitmap(int16_t x, int16_t y, PIMAGE image, %'ModuleName'_PixelColor pixelColor, %'ModuleName'_PixelColor backgroundColor);
%define! Parx
%define! Pary
%define! Parimage
Expand Down Expand Up @@ -1152,9 +1153,9 @@ void %'ModuleName'%.%DrawBox(%'ModuleName'_PixelDim x, %'ModuleName'_PixelDim y,
%define! ParpixelColor
%define! ParbackgroundColor
%include Common\GDisplayDrawMonoBitmap.Inc
void %'ModuleName'%.%DrawMonoBitmap(%'ModuleName'_PixelDim x, %'ModuleName'_PixelDim y, PIMAGE image, %'ModuleName'_PixelColor pixelColor, %'ModuleName'_PixelColor backgroundColor)
void %'ModuleName'%.%DrawMonoBitmap(int16_t x, int16_t y, PIMAGE image, %'ModuleName'_PixelColor pixelColor, %'ModuleName'_PixelColor backgroundColor)
{
%'ModuleName'%.PixelDim x0, y0, xe, ye;
int x0, y0, xe, ye;
%'ModuleName'%.PixelColor pixel;
uint8_t i;
const uint8_t *data;
Expand All @@ -1170,14 +1171,16 @@ void %'ModuleName'%.%DrawMonoBitmap(%'ModuleName'_PixelDim x, %'ModuleName'_Pixe
%endif
data = image->pixmap;
y0 = y;
ye = (%'ModuleName'%.PixelDim)(y+image->height-1);
xe = (%'ModuleName'%.PixelDim)(x+image->width-1);
ye = (y+image->height-1);
xe = (x+image->width-1);
for(;;) {
i=7;
x0 = x;
for(;;) {
pixel = (%'ModuleName'%.PixelColor)(((*data)&(1<<i))>>i); /* extract pixel out of bitstream */
%'ModuleName'%.%PutPixel(x0, y0, (%'ModuleName'%.PixelColor)(pixel==1?pixelColor:backgroundColor));
if (x0>=0 && y0>=0) { /* do not write pixel if outside of display */
%'ModuleName'%.%PutPixel(x0, y0, (%'ModuleName'%.PixelColor)(pixel==1?pixelColor:backgroundColor));
}
if (i==0 && x0!=xe) { /* next byte inside the row */
data++;
i = 7;
Expand Down

0 comments on commit be40295

Please sign in to comment.